diff options
author | Leonardo Hernández Hernández <leohdz172@protonmail.com> | 2022-03-20 16:02:18 -0600 |
---|---|---|
committer | Leonardo Hernández Hernández <leohdz172@protonmail.com> | 2022-03-20 16:02:18 -0600 |
commit | a66210ebbc1d53742a1709536e9708f94f179c37 (patch) | |
tree | 920c15cba42a659c0f3f7cbe1d1256b170875d59 /client.h | |
parent | c8290f8c556e45e30664785ec4e9b3b1e0782546 (diff) | |
parent | 44932053baad8517072a99a90612f0ac932ffa44 (diff) |
Merge branch 'main' into wlroots-next
Diffstat (limited to 'client.h')
-rw-r--r-- | client.h | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -104,6 +104,16 @@ client_is_float_type(Client *c) } static inline int +client_wants_fullscreen(Client *c) +{ +#ifdef XWAYLAND + if (client_is_x11(c)) + return c->surface.xwayland->fullscreen; +#endif + return c->surface.xdg->toplevel->requested.fullscreen; +} + +static inline int client_is_unmanaged(Client *c) { #ifdef XWAYLAND @@ -169,3 +179,44 @@ client_surface_at(Client *c, double cx, double cy, double *sx, double *sy) #endif return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy); } + +static inline void +client_min_size(Client *c, int *width, int *height) +{ + struct wlr_xdg_toplevel *toplevel; + struct wlr_xdg_toplevel_state *state; +#ifdef XWAYLAND + if (client_is_x11(c)) { + struct wlr_xwayland_surface_size_hints *size_hints; + size_hints = c->surface.xwayland->size_hints; + *width = size_hints->min_width; + *height = size_hints->min_height; + return; + } +#endif + toplevel = c->surface.xdg->toplevel; + state = &toplevel->current; + *width = state->min_width; + *height = state->min_height; +} + +static inline Client * +client_from_popup(struct wlr_xdg_popup *popup) +{ + struct wlr_xdg_surface *surface = popup->base; + + while (1) { + switch (surface->role) { + case WLR_XDG_SURFACE_ROLE_POPUP: + if (!wlr_surface_is_xdg_surface(surface->popup->parent)) + return NULL; + + surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent); + break; + case WLR_XDG_SURFACE_ROLE_TOPLEVEL: + return surface->data; + case WLR_XDG_SURFACE_ROLE_NONE: + return NULL; + } + } +} |