Propagate key events when the location entry is focused
authorLuca Bacci <luca.bacci982@gmail.com>
Fri, 29 Apr 2022 11:19:01 +0000 (13:19 +0200)
committerLuca Bacci <luca.bacci982@gmail.com>
Fri, 29 Apr 2022 14:53:02 +0000 (16:53 +0200)
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4880

gtk/gtkfilechooserwidget.c

index be084da4212260d140d5a4744c1e59dbd4eee6c1..b9831d53cff7de9dbf685d32b1cb35f6ffc3c726 100644 (file)
@@ -7740,6 +7740,14 @@ captured_key (GtkEventControllerKey *controller,
   if (keyval == GDK_KEY_slash)
     return GDK_EVENT_PROPAGATE;
 
+  if (impl->location_entry)
+    {
+      GtkWidget *focus = gtk_root_get_focus (gtk_widget_get_root (GTK_WIDGET (impl)));
+
+      if (focus && gtk_widget_is_ancestor (focus, impl->location_entry))
+        return GDK_EVENT_PROPAGATE;
+    }
+
   handled = gtk_event_controller_key_forward (controller, GTK_WIDGET (impl->search_entry));
   if (handled == GDK_EVENT_STOP)
     operation_mode_set (impl, OPERATION_MODE_SEARCH);