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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 29 18:59:29 UTC 2021


 vcl/unx/gtk3/gtk3gtkframe.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit b96797dd2e6578e8e1a4cea0fa2f3a17bc194a1c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 29 14:17:40 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 29 20:58:48 2021 +0200

    tdf#141963 put focus in vcl parent during Function key processing
    
    Change-Id: Ib63567c9ce208cb7dd522a1bce9d99fa44a72554
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114883
    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 d33704743b84..fa46f1372fe1 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -94,6 +94,12 @@ sal_uInt16 GtkSalFrame::GetMouseModCode( guint state )
     return nCode;
 }
 
+// KEY_F26 is the last function key known to keycodes.hxx
+static bool IsFunctionKeyVal(guint keyval)
+{
+    return keyval >= GDK_KEY_F1 && keyval <= GDK_KEY_F26;
+}
+
 sal_uInt16 GtkSalFrame::GetKeyCode(guint keyval)
 {
     sal_uInt16 nCode = 0;
@@ -105,8 +111,7 @@ sal_uInt16 GtkSalFrame::GetKeyCode(guint keyval)
         nCode = KEY_A + (keyval-GDK_KEY_A );
     else if( keyval >= GDK_KEY_a && keyval <= GDK_KEY_z )
         nCode = KEY_A + (keyval-GDK_KEY_a );
-    else if( keyval >= GDK_KEY_F1 && keyval <= GDK_KEY_F26 )
-    // KEY_F26 is the last function key known to keycodes.hxx
+    else if (IsFunctionKeyVal(keyval))
     {
         switch( keyval )
         {
@@ -3271,8 +3276,9 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
             // InterimItemWindow and send unconsumed keystrokes to it to
             // support ctrl-q etc shortcuts. Only bother to search for the
             // InterimItemWindow if it is a toplevel that fills its frame, or
-            // the keystroke is F6 to switch between task-panels
-            if (pThis->IsCycleFocusOutDisallowed() || pEvent->keyval == GDK_KEY_F6)
+            // the keystroke is sufficiently special its worth passing on,
+            // e.g. F6 to switch between task-panels or F5 to close a navigator
+            if (pThis->IsCycleFocusOutDisallowed() || IsFunctionKeyVal(pEvent->keyval))
             {
                 GtkWidget* pSearch = pFocusWindow;
                 while (pSearch)


More information about the Libreoffice-commits mailing list