summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@proton.me>2023-11-16 21:12:50 -0600
committerLeonardo Hernández Hernández <leohdz172@proton.me>2023-11-17 11:03:31 -0600
commit6d0ec595d3f3ba6977ea117681861713fbc1de5f (patch)
tree5275212244f26840066d18cc0f35f92650857660
parent4f4c540bb9ec47c77ff30e1a7ddd7d00d63c67b2 (diff)
simplify client_get_clip
the clips for xwayland and xdg clients are pretty similar, after all we only need to adjust x and y for xdg clients
-rw-r--r--client.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/client.h b/client.h
index 012ba74..2ffb92c 100644
--- a/client.h
+++ b/client.h
@@ -143,23 +143,22 @@ client_get_appid(Client *c)
static inline void
client_get_clip(Client *c, struct wlr_box *clip)
{
+ struct wlr_box xdg_geom = {0};
+ *clip = (struct wlr_box){
+ .x = 0,
+ .y = 0,
+ .width = c->geom.width - c->bw,
+ .height = c->geom.height - c->bw,
+ };
+
#ifdef XWAYLAND
- if (client_is_x11(c)) {
- *clip = (struct wlr_box){
- .x = 0,
- .y = 0,
- .width = c->geom.width - c->bw,
- .height = c->geom.height - c->bw};
+ if (client_is_x11(c))
return;
- }
#endif
- *clip = (struct wlr_box){
- .x = c->surface.xdg->pending.geometry.x,
- .y = c->surface.xdg->pending.geometry.y,
- .width = c->geom.width - c->bw,
- .height = c->geom.height - c->bw};
-
+ wlr_xdg_surface_get_geometry(c->surface.xdg, &xdg_geom);
+ clip->x = xdg_geom.x;
+ clip->y = xdg_geom.y;
}
static inline void