[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Mon Apr 27 04:50:54 PDT 2015


 vcl/source/window/winproc.cxx                 |   62 +++----------
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |  119 ++++++++++++++++++++------
 2 files changed, 108 insertions(+), 73 deletions(-)

New commits:
commit fc1605e4dc88b6c563dc0712954f58d8bb6979a7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 27 12:48:07 2015 +0100

    don't dismiss floating windows on wheel, etc gestures outside area
    
    so if you are not exactly over the active floating listbox menu
    and use the scroll mouse then it still gets the scroll event
    instead of popping down and delivering it to the underlying
    window.
    
    Change-Id: I6ab0b725af2a8adc712bfe4ec586dcd64a2efdd7

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 6cb1c90..139d771 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1376,17 +1376,6 @@ protected:
 
 public:
 
-    struct WindowDescription
-    {
-        vcl::Window *m_pMouseWindow;
-        bool m_bIsFloat;
-        WindowDescription(vcl::Window *pMouseWindow, bool bIsFloat)
-            : m_pMouseWindow(pMouseWindow)
-            , m_bIsFloat(bIsFloat)
-        {
-        }
-    };
-
     HandleGestureEventBase(vcl::Window *pWindow, const Point &rMousePos)
         : m_pSVData(ImplGetSVData())
         , m_pWindow(pWindow)
@@ -1394,10 +1383,9 @@ public:
     {
     }
     bool Setup();
-    WindowDescription FindTarget();
-    vcl::Window *Dispatch(const WindowDescription& rTarget);
+    vcl::Window* FindTarget();
+    vcl::Window* Dispatch(vcl::Window* pTarget);
     virtual bool CallCommand(vcl::Window *pWindow, const Point &rMousePos) = 0;
-    void Teardown(const WindowDescription& rTarget);
     virtual ~HandleGestureEventBase() {}
 };
 
@@ -1414,10 +1402,9 @@ bool HandleGestureEventBase::Setup()
     return true;
 }
 
-HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
+vcl::Window* HandleGestureEventBase::FindTarget()
 {
     // first check any floating window ( eg. drop down listboxes)
-    bool bIsFloat = false;
     vcl::Window *pMouseWindow = NULL;
 
     if (m_pSVData->maWinData.mpFirstFloat && !m_pSVData->maWinData.mpCaptureWin &&
@@ -1425,10 +1412,14 @@ HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
     {
         HitTest nHitTest = HITTEST_OUTSIDE;
         pMouseWindow = m_pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( m_pWindow, m_aMousePos, nHitTest );
+        if (!pMouseWindow)
+            pMouseWindow = m_pSVData->maWinData.mpFirstFloat;
     }
     // then try the window directly beneath the mouse
     if( !pMouseWindow )
+    {
         pMouseWindow = m_pWindow->ImplFindWindow( m_aMousePos );
+    }
     else
     {
         // transform coordinates to float window frame coordinates
@@ -1437,7 +1428,6 @@ HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
                   pMouseWindow->AbsoluteScreenToOutputPixel(
                    m_pWindow->OutputToAbsoluteScreenPixel(
                     m_pWindow->ScreenToOutputPixel( m_aMousePos ) ) ) ) );
-        bIsFloat = true;
     }
 
     while (acceptableWheelScrollTarget(pMouseWindow))
@@ -1448,13 +1438,11 @@ HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
         pMouseWindow = pMouseWindow->GetParent();
     }
 
-    return WindowDescription(pMouseWindow, bIsFloat);
+    return pMouseWindow;
 }
 
-vcl::Window *HandleGestureEventBase::Dispatch(const WindowDescription& rTarget)
+vcl::Window *HandleGestureEventBase::Dispatch(vcl::Window* pMouseWindow)
 {
-    vcl::Window *pMouseWindow = rTarget.m_pMouseWindow;
-
     vcl::Window *pDispatchedTo = NULL;
 
     if (acceptableWheelScrollTarget(pMouseWindow) && pMouseWindow->IsEnabled())
@@ -1493,23 +1481,6 @@ vcl::Window *HandleGestureEventBase::Dispatch(const WindowDescription& rTarget)
     return pDispatchedTo;
 }
 
-void HandleGestureEventBase::Teardown(const WindowDescription& rTarget)
-{
-    // close floaters
-    if (!rTarget.m_bIsFloat && m_pSVData->maWinData.mpFirstFloat)
-    {
-        FloatingWindow* pLastLevelFloat = m_pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
-        if( pLastLevelFloat )
-        {
-            sal_uLong nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
-            if ( nPopupFlags & FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE )
-            {
-                pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
-            }
-        }
-    }
-}
-
 class HandleWheelEvent : public HandleGestureEventBase
 {
 private:
@@ -1554,21 +1525,19 @@ bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt)
     if (!Setup())
         return false;
 
-    WindowDescription aTarget = FindTarget();
+    vcl::Window *pMouseWindow = FindTarget();
 
     // avoid the problem that scrolling via wheel to this point brings a widget
     // under the mouse that also accepts wheel commands, so stick with the old
     // widget if the time gap is very small
     if (shouldReusePreviousMouseWindow(aPreviousEvent, rEvt) && acceptableWheelScrollTarget(pPreviousWindow))
     {
-        aTarget.m_pMouseWindow = pPreviousWindow;
+        pMouseWindow = pPreviousWindow;
     }
 
     aPreviousEvent = rEvt;
 
-    pPreviousWindow = Dispatch(aTarget);
-
-    Teardown(aTarget);
+    pPreviousWindow = Dispatch(pMouseWindow);
 
     return pPreviousWindow != NULL;
 }
@@ -1588,12 +1557,9 @@ bool HandleGestureEvent::HandleEvent()
     if (!Setup())
         return false;
 
-    WindowDescription aTarget = FindTarget();
-
-    bool bHandled = Dispatch(aTarget) != NULL;
-
-    Teardown(aTarget);
+    vcl::Window *pTarget = FindTarget();
 
+    bool bHandled = Dispatch(pTarget) != NULL;
     return bHandled;
 }
 
commit 12288cec079d004ce491043aca6ba57bf13f73af
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 27 11:18:39 2015 +0100

    I can't read this horror, expand
    
    Change-Id: Ibb99040b612df2aad638e574667555d0302b46c4

diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 9d82368..abab9e1 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -1437,32 +1437,101 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
 
 bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
 {
-    if(
-       (nType == CTRL_EDITBOX) ||
-       (nType == CTRL_PUSHBUTTON && nPart == PART_ENTIRE_CONTROL) ||
-       (nType == CTRL_CHECKBOX && nPart == PART_ENTIRE_CONTROL) ||
-       (nType == CTRL_RADIOBUTTON && nPart == PART_ENTIRE_CONTROL) ||
-       (nType == CTRL_TOOLBAR &&
-        (nPart == PART_BUTTON || nPart == PART_ENTIRE_CONTROL)) ||
-        ((nType == CTRL_SPINBOX) &&
-         ((nPart == PART_ENTIRE_CONTROL) || (nPart == PART_ALL_BUTTONS) ||
-          (nPart == HAS_BACKGROUND_TEXTURE))) ||
-        ((nType == CTRL_COMBOBOX) &&
-         ((nPart == PART_ENTIRE_CONTROL) || (nPart == PART_ALL_BUTTONS) ||
-          (nPart == HAS_BACKGROUND_TEXTURE))) ||
-        ((nType==CTRL_LISTBOX) &&
-         ((nPart==PART_ENTIRE_CONTROL) || (nPart == PART_WINDOW) || (nPart == PART_BUTTON_DOWN) ||
-          (nPart==HAS_BACKGROUND_TEXTURE))) ||
-       ((nType == CTRL_SCROLLBAR) &&
-        ( (nPart == PART_DRAW_BACKGROUND_HORZ) || (nPart == PART_DRAW_BACKGROUND_VERT) ||
-          (nPart == PART_ENTIRE_CONTROL) || (nPart == HAS_THREE_BUTTONS))) ||
-       (nType == CTRL_MENU_POPUP &&
-        ( (nPart == PART_ENTIRE_CONTROL) || (nPart == PART_MENU_ITEM) ||
-          (nPart == PART_MENU_ITEM_CHECK_MARK) || (nPart == PART_MENU_ITEM_RADIO_MARK) ||
-          (nPart == PART_MENU_SEPARATOR) || (nPart == PART_MENU_SUBMENU_ARROW) ))
-      )
+    switch(nType)
     {
-      return true;
+        case CTRL_PUSHBUTTON:
+        case CTRL_RADIOBUTTON:
+        case CTRL_CHECKBOX:
+//        case CTRL_TOOLTIP:
+//        case CTRL_PROGRESS:
+//        case CTRL_LISTNODE:
+//        case CTRL_LISTNET:
+            if(nPart==PART_ENTIRE_CONTROL)
+                return true;
+            break;
+
+        case CTRL_SCROLLBAR:
+            if(nPart==PART_DRAW_BACKGROUND_HORZ || nPart==PART_DRAW_BACKGROUND_VERT ||
+               nPart==PART_ENTIRE_CONTROL       || nPart==HAS_THREE_BUTTONS)
+                return true;
+            break;
+
+        case CTRL_EDITBOX:
+//        case CTRL_MULTILINE_EDITBOX:
+        case CTRL_COMBOBOX:
+            if(nPart==PART_ENTIRE_CONTROL || nPart==HAS_BACKGROUND_TEXTURE || nPart == PART_ALL_BUTTONS)
+                return true;
+            break;
+
+        case CTRL_SPINBOX:
+            if(nPart==PART_ENTIRE_CONTROL || nPart==PART_ALL_BUTTONS || nPart==HAS_BACKGROUND_TEXTURE)
+                return true;
+            break;
+
+//        case CTRL_SPINBUTTONS:
+//            if(nPart==PART_ENTIRE_CONTROL || nPart==PART_ALL_BUTTONS)
+//                return true;
+//            break;
+
+//        case CTRL_FRAME:
+//        case CTRL_WINDOW_BACKGROUND:
+//            return true;
+
+//        case CTRL_TAB_ITEM:
+//        case CTRL_TAB_PANE:
+//        case CTRL_TAB_BODY:
+//            if(nPart==PART_ENTIRE_CONTROL || nPart==PART_TABS_DRAW_RTL)
+//                return true;
+//            break;
+
+        case CTRL_LISTBOX:
+            if(nPart==PART_ENTIRE_CONTROL || nPart==PART_WINDOW || nPart==HAS_BACKGROUND_TEXTURE || nPart == PART_BUTTON_DOWN)
+                return true;
+            break;
+
+        case CTRL_TOOLBAR:
+            if( nPart==PART_ENTIRE_CONTROL
+//                ||  nPart==PART_DRAW_BACKGROUND_HORZ
+//                ||  nPart==PART_DRAW_BACKGROUND_VERT
+//                ||  nPart==PART_THUMB_HORZ
+//                ||  nPart==PART_THUMB_VERT
+                ||  nPart==PART_BUTTON
+//                ||  nPart==PART_SEPARATOR_HORZ
+//                ||  nPart==PART_SEPARATOR_VERT
+                )
+                return true;
+            break;
+
+//        case CTRL_MENUBAR:
+//            if(nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM)
+//                return true;
+//            break;
+
+        case CTRL_MENU_POPUP:
+            if (nPart==PART_ENTIRE_CONTROL
+                ||  nPart==PART_MENU_ITEM
+                ||  nPart==PART_MENU_ITEM_CHECK_MARK
+                ||  nPart==PART_MENU_ITEM_RADIO_MARK
+                ||  nPart==PART_MENU_SEPARATOR
+                ||  nPart==PART_MENU_SUBMENU_ARROW
+            )
+                return true;
+            break;
+
+//        case CTRL_SLIDER:
+//            if(nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA)
+//                return true;
+//            break;
+
+//        case CTRL_FIXEDLINE:
+//            if(nPart == PART_SEPARATOR_VERT || nPart == PART_SEPARATOR_HORZ)
+//                return true;
+//            break;
+
+//        case CTRL_LISTHEADER:
+//            if(nPart == PART_BUTTON || nPart == PART_ARROW)
+//                return true;
+//            break;
     }
 
     printf( "Unhandled is native supported for Type: %d, Part %d\n",


More information about the Libreoffice-commits mailing list