wayland: Guard XWayland types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
This commit is contained in:
Bilal Elmoussaoui 2022-06-01 10:35:29 +02:00
parent 0f88f0931c
commit a27b9d9707
6 changed files with 19 additions and 2 deletions

View File

@ -934,12 +934,12 @@ meta_display_new (MetaContext *context,
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
{
#ifdef HAVE_XWAYLAND
MetaWaylandCompositor *wayland_compositor =
wayland_compositor_from_display (display);
meta_wayland_compositor_init_display (wayland_compositor, display);
#ifdef HAVE_XWAYLAND
MetaX11DisplayPolicy x11_display_policy;
x11_display_policy = meta_context_get_x11_display_policy (context);

View File

@ -613,7 +613,9 @@ meta_test_client_new (MetaContext *context,
ClientProcessHandler *process_handler;
MetaWaylandCompositor *compositor;
const char *wayland_display_name;
#ifdef HAVE_XWAYLAND
const char *x11_display_name;
#endif
launcher = g_subprocess_launcher_new ((G_SUBPROCESS_FLAGS_STDIN_PIPE |
G_SUBPROCESS_FLAGS_STDOUT_PIPE));
@ -621,8 +623,9 @@ meta_test_client_new (MetaContext *context,
g_assert (meta_is_wayland_compositor ());
compositor = meta_context_get_wayland_compositor (context);
wayland_display_name = meta_wayland_get_wayland_display_name (compositor);
#ifdef HAVE_XWAYLAND
x11_display_name = meta_wayland_get_public_xwayland_display_name (compositor);
#endif
if (wayland_display_name)
{
g_subprocess_launcher_setenv (launcher,
@ -630,12 +633,14 @@ meta_test_client_new (MetaContext *context,
TRUE);
}
#ifdef HAVE_XWAYLAND
if (x11_display_name)
{
g_subprocess_launcher_setenv (launcher,
"DISPLAY", x11_display_name,
TRUE);
}
#endif
subprocess = g_subprocess_launcher_spawn (launcher,
error,

View File

@ -474,8 +474,10 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
* associate the X11 Window with the wl_surface.
* For subsurfaces the window of the ancestor might be gone already.
*/
#ifdef HAVE_XWAYLAND
g_warn_if_fail (meta_xwayland_is_xwayland_surface (constraint->surface) ||
META_IS_WAYLAND_SUBSURFACE (constraint->surface->role));
#endif
return FALSE;
}
#endif

View File

@ -92,7 +92,9 @@ struct _MetaWaylandCompositor
GHashTable *outputs;
GList *frame_callback_surfaces;
#ifdef HAVE_XWAYLAND
MetaXWaylandManager xwayland_manager;
#endif
MetaWaylandSeat *seat;
MetaWaylandTabletManager *tablet_manager;

View File

@ -894,6 +894,7 @@ meta_wayland_get_wayland_display_name (MetaWaylandCompositor *compositor)
return compositor->display_name;
}
#ifdef HAVE_XWAYLAND
const char *
meta_wayland_get_public_xwayland_display_name (MetaWaylandCompositor *compositor)
{
@ -905,6 +906,7 @@ meta_wayland_get_private_xwayland_display_name (MetaWaylandCompositor *composito
{
return compositor->xwayland_manager.private_connection.name;
}
#endif /* HAVE_XWAYLAND */
void
meta_wayland_compositor_restore_shortcuts (MetaWaylandCompositor *compositor,
@ -1004,7 +1006,9 @@ meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
GINT_TO_POINTER (id));
if (window)
{
#ifdef HAVE_XWAYLAND
meta_xwayland_associate_window_with_surface (window, surface);
#endif
meta_wayland_compositor_remove_surface_association (compositor, id);
}
}

View File

@ -72,10 +72,12 @@ GQueue *meta_wayland_compositor_get_committed_transactions (Meta
META_EXPORT_TEST
const char *meta_wayland_get_wayland_display_name (MetaWaylandCompositor *compositor);
#ifdef HAVE_XWAYLAND
META_EXPORT_TEST
const char *meta_wayland_get_public_xwayland_display_name (MetaWaylandCompositor *compositor);
const char *meta_wayland_get_private_xwayland_display_name (MetaWaylandCompositor *compositor);
#endif
void meta_wayland_compositor_restore_shortcuts (MetaWaylandCompositor *compositor,
ClutterInputDevice *source);
@ -94,8 +96,10 @@ void meta_wayland_compositor_notify_surface_id (MetaWaylandCo
int id,
MetaWaylandSurface *surface);
#ifdef HAVE_XWAYLAND
META_EXPORT_TEST
MetaXWaylandManager * meta_wayland_compositor_get_xwayland_manager (MetaWaylandCompositor *compositor);
#endif
#endif