Backport MR #4605 to fix portal save/load dialogs on X (#2068041)

This commit is contained in:
Adam Williamson 2022-03-31 11:51:17 -07:00
parent 26e9ae85dc
commit 39df734d09
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,57 @@
From b67da38916b710ba6eedd65ffb569a29e47ddb4d Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 31 Mar 2022 16:29:34 +0200
Subject: [PATCH] gtkimmulticontext: Handle switches between displays
Currently the GtkIMMultiContext may stick to a delegate GtkIMContext
that no longer applies after the multicontext is dissociated from
any widget.
Handle set_client_widget() so that it can handle changes between
widgets from 2 different display, but also so the delegate is made
NULL whenever the context has a NULL widget.
Doing so, any new client widget results in a new delegate IM context
lookup from the right GdkDisplay and GtkSettings, which avoids any
mix up.
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4805
---
gtk/gtkimmulticontext.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 47347d299b..0a5ef9a5a6 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -314,6 +314,11 @@ gtk_im_multicontext_set_client_widget (GtkIMContext *context,
GtkIMContext *delegate;
GtkSettings *settings;
+ if (priv->client_widget == widget)
+ return;
+
+ gtk_im_multicontext_set_delegate (self, NULL, TRUE);
+
if (priv->client_widget != NULL)
{
settings = gtk_widget_get_settings (priv->client_widget);
@@ -332,11 +337,11 @@ gtk_im_multicontext_set_client_widget (GtkIMContext *context,
g_signal_connect (settings, "notify::gtk-im-module",
G_CALLBACK (im_module_setting_changed),
self);
- }
- delegate = gtk_im_multicontext_get_delegate (self);
- if (delegate)
- gtk_im_context_set_client_widget (delegate, widget);
+ delegate = gtk_im_multicontext_get_delegate (self);
+ if (delegate)
+ gtk_im_context_set_client_widget (delegate, widget);
+ }
}
static void
--
2.35.1

View File

@ -17,12 +17,17 @@
Name: gtk4
Version: 4.6.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: GTK graphical user interface library
License: LGPLv2+
URL: https://www.gtk.org
Source0: https://download.gnome.org/sources/gtk/4.6/gtk-%{version}.tar.xz
# Fix portal save/load dialogs not working on X
# https://bugzilla.redhat.com/show_bug.cgi?id=2068041
# https://gitlab.gnome.org/GNOME/gtk/-/issues/4805
# https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4605
Patch0: 0001-gtkimmulticontext-Handle-switches-between-displays.patch
BuildRequires: cups-devel
BuildRequires: desktop-file-utils
@ -227,6 +232,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_mandir}/man1/gtk4-widget-factory.1*
%changelog
* Thu Mar 31 2022 Adam Williamson <awilliam@redhat.com> - 4.6.2-2
- Backport MR #4605 to fix portal save/load dialogs on X (#2068041)
* Sat Mar 19 2022 David King <amigadave@amigadave.com> - 4.6.2-1
- Update to 4.6.2