From c22bee19e1461dd3a899dfa8c80c1ffc88ed5381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 26 Nov 2015 15:02:20 +0800 Subject: [PATCH] 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 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 2a23c157a..c99ede565 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 }