vcl/unx/gtk3/gtkframe.cxx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
New commits: commit 96d078596c4621319b355b131b90fe1291e0445f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Oct 1 10:43:52 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Oct 1 21:32:32 2021 +0200 bundle key forward calls together as a function Change-Id: I9f3fe4ea0ac3bd0313d76a04eb3c44ce2192aede Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122925 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 7375ca4e9d7c..a62bdd67162b 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -3835,6 +3835,18 @@ gboolean GtkSalFrame::signalUnmap(GtkWidget*, GdkEvent*, gpointer frame) #endif #if !GTK_CHECK_VERSION(4, 0, 0) + +static bool key_forward(GdkEventKey* pEvent, GtkWindow* pDest) +{ + gpointer pClass = g_type_class_ref(GTK_TYPE_WINDOW); + GtkWidgetClass* pWindowClass = GTK_WIDGET_CLASS(pClass); + bool bHandled = pEvent->type == GDK_KEY_PRESS + ? pWindowClass->key_press_event(GTK_WIDGET(pDest), pEvent) + : pWindowClass->key_release_event(GTK_WIDGET(pDest), pEvent); + g_type_class_unref(pClass); + return bHandled; +} + gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer frame) { UpdateLastInputEventTime(pEvent->time); @@ -3853,15 +3865,10 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe { if (!gtk_widget_get_realized(pFocusWindow)) return true; - gpointer pClass = g_type_class_ref(GTK_TYPE_WINDOW); - GtkWidgetClass* pWindowClass = GTK_WIDGET_CLASS(pClass); + // if the focus is not in our main widget, see if there is a handler // for this key stroke in GtkWindow first - bool bHandled = pEvent->type == GDK_KEY_PRESS - ? pWindowClass->key_press_event(pThis->m_pWindow, pEvent) - : pWindowClass->key_release_event(pThis->m_pWindow, pEvent); - g_type_class_unref(pClass); - if (bHandled) + if (key_forward(pEvent, GTK_WINDOW(pThis->m_pWindow))) return true; // Is focus inside an InterimItemWindow? In which case find that