diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 015184bf83..8793c6bb4f 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -16889,3 +16889,25 @@ _gtk_widget_remove_controller (GtkWidget *widget, g_object_unref (data->controller); data->controller = NULL; } + +GList * +_gtk_widget_list_controllers (GtkWidget *widget, + GtkPropagationPhase phase) +{ + EventControllerData *data; + GtkWidgetPrivate *priv; + GList *l, *retval = NULL; + + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + + priv = widget->priv; + + for (l = priv->event_controllers; l; l = l->next) + { + data = l->data; + if (data->phase == phase && data->controller != NULL) + retval = g_list_prepend (retval, data->controller); + } + + return retval; +} diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index 3708146282..8ae53752a0 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -157,6 +157,8 @@ void _gtk_widget_add_controller (GtkWidget GtkPropagationPhase phase); void _gtk_widget_remove_controller (GtkWidget *widget, GtkEventController *controller); +GList * _gtk_widget_list_controllers (GtkWidget *widget, + GtkPropagationPhase phase); G_END_DECLS