53 lines
1.7 KiB
Diff
53 lines
1.7 KiB
Diff
From 9ef20fbf3e9f93e28d54e84731b90a1cd40bcc8e Mon Sep 17 00:00:00 2001
|
|
From: Matthias Clasen <mclasen@redhat.com>
|
|
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
|
|
|