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

Caolán McNamara caolanm at redhat.com
Thu Jun 9 16:20:02 UTC 2016


 include/vcl/window.hxx                   |    2 +-
 vcl/source/window/floatwin.cxx           |    2 --
 vcl/source/window/menubarwindow.cxx      |    7 +++----
 vcl/source/window/menufloatingwindow.cxx |    7 ++++++-
 vcl/source/window/window2.cxx            |   16 +++-------------
 vcl/unx/gtk3/gtk3gtkframe.cxx            |   25 ++++++++++---------------
 6 files changed, 23 insertions(+), 36 deletions(-)

New commits:
commit f89b9d8b8064a2f323f5b3362f88cb873bad8fcc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 9 17:02:14 2016 +0100

    Resolves: tdf#100248 vcl menu scroll timer still active post dispose
    
    Change-Id: I8988a42e7e505c967661c4a5f3c1e4ef3fbc08e0

diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 02b9d2f..93ad987 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -98,6 +98,12 @@ void MenuFloatingWindow::doShutdown()
         }
         pMenu = nullptr;
         RemoveEventListener( LINK( this, MenuFloatingWindow, ShowHideListener ) );
+
+        aScrollTimer.Stop();
+        aSubmenuCloseTimer.Stop();
+        aSubmenuCloseTimer.Stop();
+        aHighlightChangedTimer.Stop();
+        aHighlightChangedTimer.Stop();
     }
 }
 
commit 9b7dfb10641ba7978ffcbd1db0507163411ae027
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 9 16:52:21 2016 +0100

    EndSaveFocus does nothing on the !bRestore case
    
    Change-Id: I8e199535803faf364469f9b9df46f339febe25c6

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 3224d33..86ff2b7 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1133,7 +1133,7 @@ public:
     bool                                IsCompoundControl() const;
 
     static VclPtr<vcl::Window>          SaveFocus();
-    static void                         EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore = true );
+    static void                         EndSaveFocus(const VclPtr<vcl::Window>& xFocusWin);
 
     void                                CaptureMouse();
     void                                ReleaseMouse();
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 82283c9..20b1579 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -803,8 +803,6 @@ void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPt
     else
     {
         mbPopupModeTearOff = true;
-        if ( xFocusId != nullptr )
-            Window::EndSaveFocus( xFocusId, false );
     }
 
     mbPopupModeCanceled = bool(nFlags & FloatWinPopupEndFlags::Cancel);
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 7b6c3d0..28a554f 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -466,8 +466,6 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b
             {
                 if( !ImplGetSVData()->maWinData.mbNoSaveFocus )
                 {
-                    // we didn't clean up last time
-                    Window::EndSaveFocus( xSaveFocusId, false );    // clean up
                     xSaveFocusId = nullptr;
                     if( !bNoSaveFocus )
                         xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated
@@ -499,9 +497,10 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b
         {
             VclPtr<vcl::Window> xTempFocusId = xSaveFocusId;
             xSaveFocusId = nullptr;
-            Window::EndSaveFocus( xTempFocusId, bAllowRestoreFocus );
+            if (bAllowRestoreFocus)
+                Window::EndSaveFocus(xTempFocusId);
             // #105406# restore focus to document if we could not save focus before
-            if( bDefaultToDocument && xTempFocusId == nullptr && bAllowRestoreFocus )
+            if (bDefaultToDocument && xTempFocusId == nullptr && bAllowRestoreFocus)
                 GrabFocusToDocument();
         }
     }
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 16f7cc9..02b9d2f 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -401,7 +401,6 @@ void MenuFloatingWindow::StopExecute( VclPtr<vcl::Window> xFocusId )
     // (could have been restored in Select)
     if ( xSaveFocusId != nullptr )
     {
-        Window::EndSaveFocus( xFocusId, false );
         xFocusId = xSaveFocusId;
         if ( xFocusId != nullptr )
         {
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 2878e0a..17b48cb 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -421,17 +421,11 @@ VclPtr<vcl::Window> Window::SaveFocus()
         return nullptr;
 }
 
-void Window::EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore )
+void Window::EndSaveFocus(const VclPtr<vcl::Window>& xFocusWin)
 {
-    if ( xFocusWin == nullptr )
-        return;
-    else
+    if (xFocusWin && !xFocusWin->IsDisposed())
     {
-        if ( !xFocusWin->IsDisposed() )
-        {
-            if ( bRestore )
-                xFocusWin->GrabFocus();
-        }
+        xFocusWin->GrabFocus();
     }
 }
 
commit 98da362f1691734437cb37f902fb1cdab613ac0a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 9 16:47:40 2016 +0100

    EndSaveFocus return value is unused
    
    Change-Id: I746e47b118a8b8c687c435371e2bdf2dc22cbf88

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 3a3e980..3224d33 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1133,7 +1133,7 @@ public:
     bool                                IsCompoundControl() const;
 
     static VclPtr<vcl::Window>          SaveFocus();
-    static bool                         EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore = true );
+    static void                         EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore = true );
 
     void                                CaptureMouse();
     void                                ReleaseMouse();
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index fa9fc15..2878e0a 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -421,21 +421,17 @@ VclPtr<vcl::Window> Window::SaveFocus()
         return nullptr;
 }
 
-bool Window::EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore )
+void Window::EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore )
 {
     if ( xFocusWin == nullptr )
-        return false;
+        return;
     else
     {
-        bool                bOK = true;
         if ( !xFocusWin->IsDisposed() )
         {
             if ( bRestore )
                 xFocusWin->GrabFocus();
         }
-        else
-            bOK = !bRestore;
-        return bOK;
     }
 }
 
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 5a12fa6..c76e2cd 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1440,15 +1440,11 @@ void GtkSalFrame::Show( bool bVisible, bool bNoActivate )
                 m_nFloats++;
                 if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 1 )
                 {
-                    GtkWidget* pGrabWidgetBeforeShowFloat;
-                    while ((pGrabWidgetBeforeShowFloat = gtk_grab_get_current()))
-                    {
-                        m_aGrabWidgetsBeforeShowFloat.push_back(pGrabWidgetBeforeShowFloat);
-                        gtk_grab_remove(pGrabWidgetBeforeShowFloat);
-                    }
-                    grabPointer(true, true);
-                    GtkSalFrame *pKeyboardFrame = m_pParent ? m_pParent : this;
-                    pKeyboardFrame->grabKeyboard(true);
+                    GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(getGdkDisplay());
+                    GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager);
+                    GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer);
+                    gtk_device_grab_add(m_pParent->getWindow(), pPointer, false);
+                    gtk_device_grab_add(m_pParent->getWindow(), pKeyboard, false);
                 }
                 // #i44068# reset parent's IM context
                 if( m_pParent )
@@ -1464,12 +1460,11 @@ void GtkSalFrame::Show( bool bVisible, bool bNoActivate )
                 m_nFloats--;
                 if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 0)
                 {
-                    GtkSalFrame *pKeyboardFrame = m_pParent ? m_pParent : this;
-                    pKeyboardFrame->grabKeyboard(false);
-                    grabPointer(false);
-                    for (auto i = m_aGrabWidgetsBeforeShowFloat.rbegin(); i != m_aGrabWidgetsBeforeShowFloat.rend(); ++i)
-                        gtk_grab_add(*i);
-                    m_aGrabWidgetsBeforeShowFloat.clear();
+                    GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(getGdkDisplay());
+                    GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager);
+                    GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer);
+                    gtk_device_grab_remove(m_pParent->getWindow(), pKeyboard);
+                    gtk_device_grab_remove(m_pParent->getWindow(), pPointer);
                 }
             }
             gtk_widget_hide( m_pWindow );


More information about the Libreoffice-commits mailing list