[gtk/wip/matthiasc/focus2: 86/91] key controller: Enforce limitations of key forwarding



commit a93f9394684ef8cc43a1b2a992ad97d1ea2d07c2
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 8 10:21:02 2019 -0500

    key controller: Enforce limitations of key forwarding
    
    We now set current_event for focus-change as well,
    so make sure to check the event type.

 gtk/gtkeventcontrollerkey.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gtk/gtkeventcontrollerkey.c b/gtk/gtkeventcontrollerkey.c
index 2909095979..f7f3fe1017 100644
--- a/gtk/gtkeventcontrollerkey.c
+++ b/gtk/gtkeventcontrollerkey.c
@@ -486,6 +486,8 @@ gtk_event_controller_key_forward (GtkEventControllerKey *controller,
   g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_KEY (controller), FALSE);
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
   g_return_val_if_fail (controller->current_event != NULL, FALSE);
+  g_return_val_if_fail (gdk_event_get_event_type (controller->current_event) == GDK_KEY_PRESS ||
+                        gdk_event_get_event_type (controller->current_event) == GDK_KEY_RELEASE, FALSE);
 
   if (!gtk_widget_get_realized (widget))
     gtk_widget_realize (widget);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]