[mutter/wip/carlosg/xwayland-startup-side-channel: 3/3] core: Drop META_DISPLAY_POLICY_MANDATORY x11 display policy



commit d60a25adf0a81eb8e127ff1b80c61e418421fa03
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Nov 16 15:46:09 2019 +0100

    core: Drop META_DISPLAY_POLICY_MANDATORY x11 display policy
    
    And rename it to "native", we no longer use it on the Xwayland paths.

 src/core/display.c          |  4 ++--
 src/core/main-private.h     |  2 +-
 src/core/main.c             |  5 ++++-
 src/wayland/meta-xwayland.c | 35 ++++++++---------------------------
 4 files changed, 15 insertions(+), 31 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index fb797ab05..90daeefa3 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -800,10 +800,10 @@ meta_display_open (void)
   display->selection = meta_selection_new (display);
   meta_clipboard_manager_init (display);
 
-  if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY)
+  if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_NATIVE)
     {
       if (!meta_display_init_x11 (display, &error))
-        g_error ("Failed to start Xwayland: %s", error->message);
+        g_error ("Failed to init X11 display: %s", error->message);
 
       timestamp = display->x11_display->timestamp;
     }
diff --git a/src/core/main-private.h b/src/core/main-private.h
index be6b1cef3..713264adb 100644
--- a/src/core/main-private.h
+++ b/src/core/main-private.h
@@ -32,7 +32,7 @@ typedef enum _MetaCompositorType
 
 typedef enum _MetaDisplayPolicy
 {
-  META_DISPLAY_POLICY_MANDATORY,
+  META_DISPLAY_POLICY_NATIVE,
   META_DISPLAY_POLICY_ON_DEMAND,
   META_DISPLAY_POLICY_DISABLED,
 } MetaDisplayPolicy;
diff --git a/src/core/main.c b/src/core/main.c
index 346632b16..433b0126f 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -741,7 +741,10 @@ meta_get_x11_display_policy (void)
     }
 #endif
 
-  return META_DISPLAY_POLICY_MANDATORY;
+  if (META_IS_BACKEND_X11 (backend))
+    return META_DISPLAY_POLICY_NATIVE;
+
+  g_assert_not_reached ();
 }
 
 void
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 85fa18a19..674047c68 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -365,6 +365,7 @@ xserver_died (GObject      *source,
   MetaXWaylandManager *manager = user_data;
   GSubprocess *proc = G_SUBPROCESS (source);
   MetaDisplay *display = meta_get_display ();
+  MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
   g_autoptr (GError) error = NULL;
 
   if (!g_subprocess_wait_finish (proc, result, &error))
@@ -383,27 +384,15 @@ xserver_died (GObject      *source,
           return;
         }
 
-      if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY)
-        g_warning ("X Wayland crashed; exiting");
-      else
-        g_warning ("X Wayland crashed; attempting to recover");
+      g_warning ("X Wayland crashed; attempting to recover");
     }
 
-  if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY)
-    {
-      meta_exit (META_EXIT_ERROR);
-    }
-  else if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND)
-    {
-      MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
-
-      if (display->x11_display)
-        meta_display_shutdown_x11 (display);
+  if (display->x11_display)
+    meta_display_shutdown_x11 (display);
 
-      if (!meta_xwayland_init (&compositor->xwayland_manager,
-                               compositor->wayland_display))
-        g_warning ("Failed to init X sockets");
-    }
+  if (!meta_xwayland_init (&compositor->xwayland_manager,
+                           compositor->wayland_display))
+    g_warning ("Failed to init X sockets");
 }
 
 static gboolean
@@ -422,10 +411,6 @@ static int
 x_io_error (Display *display)
 {
   g_warning ("Connection to xwayland lost");
-
-  if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY)
-    meta_exit (META_EXIT_ERROR);
-
   return 0;
 }
 
@@ -848,11 +833,7 @@ meta_xwayland_init (MetaXWaylandManager *manager,
   manager->wayland_display = wl_display;
   policy = meta_get_x11_display_policy ();
 
-  if (policy == META_DISPLAY_POLICY_MANDATORY)
-    {
-      return meta_xwayland_start_xserver (manager);
-    }
-  else if (policy == META_DISPLAY_POLICY_ON_DEMAND)
+  if (policy == META_DISPLAY_POLICY_ON_DEMAND)
     {
       g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN,
                      xdisplay_connection_activity_cb, manager);


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