Backport PR #2195 to fix ibus with GNOME 3.36.0

This commit is contained in:
Adam Williamson 2020-03-11 11:42:19 -07:00
parent c06b89c8ef
commit 8fae345fb8
2 changed files with 76 additions and 1 deletions

68
2195.patch Normal file
View File

@ -0,0 +1,68 @@
From 1bed77ad198bc6ad7184674c510425039143fac7 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 11 Mar 2020 17:08:37 +0100
Subject: [PATCH] src: Use WAYLAND_DISPLAY on Wayland sessions to make up IBus
socket name
In Wayland sessions, GNOME Shell 3.36 is leveraging 2 X11 Display
connections so one is used to set up all services for a "X11 session"
before user applications connected to the other display might require it.
This allows seamlessly starting Xwayland on demand to X11 user applications.
IBus here belongs to the first described connection, it is started
explicitly on that display by GNOME Shell as it is necessary to set up
ibus-x11 before any other X11 client might want to use it.
However the use of this "secondary" display results in IBus daemon left
unable to talk to applications, as the socket name is dependent on the
DISPLAY envvar and ibus/applications don't agree on its content.
For wayland sessions, make it look for WAYLAND_DISPLAY, as that'll have
the similar "per session bus" behavior that this seems to look after.
Related: https://gitlab.gnome.org/GNOME/gnome-shell/issues/2341
---
src/ibusshare.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/ibusshare.c b/src/ibusshare.c
index 0d50d3f5c..b8e6450f6 100644
--- a/src/ibusshare.c
+++ b/src/ibusshare.c
@@ -100,6 +100,7 @@ ibus_get_socket_path (void)
gchar *display;
gchar *displaynumber = "0";
/* gchar *screennumber = "0"; */
+ gboolean is_wayland = FALSE;
gchar *p;
path = g_strdup (g_getenv ("IBUS_ADDRESS_FILE"));
@@ -108,13 +109,17 @@ ibus_get_socket_path (void)
}
if (_display == NULL) {
- display = g_strdup (g_getenv ("DISPLAY"));
+ display = g_strdup (g_getenv ("WAYLAND_DISPLAY"));
+ if (display)
+ is_wayland = TRUE;
+ else
+ display = g_strdup (g_getenv ("DISPLAY"));
}
else {
display = g_strdup (_display);
}
- if (display) {
+ if (display && !is_wayland) {
p = display;
hostname = display;
for (; *p != ':' && *p != '\0'; p++);
@@ -133,6 +138,8 @@ ibus_get_socket_path (void)
/* Do not use screennumber
screennumber = p; */
}
+ } else if (display) {
+ displaynumber = display;
}
if (hostname[0] == '\0')

View File

@ -35,7 +35,7 @@
Name: ibus
Version: 1.5.22
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -45,6 +45,10 @@ Source2: %{name}.conf.5
# Patch0: %%{name}-HEAD.patch
# Under testing #1349148 #1385349 #1350291 #1406699 #1432252 #1601577
Patch1: %{name}-1385349-segv-bus-proxy.patch
# Fix display selection on GNOME 3.36.0
# https://gitlab.gnome.org/GNOME/gnome-shell/issues/2341
# https://github.com/ibus/ibus/pull/2195
Patch2: 2195.patch
BuildRequires: gettext-devel
BuildRequires: libtool
@ -460,6 +464,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Wed Mar 11 2020 Adam Williamson <awilliam@redhat.com> - 1.5.22-3
- Backport PR #2195 to fix ibus with GNOME 3.36.0
* Tue Feb 25 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-2
- Bug 1805634 - Add a conditional requires ibus-gtk2 with gtk2