From b8ce8d0fbb7cd1ad09ea15ded4a19dc1346e9bcd Mon Sep 17 00:00:00 2001 From: A Frederick Christensen Date: Thu, 3 Feb 2022 21:54:44 -0600 Subject: Account for changes expecting wlr_xdg_toplevel rather than wlr_xdg_surface --- client.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'client.h') diff --git a/client.h b/client.h index 4fd1863..ce41c1c 100644 --- a/client.h +++ b/client.h @@ -39,7 +39,7 @@ client_activate_surface(struct wlr_surface *s, int activated) #endif if (wlr_surface_is_xdg_surface(s)) wlr_xdg_toplevel_set_activated( - wlr_xdg_surface_from_wlr_surface(s), activated); + wlr_xdg_surface_from_wlr_surface(s)->toplevel, activated); } static inline void @@ -121,7 +121,7 @@ client_send_close(Client *c) return; } #endif - wlr_xdg_toplevel_send_close(c->surface.xdg); + wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel); } static inline void @@ -133,7 +133,7 @@ client_set_fullscreen(Client *c, int fullscreen) return; } #endif - wlr_xdg_toplevel_set_fullscreen(c->surface.xdg, fullscreen); + wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen); } static inline uint32_t @@ -146,7 +146,7 @@ client_set_size(Client *c, uint32_t width, uint32_t height) return 0; } #endif - return wlr_xdg_toplevel_set_size(c->surface.xdg, width, height); + return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height); } static inline void @@ -156,7 +156,7 @@ client_set_tiled(Client *c, uint32_t edges) if (client_is_x11(c)) return; #endif - wlr_xdg_toplevel_set_tiled(c->surface.xdg, WLR_EDGE_TOP | + wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT); } -- cgit v1.2.3 From 4276410a3d575aad3f90ff81406382824389db28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 21 Mar 2022 13:52:33 -0600 Subject: improve floating detection mostly copied from sway --- client.h | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'client.h') diff --git a/client.h b/client.h index e4a87e1..db043d2 100644 --- a/client.h +++ b/client.h @@ -91,16 +91,37 @@ client_get_title(Client *c) static inline int client_is_float_type(Client *c) { + struct wlr_xdg_toplevel *toplevel; + struct wlr_xdg_toplevel_state state; + #ifdef XWAYLAND - if (client_is_x11(c)) - for (size_t i = 0; i < c->surface.xwayland->window_type_len; i++) - if (c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeDialog] || - c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeSplash] || - c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeToolbar] || - c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeUtility]) + if (client_is_x11(c)) { + struct wlr_xwayland_surface *surface = c->surface.xwayland; + struct wlr_xwayland_surface_size_hints *size_hints; + if (surface->modal) + return 1; + + for (size_t i = 0; i < surface->window_type_len; i++) + if (surface->window_type[i] == netatom[NetWMWindowTypeDialog] || + surface->window_type[i] == netatom[NetWMWindowTypeSplash] || + surface->window_type[i] == netatom[NetWMWindowTypeToolbar] || + surface->window_type[i] == netatom[NetWMWindowTypeUtility]) return 1; + + size_hints = surface->size_hints; + if (size_hints && size_hints->min_width > 0 && size_hints->min_height > 0 + && (size_hints->max_width == size_hints->min_width || + size_hints->max_height == size_hints->min_height)) + return 1; + } #endif - return 0; + + toplevel = c->surface.xdg->toplevel; + state = toplevel->current; + return (state.min_width != 0 && state.min_height != 0 + && (state.min_width == state.max_width + || state.min_height == state.max_height)) + || toplevel->parent; } static inline int -- cgit v1.2.3 From 31fa6600a174d44be69d66c16dfefd80583409a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Sun, 8 May 2022 17:51:42 -0500 Subject: replace wlr_xwayland_surface_size_hints with xcb_size_hints_t --- client.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'client.h') diff --git a/client.h b/client.h index db043d2..1796ef0 100644 --- a/client.h +++ b/client.h @@ -97,7 +97,7 @@ client_is_float_type(Client *c) #ifdef XWAYLAND if (client_is_x11(c)) { struct wlr_xwayland_surface *surface = c->surface.xwayland; - struct wlr_xwayland_surface_size_hints *size_hints; + xcb_size_hints_t *size_hints; if (surface->modal) return 1; @@ -208,8 +208,7 @@ client_min_size(Client *c, int *width, int *height) 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; + xcb_size_hints_t *size_hints = c->surface.xwayland->size_hints; *width = size_hints->min_width; *height = size_hints->min_height; return; -- cgit v1.2.3 From a32db11f16fae3f57af3795d2463996b95e7ba1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 9 Jun 2022 12:45:42 -0500 Subject: set client bounds at resize --- client.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'client.h') diff --git a/client.h b/client.h index 6648c59..9431d11 100644 --- a/client.h +++ b/client.h @@ -45,6 +45,16 @@ client_activate_surface(struct wlr_surface *s, int activated) wlr_xdg_toplevel_set_activated(surface->toplevel, activated); } +static inline uint32_t +client_set_bounds(Client *c, int32_t width, int32_t height) +{ +#ifdef XWAYLAND + if (client_is_x11(c)) + return 0; +#endif + return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height); +} + static inline void client_for_each_surface(Client *c, wlr_surface_iterator_func_t fn, void *data) { -- cgit v1.2.3 From 058c699ac2552db13ea8bbef64182c59cceaf55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 15 Jul 2022 00:27:31 -0500 Subject: only set bounds for clients that support it --- client.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'client.h') diff --git a/client.h b/client.h index 9431d11..978c8e1 100644 --- a/client.h +++ b/client.h @@ -52,7 +52,10 @@ client_set_bounds(Client *c, int32_t width, int32_t height) if (client_is_x11(c)) return 0; #endif - return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height); + if (c->surface.xdg->client->shell->version >= + XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION) + return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height); + return 0; } static inline void -- cgit v1.2.3