From d5c4471790572a33a47d80317f523aac096c216e Mon Sep 17 00:00:00 2001 From: stippi Date: Mon, 3 May 2010 12:20:37 +0000 Subject: [PATCH] * Fixed double click outside tabs to only be recognized when the first click was outside as well. * Single tertiary click outside tabs opens new tab on mouse up. * Reset fClickCount always when the click was inside a tab. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@474 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/tabview/TabContainerView.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/apps/webpositive/tabview/TabContainerView.cpp b/src/apps/webpositive/tabview/TabContainerView.cpp index 70badaf3d1..fc0f41b8bc 100644 --- a/src/apps/webpositive/tabview/TabContainerView.cpp +++ b/src/apps/webpositive/tabview/TabContainerView.cpp @@ -136,8 +136,11 @@ TabContainerView::MouseDown(BPoint where) if (fLastMouseEventTab) fLastMouseEventTab->MouseDown(where, buttons); else { - if (clicks > 1) - fClickCount++; + if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) { + // Middle click outside tabs should always open a new tab. + fClickCount = 2; + } else if (clicks > 1) + fClickCount = fClickCount++; else fClickCount = 1; } @@ -148,15 +151,16 @@ void TabContainerView::MouseUp(BPoint where) { fMouseDown = false; - if (fLastMouseEventTab) + if (fLastMouseEventTab) { fLastMouseEventTab->MouseUp(where); - else if (fClickCount > 1) { + fClickCount = 0; + } else if (fClickCount > 1) { // NOTE: fClickCount is >= 1 only if the first click was outside // any tab. So even if fLastMouseEventTab has been reset to NULL // because this tab was removed during mouse down, we wouldn't // run the "outside tabs" code below. - fClickCount = 0; fController->DoubleClickOutsideTabs(); + fClickCount = 0; } // Always check the tab under the mouse again, since we don't update // it with fMouseDown == true.