fixes #272
2B3SWBLKAAQYLU33YJTU2LQMO337JXHRMWDZA3V3G3IEXIFK5P6QC
BE2WICFCSLQ4BYXGGLGJ5WNVX554FZDXI26MZCLIY46W4M7HVGEAC
AXYOCJJNJECLJKI6EFQRIB4OZDZVSTCC4YEO7YAMS3QVNLXGK5HQC
KUB4ULGPNSBXFDH46OMH4SRT2A2R4YFFIYEDKW7OFVJU5TSDOIGQC
DSGE6FE3QTFMP3BYI6PBTXSWFRFW4F3TZWEJ2CMK3YB7OXC66J4QC
D425ND7AT3F7QJ3CCSESMVDOC3J5C5P32M5SJDBHECZJXLHNQ2FAC
CXLGE3YYT2YXJIR7JE6NT27ONH445P5LZIKJHT53R3ZYQ3V4BHMAC
7B74AT3BXYB7PVW4F6SGQNPMHOU5TEV5TZ54CG6VSQI46XSEKWXQC
24ZMBWYLMODPBAVLT4XNOSETHQXVLXNASYXUIGG2435IT7WIZC5AC
PMRSYJRYQAXZ3OEDD7ANMXTECMT2DNJEC3XQABRNA63SAOUZWA3AC
2GP4MXKEDQMZ7E6TCRSMV2AGN7HLEAHR3QEAC2QFCQQNPMNJSIHQC
YPEFSYD2O7BLC6VVQTXQMU4XGNIG2CXJAMV3WVBSWZRDVUSXRQDAC
Y7MFSXPSUETX7UAXGEKJEMPQ3DYM4E3QVASHM7KUKLR7XN6FA3MQC
ST2AX7B3G7YBGOIF45XX3A2DLK2BONI67DHADM4KSLZVPBTUPC5QC
}
static inline Client *
client_from_wlr_surface(struct wlr_surface *s)
{
struct wlr_xdg_surface *surface;
#ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface;
if (s && wlr_surface_is_xwayland_surface(s)
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s)))
return xsurface->data;
#endif
if (s && 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 *
client_get_parent(Client *c)
{
Client *p;
#ifdef XWAYLAND
if (client_is_x11(c) && c->surface.xwayland->parent)
return client_from_wlr_surface(c->surface.xwayland->parent->surface);
#endif
if (c->surface.xdg->toplevel->parent)
return client_from_wlr_surface(c->surface.xdg->toplevel->parent->surface);
return NULL;
}
static inline Client *
client_from_wlr_surface(struct wlr_surface *s)
{
struct wlr_xdg_surface *surface;
#ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface;
if (wlr_surface_is_xwayland_surface(s)
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s)))
return xsurface->data;
#endif
if (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;