From fa2745d314b5bc077bce4d446b314dc56dc7f8d7d454783ebe8b73762e320d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Fri, 1 Apr 2022 15:22:03 +0000 Subject: [PATCH 1/2] Accepting request 966423 from home:jeff_mahoney:branches:GNOME:Factory - gtkimmulticontext: Handle switches between displays (glgo#GNOME/gtk#4805). Added: gtkimmulticontext-Handle-switches-between-displays.patch This resolves crashes when opening the filechooser dialog using Wayland from X11 applications (like the Brave browser). That bug report was filed as https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/24 but closed as a duplicate issue against gtk4 with the fix used in this SR. OBS-URL: https://build.opensuse.org/request/show/966423 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk4?expand=0&rev=87 --- gtk4.changes | 6 ++ gtk4.spec | 2 + ...ext-Handle-switches-between-displays.patch | 60 +++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 gtkimmulticontext-Handle-switches-between-displays.patch diff --git a/gtk4.changes b/gtk4.changes index 4963165..050c824 100644 --- a/gtk4.changes +++ b/gtk4.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Mar 31 23:15:26 UTC 2022 - Jeff Mahoney + +- gtkimmulticontext: Handle switches between displays (glgo#GNOME/gtk#4805). + Added: gtkimmulticontext-Handle-switches-between-displays.patch + ------------------------------------------------------------------- Sat Mar 19 10:08:01 UTC 2022 - Bjørn Lie diff --git a/gtk4.spec b/gtk4.spec index 833a887..6bb46ef 100644 --- a/gtk4.spec +++ b/gtk4.spec @@ -34,6 +34,8 @@ Source2: settings.ini Source3: macros.gtk4 Source99: gtk4-rpmlintrc +Patch1: gtkimmulticontext-Handle-switches-between-displays.patch + BuildRequires: cups-devel >= 2.0 # We do not support building against cups 2.3 betas BuildConflicts: (cups-devel > 2.3 with cups-devel < 2.3.0) diff --git a/gtkimmulticontext-Handle-switches-between-displays.patch b/gtkimmulticontext-Handle-switches-between-displays.patch new file mode 100644 index 0000000..b6df101 --- /dev/null +++ b/gtkimmulticontext-Handle-switches-between-displays.patch @@ -0,0 +1,60 @@ +From: Carlos Garnacho +Date: Thu, 31 Mar 2022 16:29:34 +0200 +Subject: gtkimmulticontext: Handle switches between displays +Git-repo: https://gitlab.gnome.org/GNOME/gtk +Git-commit: b67da38916b710ba6eedd65ffb569a29e47ddb4d +References: glgo#GNOME/gtk#4805 +Upstream: merged + +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 + +Acked-by: Jeff Mahoney +--- + 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 + From b639e17f497f8bece454bc1c58e881b45f291e44c6578b1ba1b4e897af3e95cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Fri, 1 Apr 2022 15:24:22 +0000 Subject: [PATCH 2/2] Tweak previous checkin OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk4?expand=0&rev=88 --- gtk4.changes | 5 +++-- gtk4.spec | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk4.changes b/gtk4.changes index 050c824..a3f7b39 100644 --- a/gtk4.changes +++ b/gtk4.changes @@ -1,8 +1,9 @@ ------------------------------------------------------------------- Thu Mar 31 23:15:26 UTC 2022 - Jeff Mahoney -- gtkimmulticontext: Handle switches between displays (glgo#GNOME/gtk#4805). - Added: gtkimmulticontext-Handle-switches-between-displays.patch +- gtkimmulticontext: Handle switches between displays + (glgo#GNOME/gtk#4805). Added: + gtkimmulticontext-Handle-switches-between-displays.patch ------------------------------------------------------------------- Sat Mar 19 10:08:01 UTC 2022 - Bjørn Lie diff --git a/gtk4.spec b/gtk4.spec index 6bb46ef..fd98f4b 100644 --- a/gtk4.spec +++ b/gtk4.spec @@ -34,6 +34,7 @@ Source2: settings.ini Source3: macros.gtk4 Source99: gtk4-rpmlintrc +# PATCH-FIX-UPSTREAM gtkimmulticontext-Handle-switches-between-displays.patch glgo#GNOME/gtk#4805 -- gtkimmulticontext: Handle switches between displays Patch1: gtkimmulticontext-Handle-switches-between-displays.patch BuildRequires: cups-devel >= 2.0