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

New commits:
commit 1dd4bfc1fc4b9ba178fb8ee3b24b85aa3ef0c115
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Apr 29 14:17:40 2021 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Thu May 6 02:49:13 2021 +0200

    tdf#141963 put focus in vcl parent during Function key processing
    
    Change-Id: Ib63567c9ce208cb7dd522a1bce9d99fa44a72554
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114884
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index f0c9d9fd3155..8637acd77684 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 )
         {
@@ -3259,10 +3264,13 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, 
GdkEventKey* pEvent, gpointe
             if (bHandled)
                 return true;
 
-            // Is focus inside a full-app InterimItemWindow? In which case find
-            // that InterimItemWindow and send unconsumed keystrokes to it to
-            // support ctrl-q etc shortcuts
-            if (pThis->IsCycleFocusOutDisallowed())
+            // Is focus inside an InterimItemWindow? In which case find that
+            // 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 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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to