[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 24 10:12:47 UTC 2020


 vcl/unx/gtk3/gtk3gtkframe.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 6a4dfa7469168207a9c11463d1b1c9cef5f86c3f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Aug 23 20:12:28 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Aug 24 12:12:15 2020 +0200

    tdf#135779 move focus back to usual parent before grabbing pointer
    
    Change-Id: Ia4f1f2f1672a76515ab586d679a05467515868d6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101153
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index c5e475fb1555..5d773bbeeb8a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1990,6 +1990,13 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle )
 
 void GtkSalFrame::grabPointer( bool bGrab, bool bKeyboardAlso, bool bOwnerEvents )
 {
+    if (bGrab)
+    {
+        // tdf#135779 move focus back inside usual input window out of any
+        // other gtk widgets before grabbing the pointer
+        GrabFocus();
+    }
+
     static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" );
     if (pEnv && *pEnv)
         return;
@@ -2526,8 +2533,10 @@ void GtkSalFrame::GrabFocus()
         pGrabWidget = GTK_WIDGET(m_pWindow);
     else
         pGrabWidget = GTK_WIDGET(m_pFixedContainer);
-    gtk_widget_set_can_focus(pGrabWidget, true);
-    gtk_widget_grab_focus(pGrabWidget);
+    if (!gtk_widget_get_can_focus(pGrabWidget))
+        gtk_widget_set_can_focus(pGrabWidget, true);
+    if (!gtk_widget_has_focus(pGrabWidget))
+        gtk_widget_grab_focus(pGrabWidget);
 }
 
 gboolean GtkSalFrame::signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer frame)


More information about the Libreoffice-commits mailing list