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