diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2018-03-11 13:38:19 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-04-05 19:26:54 +0200 |
commit | 695549d5a7dfdf3b128417ef6dee4fb458f7fbb3 (patch) | |
tree | c40b12b52d2b190843495614de029bf19d457e51 /gtk/gtkeventcontrollerkey.c | |
parent | b55696e551c7dd4a0da38ae9ba893e49318e042b (diff) | |
download | gtk+-695549d5a7dfdf3b128417ef6dee4fb458f7fbb3.tar.gz |
eventcontrollerkey: Add function to forward stuff elsewhere
Diffstat (limited to 'gtk/gtkeventcontrollerkey.c')
-rw-r--r-- | gtk/gtkeventcontrollerkey.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gtk/gtkeventcontrollerkey.c b/gtk/gtkeventcontrollerkey.c index 922b147624..1b67966ec9 100644 --- a/gtk/gtkeventcontrollerkey.c +++ b/gtk/gtkeventcontrollerkey.c @@ -21,7 +21,7 @@ #include "gtkintl.h" #include "gtkprivate.h" -#include "gtkwidget.h" +#include "gtkwidgetprivate.h" #include "gtkeventcontrollerprivate.h" #include "gtkeventcontrollerkey.h" #include "gtkbindings.h" @@ -216,3 +216,22 @@ gtk_event_controller_key_get_im_context (GtkEventControllerKey *controller) return controller->im_context; } + +gboolean +gtk_event_controller_key_forward (GtkEventControllerKey *controller, + GtkWidget *widget) +{ + 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); + + if (!gtk_widget_get_realized (widget)) + gtk_widget_realize (widget); + + if (_gtk_widget_captured_event (widget, controller->current_event)) + return TRUE; + if (gtk_widget_event (widget, controller->current_event)) + return TRUE; + + return FALSE; +} |