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

New commits:
commit 41c00d9cf065a6b5ba676807b446f32426e5d642
Author:     Vincent Reher <l...@4reher.org>
AuthorDate: Tue Apr 5 18:31:45 2022 -0700
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Thu Apr 7 08:26:25 2022 +0200

    Resolves: tdf#146174 allow shortcut key event handling before menubar
    
    Change-Id: Ib0dadafcc66604baf53169cb222a059ee3f97362
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132602
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index a7ba7eec9cdb..c874b23a13c5 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -3785,12 +3785,6 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, 
GdkEventKey* pEvent, gpointe
 
     if (GTK_IS_WINDOW(pThis->m_pWindow))
     {
-        // tdf#144846 If this is registered as a menubar mnemonic then ensure
-        // that any other widget won't be considered as a candidate by taking
-        // over the task of launch the menubar menu outself
-        if (pThis->HandleMenubarMnemonic(pEvent->state, pEvent->keyval))
-            return true;
-
         GtkWidget* pFocusWindow = 
gtk_window_get_focus(GTK_WINDOW(pThis->m_pWindow));
         bFocusInAnotherGtkWidget = pFocusWindow && pFocusWindow != 
GTK_WIDGET(pThis->m_pDrawingArea);
         if (bFocusInAnotherGtkWidget)
@@ -3947,6 +3941,20 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, 
GdkEventKey* pEvent, gpointe
                                                   
sal_Unicode(gdk_keyval_to_unicode( pEvent->keyval )),
                                                   (pEvent->type == 
GDK_KEY_PRESS),
                                                   false);
+
+        // tdf#144846 If this is registered as a menubar mnemonic then ensure
+        // that any other widget won't be considered as a candidate by taking
+        // over the task of launch the menubar menu outself
+        // The code was moved here from its original position at beginning
+        // of this function in order to resolve tdf#146174.
+        if (!bStopProcessingKey && // module key handler did not process key
+            pEvent->type == GDK_KEY_PRESS &&  // module key handler handles 
only GDK_KEY_PRESS
+            GTK_IS_WINDOW(pThis->m_pWindow) &&
+            pThis->HandleMenubarMnemonic(pEvent->state, pEvent->keyval))
+        {
+            return true;
+        }
+
         if (!aDel.isDeleted())
         {
             pThis->m_nKeyModifiers = ModKeyFlags::NONE;

Reply via email to