main: Add --x11 command line argument

This is in order to force running as a X11 window manager/compositing
manager. Useful for debugging and other cases where the automatic
detection does not work as expected.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/15
This commit is contained in:
Jonas Ådahl 2018-02-05 15:39:21 +08:00
parent 589e999049
commit 70fcf745b8

View File

@ -181,6 +181,7 @@ static gboolean opt_nested;
#ifdef HAVE_NATIVE_BACKEND #ifdef HAVE_NATIVE_BACKEND
static gboolean opt_display_server; static gboolean opt_display_server;
#endif #endif
static gboolean opt_x11;
static GOptionEntry meta_options[] = { static GOptionEntry meta_options[] = {
{ {
@ -239,6 +240,11 @@ static GOptionEntry meta_options[] = {
N_("Run as a full display server, rather than nested") N_("Run as a full display server, rather than nested")
}, },
#endif #endif
{
"x11", 0, 0, G_OPTION_ARG_NONE,
&opt_x11,
N_("Run with X11 backend")
},
{NULL} {NULL}
}; };
@ -424,7 +430,13 @@ calculate_compositor_configuration (MetaCompositorType *compositor_type,
GType *backend_gtype) GType *backend_gtype)
{ {
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
gboolean run_as_wayland_compositor = opt_wayland; gboolean run_as_wayland_compositor = opt_wayland && !opt_x11;
if ((opt_wayland || opt_nested || opt_display_server) && opt_x11)
{
meta_warning ("Can't run both as Wayland compositor and X11 compositing manager\n");
meta_exit (META_EXIT_ERROR);
}
#ifdef HAVE_NATIVE_BACKEND #ifdef HAVE_NATIVE_BACKEND
if (opt_nested && opt_display_server) if (opt_nested && opt_display_server)
@ -433,7 +445,7 @@ calculate_compositor_configuration (MetaCompositorType *compositor_type,
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 ();
#endif /* HAVE_NATIVE_BACKEND */ #endif /* HAVE_NATIVE_BACKEND */