forked from AuroraMiddleware/gtk
Merge branch 'fix-entry-completion' into 'master'
Fix entry completion See merge request GNOME/gtk!2135
This commit is contained in:
commit
1791c637d0
@ -2335,10 +2335,12 @@ connect_completion_signals (GtkEntryCompletion *completion)
|
||||
GtkText *text = gtk_entry_get_text_widget (GTK_ENTRY (priv->entry));
|
||||
|
||||
controller = priv->entry_key_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_name (controller, "gtk-entry-completion");
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_entry_completion_key_pressed), completion);
|
||||
gtk_widget_add_controller (GTK_WIDGET (text), controller);
|
||||
gtk_widget_prepend_controller (GTK_WIDGET (text), controller);
|
||||
controller = priv->entry_focus_controller = gtk_event_controller_focus_new ();
|
||||
gtk_event_controller_set_name (controller, "gtk-entry-completion");
|
||||
g_signal_connect_swapped (controller, "leave", G_CALLBACK (text_focus_out), completion);
|
||||
gtk_widget_add_controller (GTK_WIDGET (text), controller);
|
||||
|
||||
|
@ -11411,6 +11411,23 @@ gtk_widget_add_controller (GtkWidget *widget,
|
||||
|
||||
g_ptr_array_add (priv->controllers, controller);
|
||||
|
||||
if (priv->controller_observer)
|
||||
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);
|
||||
}
|
||||
|
@ -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