diff --git a/0001-Filechooser-Fix-a-focus-mishap.patch b/0001-Filechooser-Fix-a-focus-mishap.patch new file mode 100644 index 0000000..154e890 --- /dev/null +++ b/0001-Filechooser-Fix-a-focus-mishap.patch @@ -0,0 +1,52 @@ +From 9ef20fbf3e9f93e28d54e84731b90a1cd40bcc8e Mon Sep 17 00:00:00 2001 +From: Matthias Clasen +Date: Mon, 25 Nov 2024 18:25:00 -0500 +Subject: [PATCH] Filechooser: Fix a focus mishap + +When the focus is on the server entry in the places view, we +don't want to steal key events to start a search. +--- + gtk/gtkfilechooserwidget.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c +index e10bebda21..791e82c578 100644 +--- a/gtk/gtkfilechooserwidget.c ++++ b/gtk/gtkfilechooserwidget.c +@@ -93,6 +93,7 @@ + #include "gtkmultisorter.h" + #include "gtkcolumnviewsorter.h" + #include "gtkexpression.h" ++#include "gtkactionbar.h" + + #ifndef G_OS_WIN32 + #include "gtkopenuriportal.h" +@@ -6833,6 +6834,8 @@ captured_key (GtkEventControllerKey *controller, + { + GtkFileChooserWidget *impl = data; + gboolean handled; ++ GtkWidget *focus; ++ GtkWidget *ancestor; + + if (impl->operation_mode == OPERATION_MODE_SEARCH || + impl->operation_mode == OPERATION_MODE_ENTER_LOCATION || +@@ -6843,10 +6846,14 @@ captured_key (GtkEventControllerKey *controller, + if (keyval == GDK_KEY_slash || keyval == GDK_KEY_asciitilde || keyval == GDK_KEY_period) + return GDK_EVENT_PROPAGATE; + ++ focus = gtk_root_get_focus (gtk_widget_get_root (GTK_WIDGET (impl))); ++ ++ ancestor = gtk_widget_get_ancestor (focus, GTK_TYPE_ACTION_BAR); ++ if (ancestor && gtk_widget_is_ancestor (ancestor, impl->places_view)) ++ 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; + } +-- +2.48.1 + diff --git a/gtk4.spec b/gtk4.spec index 6c9ce4d..9b1c50b 100644 --- a/gtk4.spec +++ b/gtk4.spec @@ -35,6 +35,7 @@ Source0: https://download.gnome.org/sources/gtk/4.15/gtk-%{version}.tar.x # Using objcopy for resources interferes with hardening Patch0: gtk4-no-objcopy.patch Patch1: gtk4-no-emoji-context-menu.patch +Patch2: 0001-Filechooser-Fix-a-focus-mishap.patch BuildRequires: cups-devel BuildRequires: desktop-file-utils