[mutter/wip/xwayland-on-demand: 28/32] Add --no-x11 flag so mutter wayland can be started without X11
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/xwayland-on-demand: 28/32] Add --no-x11 flag so mutter wayland can be started without X11
- Date: Mon, 28 Aug 2017 02:54:02 +0000 (UTC)
commit 7d2ef2d8211927f8f487b8fae207d5fdaabbb3c7
Author: Armin Krezović <krezovic armin gmail com>
Date: Sun Aug 27 20:44:58 2017 +0200
Add --no-x11 flag so mutter wayland can be started without X11
src/core/display.c | 18 +++++++++++++-----
src/core/main-private.h | 2 ++
src/core/main.c | 26 ++++++++++++++++++++++++++
src/wayland/meta-wayland.c | 9 +++++++--
4 files changed, 48 insertions(+), 7 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 127d657..79d7689 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -35,6 +35,7 @@
#include "events.h"
#include "util-private.h"
#include <meta/main.h>
+#include "main-private.h"
#include "window-private.h"
#include "boxes-private.h"
#include "frame.h"
@@ -814,12 +815,19 @@ meta_display_open (void)
display->bell = NULL;
meta_bell_new (display);
- x11_display = meta_x11_display_new (display, &error);
- g_assert (x11_display != NULL); /* Required, for now */
- display->x11_display = x11_display;
- g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0);
+ if (meta_should_autostart_x11_display ())
+ {
+ x11_display = meta_x11_display_new (display, &error);
+ g_assert (x11_display != NULL); /* Required, for now */
+ display->x11_display = x11_display;
+ g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0);
- timestamp = display->x11_display->timestamp;
+ timestamp = display->x11_display->timestamp;
+ }
+ else
+ {
+ timestamp = meta_display_get_current_time_roundtrip (display);
+ }
display->last_focus_time = timestamp;
display->last_user_time = timestamp;
diff --git a/src/core/main-private.h b/src/core/main-private.h
index 36f4b31..e59b766 100644
--- a/src/core/main-private.h
+++ b/src/core/main-private.h
@@ -31,4 +31,6 @@ typedef enum _MetaCompositorType
void meta_override_compositor_configuration (MetaCompositorType compositor_type,
GType backend_gtype);
+gboolean meta_should_autostart_x11_display (void);
+
#endif /* META_MAIN_PRIVATE_H */
diff --git a/src/core/main.c b/src/core/main.c
index c3632b5..82fcf75 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -177,6 +177,7 @@ static gboolean opt_sync;
#ifdef HAVE_WAYLAND
static gboolean opt_wayland;
static gboolean opt_nested;
+static gboolean opt_no_x11;
#endif
#ifdef HAVE_NATIVE_BACKEND
static gboolean opt_display_server;
@@ -231,6 +232,12 @@ static GOptionEntry meta_options[] = {
N_("Run as a nested compositor"),
NULL
},
+ {
+ "no-x11", 0, 0, G_OPTION_ARG_NONE,
+ &opt_no_x11,
+ N_("Run wayland compositor without starting Xwayland"),
+ NULL
+ },
#endif
#ifdef HAVE_NATIVE_BACKEND
{
@@ -437,6 +444,12 @@ calculate_compositor_configuration (MetaCompositorType *compositor_type,
run_as_wayland_compositor = check_for_wayland_session_type ();
#endif /* HAVE_NATIVE_BACKEND */
+ if (!run_as_wayland_compositor && opt_no_x11)
+ {
+ meta_warning ("Can't disable X11 support on X11 compositor\n");
+ meta_exit (META_EXIT_ERROR);
+ }
+
if (run_as_wayland_compositor)
*compositor_type = META_COMPOSITOR_TYPE_WAYLAND;
else
@@ -693,3 +706,16 @@ prefs_changed_callback (MetaPreference pref,
break;
}
}
+
+gboolean
+meta_should_autostart_x11_display (void)
+{
+ MetaBackend *backend = meta_get_backend ();
+ gboolean is_x11 = TRUE;
+
+#ifdef HAVE_WAYLAND
+ is_x11 = !opt_no_x11;
+#endif
+
+ return META_IS_BACKEND_X11_CM (backend) || is_x11;
+}
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 414c7fb..dd48b52 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -45,6 +45,8 @@
#include "meta-wayland-inhibit-shortcuts.h"
#include "meta-wayland-inhibit-shortcuts-dialog.h"
+#include "main-private.h"
+
static MetaWaylandCompositor _meta_wayland_compositor;
static char *_display_name_override;
@@ -362,7 +364,8 @@ meta_wayland_init (void)
meta_wayland_keyboard_shortcuts_inhibit_init (compositor);
meta_wayland_surface_inhibit_shortcuts_dialog_init ();
- if (!meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display))
+ if (meta_should_autostart_x11_display () &&
+ !meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display))
g_error ("Failed to start X Wayland");
if (_display_name_override)
@@ -383,7 +386,9 @@ meta_wayland_init (void)
g_error ("Failed to create socket");
}
- set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
+ if (meta_should_autostart_x11_display ())
+ set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
+
set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]