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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 5 19:44:19 UTC 2020


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

New commits:
commit 6769c358b7975d118a6762780a17278ce0ac6b8d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Apr 5 19:58:30 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Apr 5 21:43:38 2020 +0200

    Related: tdf#131873 focus-on-click in data browser
    
    Change-Id: I99cf1f42c89ee6d9e17ac1a24ae8e58e6e47a55d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91727
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index d4c04ff0a88f..9b221311a8b3 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2489,8 +2489,13 @@ namespace
 
 void GtkSalFrame::GrabFocus()
 {
-    gtk_widget_set_can_focus(GTK_WIDGET(m_pFixedContainer), true);
-    gtk_widget_grab_focus(GTK_WIDGET(m_pFixedContainer));
+    GtkWidget* pGrabWidget;
+    if (GTK_IS_EVENT_BOX(m_pWindow))
+        pGrabWidget = GTK_WIDGET(m_pWindow);
+    else
+        pGrabWidget = GTK_WIDGET(m_pFixedContainer);
+    gtk_widget_set_can_focus(pGrabWidget, true);
+    gtk_widget_grab_focus(pGrabWidget);
 }
 
 gboolean GtkSalFrame::signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer frame)
@@ -3056,7 +3061,12 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
     // in the meantime do not propagate focus get/lose if floats are open
     if( m_nFloats == 0 )
     {
-        bool bHasFocus = gtk_widget_has_focus(GTK_WIDGET(pThis->m_pFixedContainer));
+        GtkWidget* pGrabWidget;
+        if (GTK_IS_EVENT_BOX(pThis->m_pWindow))
+            pGrabWidget = GTK_WIDGET(pThis->m_pWindow);
+        else
+            pGrabWidget = GTK_WIDGET(pThis->m_pFixedContainer);
+        bool bHasFocus = gtk_widget_has_focus(pGrabWidget);
         pThis->CallCallbackExc(bHasFocus ? SalEvent::GetFocus : SalEvent::LoseFocus, nullptr);
     }
 


More information about the Libreoffice-commits mailing list