mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
Add gtk_widget_prepend_controller
Add a variant of gtk_widget_add_controller that inserts the controller at the beginning, instead of the end. This will be used in entry completion to make sure the entry completion key event handling supersedes the entry one while the popup is open. Keep this private for now, until we determine if it needs to be public api.
This commit is contained in:
parent
9faaa5e8be
commit
692cc42e10
@ -11415,6 +11415,23 @@ gtk_widget_add_controller (GtkWidget *widget,
|
||||
gtk_list_list_model_item_added_at (priv->controller_observer, priv->controllers->len - 1);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_prepend_controller (GtkWidget *widget,
|
||||
GtkEventController *controller)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
|
||||
GTK_EVENT_CONTROLLER_GET_CLASS (controller)->set_widget (controller, widget);
|
||||
|
||||
if (G_UNLIKELY (!priv->controllers))
|
||||
priv->controllers = g_ptr_array_new ();
|
||||
|
||||
g_ptr_array_insert (priv->controllers, 0, controller);
|
||||
|
||||
if (priv->controller_observer)
|
||||
gtk_list_list_model_item_added_at (priv->controller_observer, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_remove_controller:
|
||||
* @widget: a #GtkWidget
|
||||
|
@ -346,6 +346,9 @@ gboolean gtk_widget_run_controllers (GtkWidget
|
||||
double x,
|
||||
double y,
|
||||
GtkPropagationPhase phase);
|
||||
|
||||
void gtk_widget_prepend_controller (GtkWidget *widget,
|
||||
GtkEventController *controller);
|
||||
void gtk_widget_handle_crossing (GtkWidget *widget,
|
||||
const GtkCrossingData *crossing,
|
||||
double x,
|
||||
|
Loading…
Reference in New Issue
Block a user