From aa66e9bcd5f10719428d77014fda3c6df2093f26 Mon Sep 17 00:00:00 2001 From: gambas Date: Sat, 23 Feb 2019 00:15:35 +0100 Subject: [PATCH] Windows without any active child control correctly catch keyboard events now. [GB.GTK] * BUG: Windows without any active child control correctly catch keyboard events now. [GB.GTK3] * BUG: Windows without any active child control correctly catch keyboard events now. --- gb.gtk/src/gapplication.cpp | 6 ++++++ gb.gtk/src/gkey.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index fa75aff3c..4909ded95 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -219,6 +219,7 @@ static void gambas_handle_event(GdkEvent *event) bool cancel; int type; bool handle_event = false; + bool send_to_window = false; if (gApplication::_fix_printer_dialog) { @@ -806,12 +807,14 @@ __FOUND_WIDGET: if (event->key.keyval) gKey::_last_key_press = event->key.keyval; + send_to_window = control->isWindow(); goto __HANDLE_EVENT; case GDK_KEY_RELEASE: if (event->key.keyval) gKey::_last_key_release = event->key.keyval; + send_to_window = control->isWindow(); goto __HANDLE_EVENT; } @@ -833,6 +836,9 @@ __RETURN: if (handle_event) gtk_main_do_event(event); + + if (send_to_window) + gcb_key_event(widget, event, control); if (!gdk_events_pending()) // && event->type != GDK_ENTER_NOTIFY && event->type != GDK_LEAVE_NOTIFY) { diff --git a/gb.gtk/src/gkey.cpp b/gb.gtk/src/gkey.cpp index 1eb360827..16e354ab5 100644 --- a/gb.gtk/src/gkey.cpp +++ b/gb.gtk/src/gkey.cpp @@ -483,7 +483,7 @@ gboolean gcb_key_event(GtkWidget *widget, GdkEvent *event, gControl *control) bool cancel; #if DEBUG_IM - fprintf(stderr, "gcb_key_event %s for %p %s\n", event->type == GDK_KEY_PRESS ? "GDK_KEY_PRESS" : "GDK_KEY_RELEASE", control, control->name()); + fprintf(stderr, "gcb_key_event %s for %p %s / active = %p\n", event->type == GDK_KEY_PRESS ? "GDK_KEY_PRESS" : "GDK_KEY_RELEASE", control, control->name(), gApplication::activeControl()); #endif /*if (!control->_grab && gApplication::activeControl())