diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2021-08-18 11:54:31 +0900 |
---|---|---|
committer | fujiwarat <takao.fujiwara1@gmail.com> | 2021-08-18 11:54:31 +0900 |
commit | 71ca4a985966aa5a9dfbfb5c671fee841f8ee730 (patch) | |
tree | a1b40e5ce8f76879ffe06fbc1168bc424cd4e626 | |
parent | a823161768c8f6916dbdebe73842a9fc04521369 (diff) | |
download | ibus-71ca4a985966aa5a9dfbfb5c671fee841f8ee730.tar.gz |
client/x11: Add support for XFixes ClientDisconnectMode
The Xserver itself is capable of terminating itself once all X11 clients
are gone, yet in a typical full session, there are a number of X11
clients such as ibus-x11 running continuously.
Those always-running clients will prevent the Xserver from terminating,
because the actual number of X11 clients will never drop to 0.
Use XFixes ClientDisconnectMode to inform the X11 server that it can
terminate even if ibus-x11 is still running.
That will allow Xwayland from terminating automatically when regular
clients have quit.
On plain Xorg servers, the lifetime of the session is usually tied to
the session manager or window manager, and this change will have no
effect.
BUG=https://github.com/ibus/ibus/pull/2314
-rw-r--r-- | client/x11/Makefile.am | 2 | ||||
-rw-r--r-- | client/x11/main.c | 10 | ||||
-rw-r--r-- | configure.ac | 8 |
3 files changed, 20 insertions, 0 deletions
diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am index 5bd04d33..12de6ea8 100644 --- a/client/x11/Makefile.am +++ b/client/x11/Makefile.am @@ -49,11 +49,13 @@ ibus_x11_LDADD = \ $(libibus) \ @X11_LIBS@ \ $(GTK_LIBS) \ + $(XFIXES_LIBS) \ $(NULL) ibus_x11_CFLAGS = \ @X11_CFLAGS@ \ $(GTK_CFLAGS) \ + $(XFIXES_CFLAGS) \ @DBUS_CFLAGS@ \ -I$(top_srcdir)/util/IMdkit \ -I$(top_srcdir)/src \ diff --git a/client/x11/main.c b/client/x11/main.c index ffd776fd..fe30c1d6 100644 --- a/client/x11/main.c +++ b/client/x11/main.c @@ -24,10 +24,15 @@ */ #define _GNU_SOURCE +#include "config.h" + #include <X11/Xproto.h> #include <X11/Xlib.h> #include <X11/keysym.h> #include <X11/Xutil.h> +#ifdef HAVE_XFIXES +#include <X11/extensions/Xfixes.h> +#endif #include <XimProto.h> #include <IMdkit.h> #include <Xi18n.h> @@ -1174,6 +1179,11 @@ main (int argc, char **argv) XSetErrorHandler (_xerror_handler); XSetIOErrorHandler (_xerror_io_handler); +#ifdef HAVE_XFIXES + XFixesSetClientDisconnectMode(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), + XFixesClientDisconnectFlagTerminate); +#endif + while (1) { static struct option long_options [] = { { "debug", 1, 0, 0}, diff --git a/configure.ac b/configure.ac index 4e2f8e6e..6df26afb 100644 --- a/configure.ac +++ b/configure.ac @@ -618,6 +618,13 @@ PKG_CHECK_MODULES(XTEST, ) AM_CONDITIONAL([ENABLE_XTEST], [test x"$enable_xtest" = x"yes"]) +PKG_CHECK_MODULES(XFIXES, + [x11 xfixes >= 6], + [AC_DEFINE([HAVE_XFIXES], [1], [Define to enable XFixes]) + have_xfixes=yes], + [have_xfixes="no (libXfixes version is lower than 6)"] +) + # --enable-install-tests AC_ARG_ENABLE(install-tests, AS_HELP_STRING([--enable-install-tests], @@ -843,6 +850,7 @@ Build options: Enable Unicode dict $enable_unicode_dict UCD directory $UCD_DIR Socket directory "$IBUS_SOCKET_DIR" + XFixes client disconnect $have_xfixes Run test cases $enable_tests Install tests $enable_install_tests ]) |