mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
xwayland: Mark our X11 connection terminatable
The connection to the Xserver for the X11 window manager part of mutter even on Wayland may prevent the Xserver from shutting down. Currently, what mutter does is to check the X11 clients still connected to Xwayland using the XRes extension, with a list of X11 clients that can be safely ignored (typically the GNOME XSettings daemon, the IBus daemon, pulseaudio and even mutter window manager itself). When there is just those known clients remaining, mutter would kill Xwayland automatically. But that's racy, because between the time mutter checks with Xwayland the remaining clients and the time it actually kills the process, a new X11 client might have come along and won't be able to connect to Xwayland that mutter is just about to kill. Because of that, the feature “autoclose-xwayland” is marked as an experimental feature in mutter and not enabled by default. Thankfully, the Xserver has all it takes to manage that already, and is even capable of terminating itself once all X11 clients are gone (the -terminate option on the command line). With XFixes version 6, the X11 clients can declare themselves "terminatable", so that the Xserver could simply ignore those X11 clients when checking the remaining clients and terminate itself automatically. Use that mechanism to declare mutter's own connection to the Xserver as "terminatable" when Xwayland is started on demand so that it won't hold Xwayland alive for the sole purpose of mutter itself. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1794>
This commit is contained in:
parent
ffa5fd776d
commit
42855b69e7
@ -91,3 +91,6 @@
|
|||||||
|
|
||||||
/* List of executable names to ignore when terminating Xwayland */
|
/* List of executable names to ignore when terminating Xwayland */
|
||||||
#mesondefine XWAYLAND_IGNORE_EXECUTABLES
|
#mesondefine XWAYLAND_IGNORE_EXECUTABLES
|
||||||
|
|
||||||
|
/* Whether the Xwayland -terminate supports a delay */
|
||||||
|
#mesondefine HAVE_XWAYLAND_TERMINATE_DELAY
|
||||||
|
13
meson.build
13
meson.build
@ -28,7 +28,7 @@ json_glib_req = '>= 0.12.0'
|
|||||||
upower_glib_req = '>= 0.99.0'
|
upower_glib_req = '>= 0.99.0'
|
||||||
xcomposite_req = '>= 0.4'
|
xcomposite_req = '>= 0.4'
|
||||||
xkbcommon_req = '>= 0.4.3'
|
xkbcommon_req = '>= 0.4.3'
|
||||||
xfixes_req = '>= 3'
|
xfixes_req = '>= 6'
|
||||||
xi_req = '>= 1.7.4'
|
xi_req = '>= 1.7.4'
|
||||||
xrandr_req = '>= 1.5.0'
|
xrandr_req = '>= 1.5.0'
|
||||||
libstartup_notification_req = '>= 0.7'
|
libstartup_notification_req = '>= 0.7'
|
||||||
@ -457,6 +457,7 @@ endif
|
|||||||
|
|
||||||
have_xwayland_initfd = false
|
have_xwayland_initfd = false
|
||||||
have_xwayland_listenfd = false
|
have_xwayland_listenfd = false
|
||||||
|
have_xwayland_terminate_delay = false
|
||||||
if have_wayland
|
if have_wayland
|
||||||
xwayland_dep = dependency('xwayland', required: false)
|
xwayland_dep = dependency('xwayland', required: false)
|
||||||
|
|
||||||
@ -509,6 +510,15 @@ if have_wayland
|
|||||||
if (have_xwayland_listenfd)
|
if (have_xwayland_listenfd)
|
||||||
cdata.set('HAVE_XWAYLAND_LISTENFD', 1)
|
cdata.set('HAVE_XWAYLAND_LISTENFD', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# For Xwayland -listenfd usage
|
||||||
|
if xwayland_dep.found()
|
||||||
|
have_xwayland_terminate_delay = xwayland_dep.get_pkgconfig_variable('have_terminate_delay') == 'true'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (have_xwayland_terminate_delay)
|
||||||
|
cdata.set('HAVE_XWAYLAND_TERMINATE_DELAY', 1)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
have_xsetioerrorexithandler = false
|
have_xsetioerrorexithandler = false
|
||||||
@ -593,6 +603,7 @@ summary('Profiler', have_profiler, section: 'Options')
|
|||||||
summary('Xwayland initfd', have_xwayland_initfd, section: 'Options')
|
summary('Xwayland initfd', have_xwayland_initfd, section: 'Options')
|
||||||
summary('Xwayland listenfd', have_xwayland_listenfd, section: 'Options')
|
summary('Xwayland listenfd', have_xwayland_listenfd, section: 'Options')
|
||||||
summary('Safe X11 I/O errors', have_xsetioerrorexithandler, section: 'Options')
|
summary('Safe X11 I/O errors', have_xsetioerrorexithandler, section: 'Options')
|
||||||
|
summary('Xwayland terminate delay', have_xwayland_terminate_delay, section: 'Options')
|
||||||
|
|
||||||
summary('Enabled', have_tests, section: 'Tests')
|
summary('Enabled', have_tests, section: 'Tests')
|
||||||
summary('Core tests', have_core_tests, section: 'Tests')
|
summary('Core tests', have_core_tests, section: 'Tests')
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#include <X11/extensions/Xfixes.h>
|
||||||
#include <X11/Xauth.h>
|
#include <X11/Xauth.h>
|
||||||
#include <X11/Xlib-xcb.h>
|
#include <X11/Xlib-xcb.h>
|
||||||
|
|
||||||
@ -1305,6 +1306,8 @@ meta_xwayland_setup_xdisplay (MetaXWaylandManager *manager,
|
|||||||
XSetIOErrorExitHandler (xdisplay, x_io_error_exit, manager);
|
XSetIOErrorExitHandler (xdisplay, x_io_error_exit, manager);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
XFixesSetClientDisconnectMode (xdisplay, XFixesClientDisconnectFlagTerminate);
|
||||||
|
|
||||||
add_local_user_to_xhost (xdisplay);
|
add_local_user_to_xhost (xdisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user