forked from AuroraMiddleware/gtk
gtkpasswordentry: Consume click events after pressing on icon
This may result in user actions, so the gesture should consume the events.
This commit is contained in:
parent
7a4afb08bd
commit
58c31b8627
@ -141,6 +141,12 @@ focus_changed (GtkWidget *widget)
|
||||
caps_lock_state_changed (entry->keyboard, NULL, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_icon_press (GtkGesture *gesture)
|
||||
{
|
||||
gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_password_entry_toggle_peek:
|
||||
* @entry: a `GtkPasswordEntry`
|
||||
@ -607,6 +613,8 @@ gtk_password_entry_set_show_peek_icon (GtkPasswordEntry *entry,
|
||||
gtk_widget_set_parent (entry->peek_icon, GTK_WIDGET (entry));
|
||||
|
||||
press = gtk_gesture_click_new ();
|
||||
g_signal_connect (press, "pressed",
|
||||
G_CALLBACK (gtk_password_entry_icon_press), entry);
|
||||
g_signal_connect_swapped (press, "released",
|
||||
G_CALLBACK (gtk_password_entry_toggle_peek), entry);
|
||||
gtk_widget_add_controller (entry->peek_icon, GTK_EVENT_CONTROLLER (press));
|
||||
|
Loading…
Reference in New Issue
Block a user