build: Allow disabling xwayland
Mostly moving things around to allow a build without xwayland. Note that more work might still be needed once the x11 build option lands as that would allow us to have a proper xwayland only build without the x server part. Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2272 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2399>
This commit is contained in:
parent
7eb9797b84
commit
6e818c8c38
14 changed files with 96 additions and 29 deletions
|
@ -132,7 +132,7 @@ lcms2_dep = dependency('lcms2', version: lcms2_req)
|
|||
have_wayland = get_option('wayland')
|
||||
# For now always require X11 support
|
||||
have_x11 = true
|
||||
have_xwayland = have_wayland # for now default to have_wayland
|
||||
have_xwayland = get_option('xwayland')
|
||||
have_x11_client = have_x11 or have_xwayland
|
||||
|
||||
if have_xwayland and not have_wayland
|
||||
|
|
|
@ -39,6 +39,12 @@ option('wayland',
|
|||
description: 'Enable Wayland support'
|
||||
)
|
||||
|
||||
option('xwayland',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
description: 'Enable Xwayland support'
|
||||
)
|
||||
|
||||
option('systemd',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
|
|
|
@ -81,9 +81,17 @@
|
|||
#ifdef HAVE_WAYLAND
|
||||
#include "compositor/meta-compositor-native.h"
|
||||
#include "compositor/meta-compositor-server.h"
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#include "wayland/meta-wayland.h"
|
||||
#include "wayland/meta-wayland-input-device.h"
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
#include "wayland/meta-wayland-tablet-seat.h"
|
||||
#include "wayland/meta-wayland-tablet-pad.h"
|
||||
#include "wayland/meta-wayland-tablet-manager.h"
|
||||
#include "wayland/meta-wayland-touch.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
|
@ -770,6 +778,7 @@ meta_display_init_x11_finish (MetaDisplay *display,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
static void
|
||||
on_xserver_started (MetaXWaylandManager *manager,
|
||||
GAsyncResult *result,
|
||||
|
@ -798,6 +807,7 @@ on_xserver_started (MetaXWaylandManager *manager,
|
|||
g_task_return_boolean (task, TRUE);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_XWAYLAND */
|
||||
|
||||
void
|
||||
meta_display_init_x11 (MetaDisplay *display,
|
||||
|
@ -805,17 +815,22 @@ meta_display_init_x11 (MetaDisplay *display,
|
|||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = wayland_compositor_from_display (display);
|
||||
|
||||
g_autoptr (GTask) task = NULL;
|
||||
#ifdef HAVE_XWAYLAND
|
||||
MetaWaylandCompositor *compositor;
|
||||
#endif
|
||||
|
||||
task = g_task_new (display, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (task, meta_display_init_x11);
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
compositor = wayland_compositor_from_display (display);
|
||||
|
||||
meta_xwayland_start_xserver (&compositor->xwayland_manager,
|
||||
cancellable,
|
||||
(GAsyncReadyCallback) on_xserver_started,
|
||||
g_steal_pointer (&task));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -94,6 +94,9 @@
|
|||
#include "wayland/meta-wayland-private.h"
|
||||
#include "wayland/meta-wayland-surface.h"
|
||||
#include "wayland/meta-window-wayland.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-window-xwayland.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,7 +31,10 @@
|
|||
#include "wayland/meta-wayland-buffer.h"
|
||||
#include "wayland/meta-wayland-surface.h"
|
||||
#include "wayland/meta-window-wayland.h"
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland-surface.h"
|
||||
#endif
|
||||
|
||||
typedef struct _MetaWaylandActorSurfacePrivate MetaWaylandActorSurfacePrivate;
|
||||
|
||||
|
@ -225,6 +228,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
|
|||
meta_surface_actor_set_input_region (surface_actor, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (!META_IS_XWAYLAND_SURFACE (surface_role))
|
||||
{
|
||||
if (!meta_shaped_texture_has_alpha (stex))
|
||||
|
@ -249,6 +253,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
|
|||
meta_surface_actor_set_opaque_region (surface_actor, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
meta_shaped_texture_set_transform (stex, surface->buffer_transform);
|
||||
|
||||
|
|
|
@ -31,7 +31,10 @@
|
|||
#include "wayland/meta-wayland-buffer.h"
|
||||
#include "wayland/meta-wayland-presentation-time-private.h"
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland.h"
|
||||
#endif
|
||||
|
||||
typedef struct _MetaWaylandCursorSurfacePrivate MetaWaylandCursorSurfacePrivate;
|
||||
|
||||
|
@ -89,6 +92,7 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
|||
MetaWaylandSurfaceRole *role = META_WAYLAND_SURFACE_ROLE (cursor_surface);
|
||||
MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (role);
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (!meta_xwayland_is_xwayland_surface (surface))
|
||||
{
|
||||
MetaWaylandSurfaceRole *surface_role =
|
||||
|
@ -119,6 +123,8 @@ cursor_sprite_prepare_at (MetaCursorSprite *cursor_sprite,
|
|||
surface->buffer_transform);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
meta_wayland_surface_update_outputs (surface);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,10 @@
|
|||
#include "wayland/meta-wayland-seat.h"
|
||||
#include "wayland/meta-wayland-subsurface.h"
|
||||
#include "wayland/meta-wayland-surface.h"
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland.h"
|
||||
#endif
|
||||
|
||||
#include "pointer-constraints-unstable-v1-server-protocol.h"
|
||||
|
||||
|
@ -158,6 +161,7 @@ connect_window (MetaWaylandSurfacePointerConstraintsData *data,
|
|||
G_CALLBACK (window_raised), NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
static void
|
||||
window_associated (MetaWaylandSurfaceRole *surface_role,
|
||||
MetaWaylandSurfacePointerConstraintsData *data)
|
||||
|
@ -171,6 +175,7 @@ window_associated (MetaWaylandSurfaceRole *surface_role,
|
|||
|
||||
meta_wayland_pointer_constraint_maybe_enable_for_window (window);
|
||||
}
|
||||
#endif
|
||||
|
||||
static MetaWaylandSurfacePointerConstraintsData *
|
||||
surface_constraint_data_new (MetaWaylandSurface *surface)
|
||||
|
@ -187,6 +192,7 @@ surface_constraint_data_new (MetaWaylandSurface *surface)
|
|||
{
|
||||
connect_window (data, window);
|
||||
}
|
||||
#ifdef HAVE_XWAYLAND
|
||||
else if (meta_xwayland_is_xwayland_surface (surface))
|
||||
{
|
||||
data->window_associated_handler_id =
|
||||
|
@ -194,6 +200,7 @@ surface_constraint_data_new (MetaWaylandSurface *surface)
|
|||
G_CALLBACK (window_associated),
|
||||
data);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
g_warn_if_reached ();
|
||||
|
@ -459,6 +466,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
|||
MetaWindow *window;
|
||||
|
||||
window = meta_wayland_surface_get_window (constraint->surface);
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (!window)
|
||||
{
|
||||
/*
|
||||
|
@ -470,6 +478,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
|||
META_IS_WAYLAND_SUBSURFACE (constraint->surface->role));
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (window->unmanaging)
|
||||
return FALSE;
|
||||
|
@ -477,6 +486,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
|||
if (constraint->seat->pointer->focus_surface != constraint->surface)
|
||||
return FALSE;
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (meta_xwayland_is_xwayland_surface (constraint->surface))
|
||||
{
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
|
@ -499,11 +509,10 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
|
|||
display->focus_window->client_type != META_WINDOW_CLIENT_TYPE_X11)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!meta_window_appears_focused (window))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!meta_window_appears_focused (window))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -621,7 +630,9 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo
|
|||
MetaFrame *frame = window->frame;
|
||||
int actual_width, actual_height;
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
g_assert (meta_xwayland_is_xwayland_surface (constraint->surface));
|
||||
#endif
|
||||
|
||||
actual_width = window->buffer_rect.width - (frame->child_x +
|
||||
frame->right_width);
|
||||
|
|
|
@ -62,7 +62,10 @@
|
|||
#include "wayland/meta-wayland-private.h"
|
||||
#include "wayland/meta-wayland-seat.h"
|
||||
#include "wayland/meta-wayland-surface.h"
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
#include "backends/native/meta-backend-native.h"
|
||||
|
|
|
@ -52,8 +52,10 @@
|
|||
#include "wayland/meta-wayland-viewporter.h"
|
||||
#include "wayland/meta-wayland-xdg-shell.h"
|
||||
#include "wayland/meta-window-wayland.h"
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -1533,7 +1535,9 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor,
|
|||
|
||||
wl_list_init (&surface->presentation_time.feedback_list);
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
meta_wayland_compositor_notify_surface_id (compositor, id, surface);
|
||||
#endif
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -50,9 +50,12 @@
|
|||
#include "wayland/meta-wayland-tablet-manager.h"
|
||||
#include "wayland/meta-wayland-transaction.h"
|
||||
#include "wayland/meta-wayland-xdg-foreign.h"
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland-grab-keyboard.h"
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#include "wayland/meta-xwayland.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
#include "backends/native/meta-renderer-native.h"
|
||||
|
@ -409,7 +412,9 @@ void
|
|||
meta_wayland_compositor_init_display (MetaWaylandCompositor *compositor,
|
||||
MetaDisplay *display)
|
||||
{
|
||||
#ifdef HAVE_XWAYLAND
|
||||
meta_xwayland_init_display (&compositor->xwayland_manager, display);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void meta_wayland_log_func (const char *, va_list) G_GNUC_PRINTF (1, 0);
|
||||
|
@ -426,12 +431,14 @@ meta_wayland_log_func (const char *fmt,
|
|||
void
|
||||
meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
#ifdef HAVE_XWAYLAND
|
||||
MetaX11DisplayPolicy x11_display_policy;
|
||||
|
||||
x11_display_policy =
|
||||
meta_context_get_x11_display_policy (compositor->context);
|
||||
if (x11_display_policy != META_X11_DISPLAY_POLICY_DISABLED)
|
||||
meta_xwayland_shutdown (&compositor->xwayland_manager);
|
||||
#endif
|
||||
|
||||
if (compositor->wayland_display)
|
||||
wl_display_destroy_clients (compositor->wayland_display);
|
||||
|
@ -487,6 +494,7 @@ meta_wayland_compositor_class_init (MetaWaylandCompositorClass *klass)
|
|||
object_class->finalize = meta_wayland_compositor_finalize;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
static bool
|
||||
meta_xwayland_global_filter (const struct wl_client *client,
|
||||
const struct wl_global *global,
|
||||
|
@ -503,6 +511,7 @@ meta_xwayland_global_filter (const struct wl_client *client,
|
|||
/* All others are visible to all clients */
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
meta_wayland_override_display_name (const char *display_name)
|
||||
|
@ -635,11 +644,13 @@ meta_wayland_compositor_new (MetaContext *context)
|
|||
meta_wayland_activation_init (compositor);
|
||||
meta_wayland_transaction_init (compositor);
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
/* Xwayland specific protocol, needs to be filtered out for all other clients */
|
||||
if (meta_xwayland_grab_keyboard_init (compositor))
|
||||
wl_display_set_global_filter (compositor->wayland_display,
|
||||
meta_xwayland_global_filter,
|
||||
compositor);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WAYLAND_EGLSTREAM
|
||||
{
|
||||
|
@ -664,6 +675,7 @@ meta_wayland_compositor_new (MetaContext *context)
|
|||
|
||||
x11_display_policy =
|
||||
meta_context_get_x11_display_policy (compositor->context);
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (x11_display_policy != META_X11_DISPLAY_POLICY_DISABLED)
|
||||
{
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
@ -674,6 +686,7 @@ meta_wayland_compositor_new (MetaContext *context)
|
|||
&error))
|
||||
g_error ("Failed to start X Wayland: %s", error->message);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_display_name_override)
|
||||
{
|
||||
|
@ -812,6 +825,7 @@ meta_wayland_compositor_schedule_surface_association (MetaWaylandCompositor *com
|
|||
GINT_TO_POINTER (id), window);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
void
|
||||
meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
|
||||
int id,
|
||||
|
@ -827,6 +841,7 @@ meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
|
|||
meta_wayland_compositor_remove_surface_association (compositor, id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
meta_wayland_compositor_is_egl_display_bound (MetaWaylandCompositor *compositor)
|
||||
|
@ -837,22 +852,16 @@ meta_wayland_compositor_is_egl_display_bound (MetaWaylandCompositor *compositor)
|
|||
return priv->is_wayland_egl_display_bound;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
MetaXWaylandManager *
|
||||
meta_wayland_compositor_get_xwayland_manager (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
return &compositor->xwayland_manager;
|
||||
}
|
||||
#endif
|
||||
|
||||
MetaContext *
|
||||
meta_wayland_compositor_get_context (MetaWaylandCompositor *compositor)
|
||||
{
|
||||
return compositor->context;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_wayland_compositor_handle_xwayland_xevent (MetaWaylandCompositor *compositor,
|
||||
XEvent *xevent)
|
||||
{
|
||||
return meta_xwayland_manager_handle_xevent (&compositor->xwayland_manager,
|
||||
xevent);
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ void meta_wayland_compositor_schedule_surface_association (Me
|
|||
int id,
|
||||
MetaWindow *window);
|
||||
|
||||
#ifdef HAVE_XWAYLAND
|
||||
void meta_wayland_compositor_notify_surface_id (MetaWaylandCompositor *compositor,
|
||||
int id,
|
||||
MetaWaylandSurface *surface);
|
||||
|
@ -96,10 +97,10 @@ void meta_wayland_compositor_notify_surface_id (MetaWaylandCo
|
|||
META_EXPORT_TEST
|
||||
MetaXWaylandManager * meta_wayland_compositor_get_xwayland_manager (MetaWaylandCompositor *compositor);
|
||||
|
||||
#endif
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaContext * meta_wayland_compositor_get_context (MetaWaylandCompositor *compositor);
|
||||
|
||||
gboolean meta_wayland_compositor_handle_xwayland_xevent (MetaWaylandCompositor *compositor,
|
||||
XEvent *event);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "meta/main.h"
|
||||
#include "meta/meta-backend.h"
|
||||
#include "meta/meta-x11-errors.h"
|
||||
#include "wayland/meta-xwayland-grab-keyboard.h"
|
||||
#include "wayland/meta-xwayland-surface.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
|
||||
|
@ -71,6 +72,7 @@ static void meta_xwayland_stop_xserver (MetaXWaylandManager *manager);
|
|||
static void
|
||||
meta_xwayland_set_primary_output (MetaX11Display *x11_display);
|
||||
|
||||
|
||||
static MetaMonitorManager *
|
||||
monitor_manager_from_x11_display (MetaX11Display *x11_display)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "x11/window-x11-private.h"
|
||||
#include "x11/xprops.h"
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#include "wayland/meta-xwayland.h"
|
||||
|
@ -1659,7 +1659,7 @@ handle_other_xevent (MetaX11Display *x11_display,
|
|||
case ClientMessage:
|
||||
if (window)
|
||||
{
|
||||
#ifdef HAVE_WAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (event->xclient.message_type == x11_display->atom_WL_SURFACE_ID)
|
||||
{
|
||||
guint32 surface_id = event->xclient.data.l[0];
|
||||
|
@ -1889,7 +1889,7 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
|
|||
gboolean bypass_compositor = FALSE, bypass_gtk = FALSE;
|
||||
XIEvent *input_event;
|
||||
MetaCursorTracker *cursor_tracker;
|
||||
#ifdef HAVE_WAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
MetaWaylandCompositor *wayland_compositor;
|
||||
#endif
|
||||
|
||||
|
@ -1906,10 +1906,12 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
|
|||
goto out;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
wayland_compositor = meta_context_get_wayland_compositor (context);
|
||||
if (wayland_compositor &&
|
||||
meta_wayland_compositor_handle_xwayland_xevent (wayland_compositor, event))
|
||||
|
||||
if (meta_is_wayland_compositor () &&
|
||||
meta_xwayland_manager_handle_xevent (&wayland_compositor->xwayland_manager,
|
||||
event))
|
||||
{
|
||||
bypass_gtk = bypass_compositor = TRUE;
|
||||
goto out;
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#include "x11/window-props.h"
|
||||
#include "x11/xprops.h"
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#endif
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ set_work_area_hint (MetaDisplay *display,
|
|||
static const char *
|
||||
get_display_name (MetaDisplay *display)
|
||||
{
|
||||
#ifdef HAVE_WAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaWaylandCompositor *compositor =
|
||||
meta_context_get_wayland_compositor (context);
|
||||
|
@ -1223,7 +1223,7 @@ meta_x11_display_new (MetaDisplay *display,
|
|||
|
||||
XSynchronize (xdisplay, meta_context_is_x11_sync (context));
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
MetaWaylandCompositor *compositor =
|
||||
|
|
Loading…
Reference in a new issue