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
This commit is contained in:
Jonas Ådahl 2016-05-25 22:12:48 +08:00
parent dd1eaeb262
commit feb4c36659

View File

@ -167,6 +167,7 @@ static gchar *opt_client_id;
static gboolean opt_replace_wm; static gboolean opt_replace_wm;
static gboolean opt_disable_sm; static gboolean opt_disable_sm;
static gboolean opt_sync; static gboolean opt_sync;
static gboolean opt_x11;
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
static gboolean opt_wayland; static gboolean opt_wayland;
static gboolean opt_nested; static gboolean opt_nested;
@ -211,6 +212,12 @@ static GOptionEntry meta_options[] = {
N_("Make X calls synchronous"), N_("Make X calls synchronous"),
NULL NULL
}, },
{
"x11", 0, 0, G_OPTION_ARG_NONE,
&opt_x11,
N_("Run as a X11 compositing manager"),
NULL
},
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
{ {
"wayland", 0, 0, G_OPTION_ARG_NONE, "wayland", 0, 0, G_OPTION_ARG_NONE,
@ -376,20 +383,34 @@ calculate_compositor_configuration (MetaCompositorType *compositor_type,
MetaBackendType *backend_type) MetaBackendType *backend_type)
{ {
#ifdef HAVE_WAYLAND #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 #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) if (opt_nested && opt_display_server)
{ {
meta_warning ("Can't run both as nested and as a display server\n"); meta_warning ("Can't run both as nested and as a display server\n");
meta_exit (META_EXIT_ERROR); 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 (); run_as_wayland_compositor = check_for_wayland_session_type ();
#ifdef CLUTTER_WINDOWING_EGL #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; *backend_type = META_BACKEND_TYPE_NATIVE;
else else
#endif #endif