[haiku-webkit-commits] r309 - webkit/trunk/WebKit/haiku/WebPositive

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Sat, 13 Mar 2010 14:10:14 +0000

Author: stippi
Date: Sat Mar 13 14:10:14 2010
New Revision: 309
URL: http://mmlr.dyndns.org/changeset/309

Log:
Bugfixes for tab view click events:
 * When adding/removing tabs, process a fake mouse moved event to synchronize
   with the new tab layout.
 * Count the mouse clicks for the "double click into empty area opens new tab"
   feature in such a way that clicks into tabs never count (closing a tab was
   the first click before, the second would immediately open a new tab and
   similar issues).

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp

Modified: webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp        Sat Mar 13 
11:27:03 2010        (r308)
+++ webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp        Sat Mar 13 
14:10:14 2010        (r309)
@@ -111,7 +111,7 @@
 private:
        TabContainerView* fContainerView;
        TabLayoutItem* fLayoutItem;
-       
+
        BString fLabel;
 
        bool fIsFirst;
@@ -145,6 +145,8 @@
        virtual void MouseMoved(BPoint where, uint32 transit,
                const BMessage* dragMessage);
 
+       virtual void DoLayout();
+
        void AddTab(const char* label, int32 index = -1);
        void AddTab(TabView* tab, int32 index = -1);
        TabView* RemoveTab(int32 index);
@@ -159,10 +161,13 @@
 
 private:
        TabView* _TabAt(const BPoint& where) const;
+       void _MouseMoved(BPoint where, uint32 transit,
+               const BMessage* dragMessage);
 
 private:
        TabView* fLastMouseEventTab;
        bool fMouseDown;
+       uint32 fClickCount;
        TabView* fSelectedTab;
        Controller* fController;
 };
@@ -179,6 +184,7 @@
        BGroupView(B_HORIZONTAL),
        fLastMouseEventTab(NULL),
        fMouseDown(false),
+       fClickCount(0),
        fSelectedTab(NULL),
        fController(controller)
 {
@@ -260,8 +266,12 @@
        SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
        if (fLastMouseEventTab)
                fLastMouseEventTab->MouseDown(where, buttons);
-       else if (clicks > 1)
-               fController->DoubleClickOutsideTabs();
+       else {
+               if (clicks > 1)
+                       fClickCount++;
+               else
+                       fClickCount = 1;
+       }
 }
 
 
@@ -271,6 +281,10 @@
        fMouseDown = false;
        if (fLastMouseEventTab)
                fLastMouseEventTab->MouseUp(where);
+       else if (fClickCount > 1) {
+               fClickCount = 0;
+               fController->DoubleClickOutsideTabs();
+       }
 }
 
 
@@ -278,28 +292,23 @@
 TabContainerView::MouseMoved(BPoint where, uint32 transit,
        const BMessage* dragMessage)
 {
-       TabView* tab = _TabAt(where);
-       if (fMouseDown) {
-               uint32 transit = tab == fLastMouseEventTab
-                       ? B_INSIDE_VIEW : B_OUTSIDE_VIEW;
-               if (fLastMouseEventTab)
-                       fLastMouseEventTab->MouseMoved(where, transit, 
dragMessage);
-               return;
-       }
-
-       if (fLastMouseEventTab && fLastMouseEventTab == tab)
-               fLastMouseEventTab->MouseMoved(where, B_INSIDE_VIEW, 
dragMessage);
-       else {
-               if (fLastMouseEventTab)
-                       fLastMouseEventTab->MouseMoved(where, B_EXITED_VIEW, 
dragMessage);
-               fLastMouseEventTab = tab;
-               if (fLastMouseEventTab)
-                       fLastMouseEventTab->MouseMoved(where, B_ENTERED_VIEW, 
dragMessage);
-       }
+       _MouseMoved(where, transit, dragMessage);
 }
 
 
 void
+TabContainerView::DoLayout()
+{
+       BGroupView::DoLayout();
+
+       BPoint where;
+       uint32 buttons;
+       GetMouse(&where, &buttons, false);
+       if (Bounds().Contains(where))
+               _MouseMoved(where, B_INSIDE_VIEW, NULL);
+}
+
+void
 TabContainerView::AddTab(const char* label, int32 index)
 {
        TabView* tab;
@@ -416,7 +425,7 @@
                GroupLayout()->ItemAt(index));
        if (item)
                tab = item->Parent();
-       
+
        SelectTab(tab);
 }
 
@@ -472,6 +481,31 @@
 }
 
 
+void
+TabContainerView::_MouseMoved(BPoint where, uint32 _transit,
+       const BMessage* dragMessage)
+{
+       TabView* tab = _TabAt(where);
+       if (fMouseDown) {
+               uint32 transit = tab == fLastMouseEventTab
+                       ? B_INSIDE_VIEW : B_OUTSIDE_VIEW;
+               if (fLastMouseEventTab)
+                       fLastMouseEventTab->MouseMoved(where, transit, 
dragMessage);
+               return;
+       }
+
+       if (fLastMouseEventTab && fLastMouseEventTab == tab)
+               fLastMouseEventTab->MouseMoved(where, B_INSIDE_VIEW, 
dragMessage);
+       else {
+               if (fLastMouseEventTab)
+                       fLastMouseEventTab->MouseMoved(where, B_EXITED_VIEW, 
dragMessage);
+               fLastMouseEventTab = tab;
+               if (fLastMouseEventTab)
+                       fLastMouseEventTab->MouseMoved(where, B_ENTERED_VIEW, 
dragMessage);
+       }
+}
+
+
 // #pragma mark - TabView
 
 

Other related posts:

  • » [haiku-webkit-commits] r309 - webkit/trunk/WebKit/haiku/WebPositive - webkit