[mutter] wayland: Allow specifying Wayland display name from command line



commit cd52288ddcfd922510cc952437c777221816dc55
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Oct 20 21:38:05 2020 +0200

    wayland: Allow specifying Wayland display name from command line
    
    Useful to avoid warnings when starting when there is already an active
    Wayland compositor in the session.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1515

 src/core/main.c            | 16 +++++++++++++++-
 src/wayland/meta-wayland.c |  2 ++
 2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index db1805ea61..e68f3c9edd 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -201,6 +201,7 @@ static gboolean  opt_sync;
 static gboolean  opt_wayland;
 static gboolean  opt_nested;
 static gboolean  opt_no_x11;
+static char     *opt_wayland_display;
 #endif
 #ifdef HAVE_NATIVE_BACKEND
 static gboolean  opt_display_server;
@@ -262,6 +263,12 @@ static GOptionEntry meta_options[] = {
     N_("Run wayland compositor without starting Xwayland"),
     NULL
   },
+  {
+    "wayland-display", 0, 0, G_OPTION_ARG_STRING,
+    &opt_wayland_display,
+    N_("Specify Wayland display name to use"),
+    NULL
+  },
 #endif
 #ifdef HAVE_NATIVE_BACKEND
   {
@@ -608,7 +615,14 @@ meta_init (void)
 
 #ifdef HAVE_WAYLAND
   if (compositor_type == META_COMPOSITOR_TYPE_WAYLAND)
-    meta_set_is_wayland_compositor (TRUE);
+    {
+      meta_set_is_wayland_compositor (TRUE);
+      if (opt_wayland_display)
+        {
+          meta_wayland_override_display_name (opt_wayland_display);
+          g_free (opt_wayland_display);
+        }
+    }
 #endif
 
   if (g_get_home_dir ())
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 8d346cbd71..fe52a03e3e 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -487,6 +487,8 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
       compositor->display_name = g_strdup (display_name);
     }
 
+  g_message ("Using Wayland display name '%s'", compositor->display_name);
+
   if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED)
     {
       set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name);


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