xwayland: Make autoclose-xwayland an exp. feature

Closing automatically Xwayland once all relevant X11 clients are gone is
inherently racy, if a new client comes along right at the time we're
killing Xwayland.

Fixing the possible race conditions between mutter, Xwayland and the X11
clients may take some time.

Meanwhile, make that an experimental feature "autoclose-xwayland".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1673>
This commit is contained in:
Olivier Fourdan 2021-01-18 17:59:08 +01:00
parent c255031b6d
commit 3fc603edd3
4 changed files with 13 additions and 0 deletions

View File

@ -133,6 +133,11 @@
is already enabled by default when using is already enabled by default when using
the i915 driver, but disabled for the i915 driver, but disabled for
everything else. Requires a restart. everything else. Requires a restart.
• “autoclose-xwayland” — Automatically terminates Xwayland if all
relevant X11 clients are gone. Does not
require a restart.
</description> </description>
</key> </key>

View File

@ -36,6 +36,7 @@ typedef enum _MetaExperimentalFeature
META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2), META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2),
META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND = (1 << 3), META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND = (1 << 3),
META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING = (1 << 4), META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING = (1 << 4),
META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND = (1 << 5),
} MetaExperimentalFeature; } MetaExperimentalFeature;
typedef enum _MetaXwaylandExtension typedef enum _MetaXwaylandExtension

View File

@ -275,6 +275,8 @@ experimental_features_handler (GVariant *features_variant,
feature = META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND; feature = META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND;
else if (g_str_equal (feature_str, "dma-buf-screen-sharing")) else if (g_str_equal (feature_str, "dma-buf-screen-sharing"))
feature = META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING; feature = META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING;
else if (g_str_equal (feature_str, "autoclose-xwayland"))
feature = META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND;
if (feature) if (feature)
g_message ("Enabling experimental feature '%s'", feature_str); g_message ("Enabling experimental feature '%s'", feature_str);

View File

@ -529,6 +529,11 @@ shutdown_xwayland_cb (gpointer data)
{ {
MetaXWaylandManager *manager = data; MetaXWaylandManager *manager = data;
MetaDisplay *display = meta_get_display (); MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
if (!meta_settings_is_experimental_feature_enabled (meta_backend_get_settings (backend),
META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND))
return G_SOURCE_REMOVE;
if (!can_terminate_xwayland (display->x11_display->xdisplay)) if (!can_terminate_xwayland (display->x11_display->xdisplay))
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;