[mutter] main: Add --x11 command line argument



commit feb4c36659bd1ed0d545424b8f5213120ade19c2
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed May 25 22:12:48 2016 +0800

    main: Add --x11 command line argument
    
    Make it possible to force mutter to start as a X11 compositing/window
    manager. This is needed when intending to start mutter as an X11 window
    manager while running inside a Wayland session, for example when
    intending to debug it in Xephyr.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768976

 src/core/main.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index c0a7aa5..063a101 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -167,6 +167,7 @@ static gchar    *opt_client_id;
 static gboolean  opt_replace_wm;
 static gboolean  opt_disable_sm;
 static gboolean  opt_sync;
+static gboolean  opt_x11;
 #ifdef HAVE_WAYLAND
 static gboolean  opt_wayland;
 static gboolean  opt_nested;
@@ -211,6 +212,12 @@ static GOptionEntry meta_options[] = {
     N_("Make X calls synchronous"),
     NULL
   },
+  {
+    "x11", 0, 0, G_OPTION_ARG_NONE,
+    &opt_x11,
+    N_("Run as a X11 compositing manager"),
+    NULL
+  },
 #ifdef HAVE_WAYLAND
   {
     "wayland", 0, 0, G_OPTION_ARG_NONE,
@@ -376,20 +383,34 @@ calculate_compositor_configuration (MetaCompositorType *compositor_type,
                                     MetaBackendType    *backend_type)
 {
 #ifdef HAVE_WAYLAND
-  gboolean run_as_wayland_compositor = opt_wayland;
+  gboolean run_as_wayland_compositor;
+
+  if (opt_x11 && opt_nested)
+    {
+      meta_warning ("Can't run both as a Wayland compositor and a X11 compositing manager\n");
+      meta_exit (META_EXIT_ERROR);
+    }
+
+  run_as_wayland_compositor = opt_wayland || !opt_x11;
 
 #ifdef HAVE_NATIVE_BACKEND
+  if (opt_x11 && opt_display_server)
+    {
+      meta_warning ("Can't run both as a Wayland compositor and a X11 compositing manager\n");
+      meta_exit (META_EXIT_ERROR);
+    }
+
   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 (!run_as_wayland_compositor)
+  if (!run_as_wayland_compositor && !opt_x11)
     run_as_wayland_compositor = check_for_wayland_session_type ();
 
 #ifdef CLUTTER_WINDOWING_EGL
-  if (opt_display_server || (run_as_wayland_compositor && !opt_nested))
+  if (opt_display_server || (run_as_wayland_compositor && !opt_nested && !opt_x11))
     *backend_type = META_BACKEND_TYPE_NATIVE;
   else
 #endif


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