Hello community, here is the log from the commit of package ibus for openSUSE:Factory checked in at 2020-05-14 23:25:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ibus (Old) and /work/SRC/openSUSE:Factory/.ibus.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ibus" Thu May 14 23:25:12 2020 rev:103 rq:803196 version:1.5.22 Changes: -------- --- /work/SRC/openSUSE:Factory/ibus/ibus.changes 2020-05-04 18:32:31.532075063 +0200 +++ /work/SRC/openSUSE:Factory/.ibus.new.2738/ibus.changes 2020-05-14 23:25:15.373041438 +0200 @@ -1,0 +2,14 @@ +Tue May 12 07:32:41 UTC 2020 - QK ZHU <[email protected]> + +- Add ibus-socket-name-compatibility.patch: Compatibility for + ibus-use-wayland-display-for-socket-name.patch. This fixes Qt + clients breakage in Wayland (bsc#1171442, gh#ibus/ibus#2195). + +------------------------------------------------------------------- +Mon May 11 08:23:08 UTC 2020 - QK ZHU <[email protected]> + +- Add ibus-use-wayland-display-for-socket-name.patch: + Use WAYLAND_DISPLAY on Wayland sessions to make up IBus socket name + (bsc#1171442, gh#ibus/ibus#2195). + +------------------------------------------------------------------- New: ---- ibus-socket-name-compatibility.patch ibus-use-wayland-display-for-socket-name.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ibus.spec ++++++ --- /var/tmp/diff_new_pack.r6Oq32/_old 2020-05-14 23:25:16.545043996 +0200 +++ /var/tmp/diff_new_pack.r6Oq32/_new 2020-05-14 23:25:16.545043996 +0200 @@ -1,7 +1,7 @@ # # spec file for package ibus # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -57,6 +57,12 @@ # PATCH-FIX-UPSTREAM [email protected] # Remove unnecessary qt5 dependency https://github.com/ibus/ibus/pull/2194 Patch13: 0001-Replace-the-Qt-check-for-appindicator-engine-icon-wi.patch +# PATCH-FIX-UPSTREAM ibus-use-wayland-display-for-socket-name.patch bsc#1171442, gh#ibus/ibus#2195 [email protected] +# Use WAYLAND_DISPLAY on Wayland sessions to make up IBus socket name +Patch14: ibus-use-wayland-display-for-socket-name.patch +# PATCH-FIX-UPSTREAM ibus-socket-name-compatibility.patch bsc#1171442, gh#ibus/ibus#2195 qkzhu@suse +# Compatibility workaround for ibus-use-wayland-display-for-socket-name.patch +Patch15: ibus-socket-name-compatibility.patch BuildRequires: fdupes BuildRequires: gettext-devel BuildRequires: gobject-introspection-devel >= 0.9.6 @@ -201,6 +207,8 @@ %patch12 -p1 %endif %patch13 -p1 +%patch14 -p1 +%patch15 -p1 %build autoreconf -fi ++++++ ibus-socket-name-compatibility.patch ++++++ Description: compatibility for use-wayland-display-for-socket-name.patch This writes ~/.config/ibus/bus/SOCKETPATH with the old name. Author: Changwoo Ryu Last-Update: 2020-05-01 Bug: https://bugreports.qt.io/browse/QTBUG-82910 Forwarded: not-needed, workaround --- a/src/ibusshare.c +++ b/src/ibusshare.c @@ -90,79 +90,132 @@ return g_getenv("IBUS_SESSION_ID"); } +static const gchar *ibus_get_socket_path_internal (gboolean compat, gchar *client_display); + const gchar * ibus_get_socket_path (void) { static gchar *path = NULL; if (path == NULL) { - gchar *hostname = "unix"; - gchar *display; - gchar *displaynumber = "0"; - /* gchar *screennumber = "0"; */ - gboolean is_wayland = FALSE; - gchar *p; - - path = g_strdup (g_getenv ("IBUS_ADDRESS_FILE")); - if (path != NULL) { - return path; + path = ibus_get_socket_path_internal (FALSE, NULL); + } + return path; +} + +static const gchar * +ibus_get_socket_path_x11_compat (void) +{ + static gchar *path = NULL; + if (path == NULL) + path = ibus_get_socket_path_internal (TRUE, NULL); + return path; +} + +static const gchar * +ibus_get_socket_path_gnome_xwayland_compat (void) +{ + static gchar *path = NULL; + if (path == NULL) { + gint setup_display_number; + gchar *client_display; + gchar **tokens; + + tokens = g_strsplit (ibus_get_socket_path_x11_compat (), "-", 3); + if (tokens[0] != NULL && tokens[1] != NULL && tokens[2] != NULL) { + setup_display_number = g_strtod(tokens[2], NULL); + if (setup_display_number > 0) { + client_display = g_strdup_printf (":%d", setup_display_number - 1); + path = ibus_get_socket_path_internal (TRUE, client_display); + } } - if (_display == NULL) { + g_strfreev (tokens); + } + return path; +} + +static const gchar * +ibus_get_socket_path_internal (gboolean compat, gchar *client_display) +{ + gchar *path = NULL; + + gchar *hostname = "unix"; + gchar *display; + gchar *displaynumber = "0"; + /* gchar *screennumber = "0"; */ + gboolean is_wayland = FALSE; + gchar *p; + + path = g_strdup (g_getenv ("IBUS_ADDRESS_FILE")); + if (path != NULL) { + return path; + } + + if (_display == NULL) { + if (compat) { + if (client_display == NULL) + display = g_strdup (g_getenv ("DISPLAY")); + else + display = client_display; + } else { display = g_strdup (g_getenv ("WAYLAND_DISPLAY")); if (display) is_wayland = TRUE; - else + else if (client_display == NULL) display = g_strdup (g_getenv ("DISPLAY")); + else + display = client_display; } - else { - display = g_strdup (_display); - } - - if (is_wayland) { - displaynumber = display; - } else if (display) { - p = display; - hostname = display; - for (; *p != ':' && *p != '\0'; p++); + } + else { + display = g_strdup (_display); + } - if (*p == ':') { - *p = '\0'; - p++; - displaynumber = p; - } + if (is_wayland) { + displaynumber = display; + } else if (display) { + p = display; + hostname = display; + for (; *p != ':' && *p != '\0'; p++); + + if (*p == ':') { + *p = '\0'; + p++; + displaynumber = p; + } - for (; *p != '.' && *p != '\0'; p++); + for (; *p != '.' && *p != '\0'; p++); - if (*p == '.') { - *p = '\0'; - p++; - /* Do not use screennumber - screennumber = p; */ - } + if (*p == '.') { + *p = '\0'; + p++; + /* Do not use screennumber + screennumber = p; */ } + } - if (hostname[0] == '\0') - hostname = "unix"; + if (hostname[0] == '\0') + hostname = "unix"; + + p = g_strdup_printf ("%s-%s-%s", + ibus_get_local_machine_id (), + hostname, + displaynumber); + /* Qt5 IBus module has a hard-coded path and we cannot change this + * for the back compatibility. + * XDG_RUNTIME_DIR is not useful because it's generated by + * login but not `su` command and ibus-daemon can be run with `su` + * and we may change the path to XDG_CACHE_HOME in the future. + */ + path = g_build_filename (g_get_user_config_dir (), + "ibus", + "bus", + p, + NULL); + g_free (p); + g_free (display); - p = g_strdup_printf ("%s-%s-%s", - ibus_get_local_machine_id (), - hostname, - displaynumber); - /* Qt5 IBus module has a hard-coded path and we cannot change this - * for the back compatibility. - * XDG_RUNTIME_DIR is not useful because it's generated by - * login but not `su` command and ibus-daemon can be run with `su` - * and we may change the path to XDG_CACHE_HOME in the future. - */ - path = g_build_filename (g_get_user_config_dir (), - "ibus", - "bus", - p, - NULL); - g_free (p); - g_free (display); - } return path; } @@ -248,19 +301,45 @@ return address; } +static void ibus_write_address_internal (const gchar *address, const gchar *socket_path); + void ibus_write_address (const gchar *address) { + const gchar *socket_path; + const gchar *socket_path_compat; + + socket_path = ibus_get_socket_path (); + ibus_write_address_internal (address, socket_path); + + if (g_getenv ("WAYLAND_DISPLAY") != NULL) { + socket_path_compat = ibus_get_socket_path_x11_compat (); + ibus_write_address_internal (address, socket_path_compat); + + if (g_getenv ("GNOME_SETUP_DISPLAY") != NULL && + strcmp (g_getenv ("GNOME_SETUP_DISPLAY"), g_getenv ("DISPLAY")) == 0) { + /* Running from gnome-shell with the setup display; write the socket + * address to an additional path for X11 clients */ + socket_path_compat = ibus_get_socket_path_gnome_xwayland_compat (); + if (socket_path_compat != NULL) + ibus_write_address_internal (address, socket_path_compat); + } + } +} + +static void +ibus_write_address_internal (const gchar *address, const gchar *socket_path) +{ FILE *pf; gchar *path; g_return_if_fail (address != NULL); - path = g_path_get_dirname (ibus_get_socket_path ()); + path = g_path_get_dirname (socket_path); g_mkdir_with_parents (path, 0700); g_free (path); - g_unlink (ibus_get_socket_path ()); - pf = fopen (ibus_get_socket_path (), "w"); + g_unlink (socket_path); + pf = fopen (socket_path, "w"); g_return_if_fail (pf != NULL); fprintf (pf, ++++++ ibus-use-wayland-display-for-socket-name.patch ++++++ Author: Carlos Garnacho <[email protected]> Date: Thu Mar 12 16:02:16 2020 +0900 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. BUG=https://gitlab.gnome.org/GNOME/gnome-shell/issues/2341 Forwarded: https://github.com/ibus/ibus/commit/8ce25208c3f4adfd290a032c6aa739d2b7580eb1 Last-Update: 2020-04-06 diff --git a/src/ibusshare.c b/src/ibusshare.c index 0d50d3f5..e0ef2ce0 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,19 @@ 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 (is_wayland) { + displaynumber = display; + } else if (display) { p = display; hostname = display; for (; *p != ':' && *p != '\0'; p++);
