gtkwidget: Activate key bindings through run_controllers()

Deferring a bit further making those a standalone controller, make
binding activation happen on run_controllers(), so it happens by
default on widgets (unless the key event was consumed earlier)
without the need of a legacy event controller.
This commit is contained in:
Carlos Garnacho 2018-03-11 13:44:37 +01:00
parent d74ecfb02e
commit 6892b5c5ba

View File

@ -5138,14 +5138,14 @@ static gboolean
gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
return gtk_bindings_activate_event (G_OBJECT (widget), event);
return FALSE;
}
static gboolean
gtk_widget_real_key_release_event (GtkWidget *widget,
GdkEventKey *event)
{
return gtk_bindings_activate_event (G_OBJECT (widget), event);
return FALSE;
}
#define WIDGET_REALIZED_FOR_EVENT(widget, event) \
@ -5424,6 +5424,11 @@ gtk_widget_event_internal (GtkWidget *widget,
return_val |= _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_BUBBLE);
g_object_unref (event_copy);
if (return_val == FALSE &&
(event->any.type == GDK_KEY_PRESS ||
event->any.type == GDK_KEY_RELEASE))
return_val |= gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *) event);
return return_val;
}