Rename MetaDisplayPolicy to MetaX11DisplayPolicy

This lack of X11 in the name was a bit confusing, since this is about
the X11 policy, not some policy of MetaDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
This commit is contained in:
Jonas Ådahl 2021-02-25 16:19:51 +01:00 committed by Marge Bot
parent f677e0cbfb
commit 6c1793b7d3
7 changed files with 27 additions and 27 deletions

View File

@ -890,7 +890,7 @@ meta_display_open (void)
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ()) if (meta_is_wayland_compositor ())
{ {
if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY) if (meta_get_x11_display_policy () == META_X11_DISPLAY_POLICY_MANDATORY)
{ {
meta_display_init_x11 (display, NULL, meta_display_init_x11 (display, NULL,
(GAsyncReadyCallback) on_x11_initialized, (GAsyncReadyCallback) on_x11_initialized,

View File

@ -30,12 +30,12 @@ typedef enum _MetaCompositorType
META_COMPOSITOR_TYPE_X11, META_COMPOSITOR_TYPE_X11,
} MetaCompositorType; } MetaCompositorType;
typedef enum _MetaDisplayPolicy typedef enum _MetaX11DisplayPolicy
{ {
META_DISPLAY_POLICY_MANDATORY, META_X11_DISPLAY_POLICY_MANDATORY,
META_DISPLAY_POLICY_ON_DEMAND, META_X11_DISPLAY_POLICY_ON_DEMAND,
META_DISPLAY_POLICY_DISABLED, META_X11_DISPLAY_POLICY_DISABLED,
} MetaDisplayPolicy; } MetaX11DisplayPolicy;
#define META_POINT_IN_RECT(xcoord, ycoord, rect) \ #define META_POINT_IN_RECT(xcoord, ycoord, rect) \
((xcoord) >= (rect).x && \ ((xcoord) >= (rect).x && \
@ -52,9 +52,9 @@ void meta_override_compositor_configuration (MetaCompositorType compositor_type,
...); ...);
META_EXPORT_TEST META_EXPORT_TEST
MetaDisplayPolicy meta_get_x11_display_policy (void); MetaX11DisplayPolicy meta_get_x11_display_policy (void);
META_EXPORT_TEST META_EXPORT_TEST
void meta_override_x11_display_policy (MetaDisplayPolicy x11_display_policy); void meta_override_x11_display_policy (MetaX11DisplayPolicy x11_display_policy);
#endif /* META_MAIN_PRIVATE_H */ #endif /* META_MAIN_PRIVATE_H */

View File

@ -906,21 +906,21 @@ meta_get_exit_code (void)
return meta_exit_code; return meta_exit_code;
} }
static MetaDisplayPolicy x11_display_policy_override = -1; static MetaX11DisplayPolicy x11_display_policy_override = -1;
void void
meta_override_x11_display_policy (MetaDisplayPolicy x11_display_policy) meta_override_x11_display_policy (MetaX11DisplayPolicy x11_display_policy)
{ {
x11_display_policy_override = x11_display_policy; x11_display_policy_override = x11_display_policy;
} }
MetaDisplayPolicy MetaX11DisplayPolicy
meta_get_x11_display_policy (void) meta_get_x11_display_policy (void)
{ {
MetaBackend *backend = meta_get_backend (); MetaBackend *backend = meta_get_backend ();
if (META_IS_BACKEND_X11_CM (backend)) if (META_IS_BACKEND_X11_CM (backend))
return META_DISPLAY_POLICY_MANDATORY; return META_X11_DISPLAY_POLICY_MANDATORY;
if (x11_display_policy_override != -1) if (x11_display_policy_override != -1)
return x11_display_policy_override; return x11_display_policy_override;
@ -933,18 +933,18 @@ meta_get_x11_display_policy (void)
#endif #endif
if (opt_no_x11) if (opt_no_x11)
return META_DISPLAY_POLICY_DISABLED; return META_X11_DISPLAY_POLICY_DISABLED;
#ifdef HAVE_XWAYLAND_INITFD #ifdef HAVE_XWAYLAND_INITFD
if (sd_pid_get_user_unit (0, &unit) < 0) if (sd_pid_get_user_unit (0, &unit) < 0)
return META_DISPLAY_POLICY_MANDATORY; return META_X11_DISPLAY_POLICY_MANDATORY;
else else
return META_DISPLAY_POLICY_ON_DEMAND; return META_X11_DISPLAY_POLICY_ON_DEMAND;
#endif #endif
} }
#endif #endif
return META_DISPLAY_POLICY_MANDATORY; return META_X11_DISPLAY_POLICY_MANDATORY;
} }
void void

View File

@ -51,7 +51,7 @@ init_common_pre (void)
"aborting...\n"); "aborting...\n");
meta_plugin_manager_load (test_get_plugin_name ()); meta_plugin_manager_load (test_get_plugin_name ());
meta_override_x11_display_policy (META_DISPLAY_POLICY_DISABLED); meta_override_x11_display_policy (META_X11_DISPLAY_POLICY_DISABLED);
meta_test_init (); meta_test_init ();
display = g_getenv ("DISPLAY"); display = g_getenv ("DISPLAY");

View File

@ -77,7 +77,7 @@ test_case_new (void)
TestCase *test = g_new0 (TestCase, 1); TestCase *test = g_new0 (TestCase, 1);
MetaDisplay *display = meta_get_display (); MetaDisplay *display = meta_get_display ();
if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY) if (meta_get_x11_display_policy () == META_X11_DISPLAY_POLICY_MANDATORY)
{ {
test_wait_for_x11_display (); test_wait_for_x11_display ();
on_x11_display_opened (display, test); on_x11_display_opened (display, test);

View File

@ -524,7 +524,7 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
meta_wayland_eglstream_controller_init (compositor); meta_wayland_eglstream_controller_init (compositor);
#endif #endif
if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED) if (meta_get_x11_display_policy () != META_X11_DISPLAY_POLICY_DISABLED)
{ {
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
@ -555,7 +555,7 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
g_message ("Using Wayland display name '%s'", compositor->display_name); g_message ("Using Wayland display name '%s'", compositor->display_name);
if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED) if (meta_get_x11_display_policy () != META_X11_DISPLAY_POLICY_DISABLED)
{ {
set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name); set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name);
set_gnome_env ("DISPLAY", compositor->xwayland_manager.public_connection.name); set_gnome_env ("DISPLAY", compositor->xwayland_manager.public_connection.name);

View File

@ -549,17 +549,17 @@ xserver_died (GObject *source,
} }
else if (!g_subprocess_get_successful (proc)) else if (!g_subprocess_get_successful (proc))
{ {
if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY) if (meta_get_x11_display_policy () == META_X11_DISPLAY_POLICY_MANDATORY)
g_warning ("X Wayland crashed; exiting"); g_warning ("X Wayland crashed; exiting");
else else
g_warning ("X Wayland crashed; attempting to recover"); g_warning ("X Wayland crashed; attempting to recover");
} }
if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY) if (meta_get_x11_display_policy () == META_X11_DISPLAY_POLICY_MANDATORY)
{ {
meta_exit (META_EXIT_ERROR); meta_exit (META_EXIT_ERROR);
} }
else if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND) else if (meta_get_x11_display_policy () == META_X11_DISPLAY_POLICY_ON_DEMAND)
{ {
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
@ -610,7 +610,7 @@ x_io_error (Display *display)
{ {
g_warning ("Connection to xwayland lost"); g_warning ("Connection to xwayland lost");
if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_MANDATORY) if (meta_get_x11_display_policy () == META_X11_DISPLAY_POLICY_MANDATORY)
meta_exit (META_EXIT_ERROR); meta_exit (META_EXIT_ERROR);
return 0; return 0;
@ -1141,7 +1141,7 @@ meta_xwayland_init (MetaXWaylandManager *manager,
struct wl_display *wl_display, struct wl_display *wl_display,
GError **error) GError **error)
{ {
MetaDisplayPolicy policy; MetaX11DisplayPolicy policy;
int display = 0; int display = 0;
if (display_number_override != -1) if (display_number_override != -1)
@ -1186,7 +1186,7 @@ meta_xwayland_init (MetaXWaylandManager *manager,
manager->wayland_display = wl_display; manager->wayland_display = wl_display;
policy = meta_get_x11_display_policy (); policy = meta_get_x11_display_policy ();
if (policy == META_DISPLAY_POLICY_ON_DEMAND) if (policy == META_X11_DISPLAY_POLICY_ON_DEMAND)
{ {
manager->abstract_fd_watch_id = manager->abstract_fd_watch_id =
g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN, g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN,
@ -1267,7 +1267,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
add_local_user_to_xhost (xdisplay); add_local_user_to_xhost (xdisplay);
meta_xwayland_init_xrandr (manager, xdisplay); meta_xwayland_init_xrandr (manager, xdisplay);
if (meta_get_x11_display_policy () == META_DISPLAY_POLICY_ON_DEMAND) if (meta_get_x11_display_policy () == META_X11_DISPLAY_POLICY_ON_DEMAND)
{ {
meta_xwayland_stop_xserver_timeout (manager); meta_xwayland_stop_xserver_timeout (manager);
g_signal_connect (meta_get_display (), "window-created", g_signal_connect (meta_get_display (), "window-created",