[mutter/wip/carlosg/xwayland-on-demand: 11/15] wayland: Add setting/api to check the policy to set up the X11 display
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/xwayland-on-demand: 11/15] wayland: Add setting/api to check the policy to set up the X11 display
- Date: Thu, 1 Aug 2019 17:18:48 +0000 (UTC)
commit d8143f31c405d9ce768d65bfec2358241125c25a
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 24 20:59:28 2019 +0200
wayland: Add setting/api to check the policy to set up the X11 display
This replaces meta_should_autostart_x11_display(). The "on-demand" policy
is not honored yet.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
data/org.gnome.mutter.gschema.xml.in | 2 ++
src/backends/meta-settings-private.h | 1 +
src/backends/meta-settings.c | 2 ++
src/core/display.c | 2 +-
src/core/main-private.h | 9 ++++++++-
src/core/main.c | 22 +++++++++++++++++-----
src/wayland/meta-wayland.c | 4 ++--
7 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/data/org.gnome.mutter.gschema.xml.in b/data/org.gnome.mutter.gschema.xml.in
index e0a784a01..7d36c06bd 100644
--- a/data/org.gnome.mutter.gschema.xml.in
+++ b/data/org.gnome.mutter.gschema.xml.in
@@ -124,6 +124,8 @@
real-time scheduling. The executable
or user must have CAP_SYS_NICE.
Requires a restart.
+ • “autostart-xwayland” — initializes Xwayland lazily if there are
+ X11 clients. Requires restart.
</description>
</key>
diff --git a/src/backends/meta-settings-private.h b/src/backends/meta-settings-private.h
index fe55b94f8..7d610d5b4 100644
--- a/src/backends/meta-settings-private.h
+++ b/src/backends/meta-settings-private.h
@@ -34,6 +34,7 @@ typedef enum _MetaExperimentalFeature
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS = (1 << 1),
META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2),
+ META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND = (1 << 3),
} MetaExperimentalFeature;
#define META_TYPE_SETTINGS (meta_settings_get_type ())
diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c
index e48a47933..66f826f51 100644
--- a/src/backends/meta-settings.c
+++ b/src/backends/meta-settings.c
@@ -266,6 +266,8 @@ experimental_features_handler (GVariant *features_variant,
features |= META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
else if (g_str_equal (feature, "rt-scheduler"))
features |= META_EXPERIMENTAL_FEATURE_RT_SCHEDULER;
+ else if (g_str_equal (feature, "autostart-xwayland"))
+ features |= META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND;
else
g_info ("Unknown experimental feature '%s'\n", feature);
}
diff --git a/src/core/display.c b/src/core/display.c
index ad8740582..37ef364e3 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -760,7 +760,7 @@ meta_display_open (void)
display->selection = meta_selection_new (display);
meta_clipboard_manager_init (display);
- if (meta_should_autostart_x11_display ())
+ if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY)
{
if (!meta_display_init_x11 (display, &error))
g_error ("Failed to start Xwayland: %s", error->message);
diff --git a/src/core/main-private.h b/src/core/main-private.h
index fc0d2d7cb..8b48103da 100644
--- a/src/core/main-private.h
+++ b/src/core/main-private.h
@@ -30,10 +30,17 @@ typedef enum _MetaCompositorType
META_COMPOSITOR_TYPE_X11,
} MetaCompositorType;
+typedef enum _MetaDisplayPolicy
+{
+ META_DISPLAY_POLICY_MANDATORY,
+ META_DISPLAY_POLICY_ON_DEMAND,
+ META_DISPLAY_POLICY_DISABLED,
+} MetaDisplayPolicy;
+
META_EXPORT_TEST
void meta_override_compositor_configuration (MetaCompositorType compositor_type,
GType backend_gtype);
-gboolean meta_should_autostart_x11_display (void);
+MetaDisplayPolicy meta_get_x11_display_policy (void);
#endif /* META_MAIN_PRIVATE_H */
diff --git a/src/core/main.c b/src/core/main.c
index 492c74a9d..b0d50d47b 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -717,15 +717,27 @@ prefs_changed_callback (MetaPreference pref,
}
}
-gboolean
-meta_should_autostart_x11_display (void)
+MetaDisplayPolicy
+meta_get_x11_display_policy (void)
{
MetaBackend *backend = meta_get_backend ();
- gboolean wants_x11 = TRUE;
+
+ if (META_IS_BACKEND_X11_CM (backend))
+ return META_DISPLAY_POLICY_MANDATORY;
#ifdef HAVE_WAYLAND
- wants_x11 = !opt_no_x11;
+ if (meta_is_wayland_compositor ())
+ {
+ MetaSettings *settings = meta_backend_get_settings (backend);
+
+ if (opt_no_x11)
+ return META_DISPLAY_POLICY_DISABLED;
+
+ if (meta_settings_is_experimental_feature_enabled (settings,
+ META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND))
+ return META_DISPLAY_POLICY_ON_DEMAND;
+ }
#endif
- return META_IS_BACKEND_X11_CM (backend) || wants_x11;
+ return META_DISPLAY_POLICY_MANDATORY;
}
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 0c0a613b8..806c897c9 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -418,7 +418,7 @@ meta_wayland_init (void)
meta_wayland_eglstream_controller_init (compositor);
#endif
- if (meta_should_autostart_x11_display ())
+ if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED)
{
if (!meta_xwayland_init (&compositor->xwayland_manager, compositor->wayland_display))
g_error ("Failed to start X Wayland");
@@ -443,7 +443,7 @@ meta_wayland_init (void)
compositor->display_name = g_strdup (display_name);
}
- if (meta_should_autostart_x11_display ())
+ if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED)
{
set_gnome_env ("DISPLAY", meta_wayland_get_xwayland_display_name (compositor));
set_gnome_env ("XAUTHORITY", meta_wayland_get_xwayland_auth_file (compositor));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]