compositor/actor: Guard X11 actor usage

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
This commit is contained in:
Bilal Elmoussaoui 2024-01-22 17:01:34 +01:00 committed by Marge Bot
parent b6f38b21b7
commit 67e21e0881

View File

@ -26,13 +26,16 @@
#include "backends/meta-screen-cast-window.h" #include "backends/meta-screen-cast-window.h"
#include "compositor/compositor-private.h" #include "compositor/compositor-private.h"
#include "compositor/meta-shaped-texture-private.h" #include "compositor/meta-shaped-texture-private.h"
#include "compositor/meta-surface-actor-x11.h"
#include "compositor/meta-surface-actor.h" #include "compositor/meta-surface-actor.h"
#include "compositor/meta-window-actor-private.h" #include "compositor/meta-window-actor-private.h"
#include "core/boxes-private.h" #include "core/boxes-private.h"
#include "core/window-private.h" #include "core/window-private.h"
#include "meta/window.h" #include "meta/window.h"
#ifdef HAVE_X11_CLIENT
#include "compositor/meta-surface-actor-x11.h"
#endif
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
#include "compositor/meta-surface-actor-wayland.h" #include "compositor/meta-surface-actor-wayland.h"
#include "wayland/meta-wayland-surface-private.h" #include "wayland/meta-wayland-surface-private.h"
@ -492,12 +495,14 @@ init_surface_actor (MetaWindowActor *self)
MetaWindow *window = priv->window; MetaWindow *window = priv->window;
MetaSurfaceActor *surface_actor = NULL; MetaSurfaceActor *surface_actor = NULL;
#ifdef HAVE_X11_CLIENT
if (!meta_is_wayland_compositor ()) if (!meta_is_wayland_compositor ())
{ {
surface_actor = meta_surface_actor_x11_new (window); surface_actor = meta_surface_actor_x11_new (window);
} }
#ifdef HAVE_WAYLAND
else else
#endif
#ifdef HAVE_WAYLAND
{ {
MetaWaylandSurface *surface = meta_window_get_wayland_surface (window); MetaWaylandSurface *surface = meta_window_get_wayland_surface (window);
surface_actor = surface ? meta_wayland_surface_get_actor (surface) : NULL; surface_actor = surface ? meta_wayland_surface_get_actor (surface) : NULL;
@ -948,10 +953,11 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
/* When running as a Wayland compositor we catch size changes when new /* When running as a Wayland compositor we catch size changes when new
* buffers are attached */ * buffers are attached */
#ifdef HAVE_X11_CLIENT
if (META_IS_SURFACE_ACTOR_X11 (priv->surface)) if (META_IS_SURFACE_ACTOR_X11 (priv->surface))
meta_surface_actor_x11_set_size (META_SURFACE_ACTOR_X11 (priv->surface), meta_surface_actor_x11_set_size (META_SURFACE_ACTOR_X11 (priv->surface),
actor_rect.width, actor_rect.height); actor_rect.width, actor_rect.height);
#endif
/* Normally we want freezing a window to also freeze its position; this allows /* Normally we want freezing a window to also freeze its position; this allows
* windows to atomically move and resize together, either under app control, * windows to atomically move and resize together, either under app control,
* or because the user is resizing from the left/top. But on initial placement * or because the user is resizing from the left/top. But on initial placement