searchbar: Ignore key presses when unmapped

The purpose of a searchbar is to start a search on visible widgets when
a key is pressed. Starting a search on e.g. a stack page that is not
visible at all is not very useful.
This commit is contained in:
Timm Bäder 2018-07-08 09:29:14 +02:00
parent 074eb2a19d
commit a976aa9740

View File

@ -640,6 +640,9 @@ capture_widget_key_handled (GtkEventControllerKey *controller,
GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
gboolean handled;
if (!gtk_widget_get_mapped (GTK_WIDGET (bar)))
return GDK_EVENT_PROPAGATE;
if (priv->reveal_child)
return GDK_EVENT_PROPAGATE;