aboutsummaryrefslogtreecommitdiff
path: root/client.h
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-06-06 22:50:50 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-06-06 22:51:58 -0500
commita5a0674f6a92bc47eed51fa5e08279d9d6b1b369 (patch)
treee1506defa63e3a9a431e6dc3cd77dd15a4c826ad /client.h
parent4dfa45659a6084cd3c800235040d83822f421afc (diff)
improve client_from_wlr_surface()
Diffstat (limited to 'client.h')
-rw-r--r--client.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/client.h b/client.h
index ec760ec..6791a4d 100644
--- a/client.h
+++ b/client.h
@@ -232,10 +232,22 @@ client_min_size(Client *c, int *width, int *height)
}
static inline Client *
-client_from_wlr_surface(struct wlr_surface *surface)
+client_from_wlr_surface(struct wlr_surface *s)
{
- struct wlr_scene_node *n = surface->data;
- return n ? n->data : NULL;
+ struct wlr_xdg_surface *surface;
+
+#ifdef XWAYLAND
+ struct wlr_xwayland_surface *xsurface;
+ if (s->role_data && wlr_surface_is_xwayland_surface(s)
+ && (xsurface = wlr_xwayland_surface_from_wlr_surface(s)))
+ return xsurface->data;
+#endif
+ if (s->role_data && wlr_surface_is_xdg_surface(s)
+ && (surface = wlr_xdg_surface_from_wlr_surface(s))
+ && surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
+ return surface->data;
+
+ return NULL;
}
static inline Client *