summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-01-26 22:17:57 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-01-26 22:17:57 -0500
commit7db60f958d50396d55896333fc727ccdcd635100 (patch)
treef3723ca1f0d965a9fe9d4cc0897049324788576d
parent8a0d4dfa941faba793d98c58babf0d7e151b4a88 (diff)
downloadgtk+-7db60f958d50396d55896333fc727ccdcd635100.tar.gz
searchentry: Capture events in the bubble phasesearch-entry-capture
This is an unfortunate naming clash, but it avoids an event handling clash between the capture widget and its children. Fixes: #3098
-rw-r--r--gtk/gtksearchentry.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c
index 48bdf5a9f4..8b03286a02 100644
--- a/gtk/gtksearchentry.c
+++ b/gtk/gtksearchentry.c
@@ -667,6 +667,14 @@ capture_widget_key_handled (GtkEventControllerKey *controller,
* If the entry is part of a #GtkSearchBar, it is preferable
* to call gtk_search_bar_set_key_capture_widget() instead, which
* will reveal the entry in addition to triggering the search entry.
+ *
+ * Note that despite the name of this function, the events
+ * are only 'captured' in the bubble phase, which means that
+ * editable child widgets of @widget will receive text input
+ * before it gets captured. If that is not desired, you can
+ * capture and forward the events yourself with
+ * gtk_event_controller_key_forward().
+
**/
void
gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
@@ -692,7 +700,7 @@ gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
entry->capture_widget_controller = gtk_event_controller_key_new ();
gtk_event_controller_set_propagation_phase (entry->capture_widget_controller,
- GTK_PHASE_CAPTURE);
+ GTK_PHASE_BUBBLE);
g_signal_connect (entry->capture_widget_controller, "key-pressed",
G_CALLBACK (capture_widget_key_handled), entry);
g_signal_connect (entry->capture_widget_controller, "key-released",