[gtk/new-style-menu: 1/4] main: Warn if GDK sends us bad focus events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/new-style-menu: 1/4] main: Warn if GDK sends us bad focus events
- Date: Sun, 9 Jun 2019 15:27:50 +0000 (UTC)
commit d3a92c17036dccfe93f60a358be4add4c61d1522
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 9 14:09:20 2019 +0000
main: Warn if GDK sends us bad focus events
The new rule for focus events from the windowing
system is: We only want them for toplevels. If you
put focus on popups, we don't want to know about
it, and you still need to deliver key events to
the toplevel.
gtk/gtkmain.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index c57c09e70e..9dad285337 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1658,6 +1658,20 @@ is_key_event (GdkEvent *event)
}
}
+static gboolean
+is_focus_event (GdkEvent *event)
+{
+ switch ((guint) event->any.type)
+ {
+ case GDK_FOCUS_CHANGE:
+ return TRUE;
+ break;
+ default:
+ return FALSE;
+ }
+}
+
+
static inline void
set_widget_active_state (GtkWidget *target,
const gboolean release)
@@ -1887,6 +1901,14 @@ gtk_main_do_event (GdkEvent *event)
target_widget = handle_key_event (event);
}
+ else if (is_focus_event (event))
+ {
+ if (!GTK_IS_WINDOW (target_widget))
+ {
+ g_warning ("Ignoring an unexpected focus event from GDK on a non-toplevel surface.");
+ goto cleanup;
+ }
+ }
if (!target_widget)
goto cleanup;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]