mirror of
https://github.com/brl/mutter.git
synced 2025-06-13 16:59:30 +00:00
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
This commit is contained in:

committed by
Carlos Garnacho

parent
e8949292c1
commit
7ef32f747b
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user