summaryrefslogtreecommitdiff
path: root/src/wayland/meta-wayland-surface.c
diff options
context:
space:
mode:
authorBilal Elmoussaoui <belmouss@redhat.com>2022-06-01 10:45:20 +0200
committerBilal Elmoussaoui <belmouss@redhat.com>2023-05-15 20:41:54 +0200
commit02a436d607481492a37ad15fcc401abf6385eeff (patch)
treec01b511ad38bf923546b417bc4418032e46df69d /src/wayland/meta-wayland-surface.c
parenta27b9d9707b0c5ccfd6aec3e5f335937c1796429 (diff)
downloadmutter-02a436d607481492a37ad15fcc401abf6385eeff.tar.gz
wayland: Move surface check to MetaWaylandSurface
Allows dropping various HAVE_XWAYLAND ifdef as the function would always return false if Mutter is built without XWayland Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
Diffstat (limited to 'src/wayland/meta-wayland-surface.c')
-rw-r--r--src/wayland/meta-wayland-surface.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index abd5dae15..7e8a78d21 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -2396,3 +2396,17 @@ meta_wayland_surface_get_compositor (MetaWaylandSurface *surface)
{
return surface->compositor;
}
+
+gboolean
+meta_wayland_surface_is_xwayland (MetaWaylandSurface *surface)
+{
+#ifdef HAVE_XWAYLAND
+ MetaWaylandCompositor *compositor = surface->compositor;
+ MetaXWaylandManager *manager = &compositor->xwayland_manager;
+
+ return surface->resource != NULL &&
+ wl_resource_get_client (surface->resource) == manager->client;
+#else
+ return FALSE;
+#endif
+}