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
This commit is contained in:
Jonas Ådahl 2020-10-20 21:38:05 +02:00 committed by Florian Müllner
parent de610a13f1
commit cd52288ddc
2 changed files with 17 additions and 1 deletions

View File

@ -201,6 +201,7 @@ static gboolean opt_sync;
static gboolean opt_wayland; static gboolean opt_wayland;
static gboolean opt_nested; static gboolean opt_nested;
static gboolean opt_no_x11; static gboolean opt_no_x11;
static char *opt_wayland_display;
#endif #endif
#ifdef HAVE_NATIVE_BACKEND #ifdef HAVE_NATIVE_BACKEND
static gboolean opt_display_server; static gboolean opt_display_server;
@ -262,6 +263,12 @@ static GOptionEntry meta_options[] = {
N_("Run wayland compositor without starting Xwayland"), N_("Run wayland compositor without starting Xwayland"),
NULL NULL
}, },
{
"wayland-display", 0, 0, G_OPTION_ARG_STRING,
&opt_wayland_display,
N_("Specify Wayland display name to use"),
NULL
},
#endif #endif
#ifdef HAVE_NATIVE_BACKEND #ifdef HAVE_NATIVE_BACKEND
{ {
@ -608,7 +615,14 @@ meta_init (void)
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
if (compositor_type == META_COMPOSITOR_TYPE_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 #endif
if (g_get_home_dir ()) if (g_get_home_dir ())

View File

@ -487,6 +487,8 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
compositor->display_name = g_strdup (display_name); 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) if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED)
{ {
set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name); set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name);