summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-08-24 01:12:31 +0200
committerCarlos Garnacho <carlosg@gnome.org>2021-08-24 01:12:31 +0200
commit58c31b8627a795c70e5a2ef4b0fdbe4d52bb0023 (patch)
treefa6a2f78e9905ac8a41a86166be1eb7e5dc0d3c0
parent7a4afb08bdd39916aaccb624ef6cbb62291e91d7 (diff)
downloadgtk+-58c31b8627a795c70e5a2ef4b0fdbe4d52bb0023.tar.gz
gtkpasswordentry: Consume click events after pressing on icon
This may result in user actions, so the gesture should consume the events.
-rw-r--r--gtk/gtkpasswordentry.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c
index 0e66499c69..ba91de58f4 100644
--- a/gtk/gtkpasswordentry.c
+++ b/gtk/gtkpasswordentry.c
@@ -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));