[mutter] Add --nested command line argument



commit c22bee19e1461dd3a899dfa8c80c1ffc88ed5381
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Nov 26 15:02:20 2015 +0800

    Add --nested command line argument
    
    As of "core: start as wayland display server when
    XDG_SESSION_TYPE=wayland" it is no longer possible to run a nested
    mutter Wayland session on top of another Wayland session. This patch
    adds a command line argument to make it possible to force mutter to
    start as a nested compositor.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758658

 src/core/main.c |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index 2a23c15..c99ede5 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -168,6 +168,7 @@ static gboolean  opt_disable_sm;
 static gboolean  opt_sync;
 #ifdef HAVE_WAYLAND
 static gboolean  opt_wayland;
+static gboolean  opt_nested;
 #endif
 #ifdef HAVE_NATIVE_BACKEND
 static gboolean  opt_display_server;
@@ -216,6 +217,12 @@ static GOptionEntry meta_options[] = {
     N_("Run as a wayland compositor"),
     NULL
   },
+  {
+    "nested", 0, 0, G_OPTION_ARG_NONE,
+    &opt_nested,
+    N_("Run as a nested compositor"),
+    NULL
+  },
 #endif
 #ifdef HAVE_NATIVE_BACKEND
   {
@@ -366,21 +373,30 @@ check_for_wayland_session_type (void)
 static void
 init_backend (void)
 {
-  gboolean session_type_is_wayland = FALSE;
+#ifdef HAVE_WAYLAND
+  gboolean run_as_wayland_compositor = opt_wayland;
 
-#if defined(HAVE_WAYLAND) && defined(HAVE_NATIVE_BACKEND)
-  session_type_is_wayland = check_for_wayland_session_type ();
-#endif
+#ifdef HAVE_NATIVE_BACKEND
+  if (opt_nested && opt_display_server)
+    {
+      meta_warning ("Can't run both as nested and as a display server\n");
+      meta_exit (META_EXIT_ERROR);
+    }
 
-#if defined(CLUTTER_WINDOWING_EGL) && defined(HAVE_NATIVE_BACKEND)
-  if (opt_display_server || session_type_is_wayland)
+  if (!run_as_wayland_compositor)
+    run_as_wayland_compositor = check_for_wayland_session_type ();
+
+#ifdef CLUTTER_WINDOWING_EGL
+  if (opt_display_server || (run_as_wayland_compositor && !opt_nested))
     clutter_set_windowing_backend (CLUTTER_WINDOWING_EGL);
   else
 #endif
+#endif
+#endif
     clutter_set_windowing_backend (CLUTTER_WINDOWING_X11);
 
 #ifdef HAVE_WAYLAND
-  meta_set_is_wayland_compositor (opt_wayland || session_type_is_wayland);
+  meta_set_is_wayland_compositor (run_as_wayland_compositor);
 #endif
 }
 


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