[mutter] xwayland: Make autoclose-xwayland an exp. feature



commit 3fc603edd3388e39e91a5fa5c340bf3f6d7b93a4
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Mon Jan 18 17:59:08 2021 +0100

    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>

 data/org.gnome.mutter.gschema.xml.in | 5 +++++
 src/backends/meta-settings-private.h | 1 +
 src/backends/meta-settings.c         | 2 ++
 src/wayland/meta-xwayland.c          | 5 +++++
 4 files changed, 13 insertions(+)
---
diff --git a/data/org.gnome.mutter.gschema.xml.in b/data/org.gnome.mutter.gschema.xml.in
index 20b7e4276e..ec8958f817 100644
--- a/data/org.gnome.mutter.gschema.xml.in
+++ b/data/org.gnome.mutter.gschema.xml.in
@@ -133,6 +133,11 @@
                                         is already enabled by default when using
                                         the i915 driver, but disabled for 
                                         everything else. Requires a restart.
+
+        • “autoclose-xwayland”        — Automatically terminates Xwayland if all
+                                        relevant X11 clients are gone. Does not
+                                        require a restart.
+
       </description>
     </key>
 
diff --git a/src/backends/meta-settings-private.h b/src/backends/meta-settings-private.h
index c0621cb080..629406550d 100644
--- a/src/backends/meta-settings-private.h
+++ b/src/backends/meta-settings-private.h
@@ -36,6 +36,7 @@ typedef enum _MetaExperimentalFeature
   META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2),
   META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND  = (1 << 3),
   META_EXPERIMENTAL_FEATURE_DMA_BUF_SCREEN_SHARING = (1 << 4),
+  META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND  = (1 << 5),
 } MetaExperimentalFeature;
 
 typedef enum _MetaXwaylandExtension
diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c
index 553e2cd1c8..8d5baaa6fd 100644
--- a/src/backends/meta-settings.c
+++ b/src/backends/meta-settings.c
@@ -275,6 +275,8 @@ experimental_features_handler (GVariant *features_variant,
         feature = META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND;
       else if (g_str_equal (feature_str, "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)
         g_message ("Enabling experimental feature '%s'", feature_str);
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index c26a5f539d..b11b32b3eb 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -529,6 +529,11 @@ shutdown_xwayland_cb (gpointer data)
 {
   MetaXWaylandManager *manager = data;
   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))
     return G_SOURCE_CONTINUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]