From bcc88f64fe35acf4762d3c73f50b1d71946ca061 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 23 Aug 2025 12:57:35 +0800 Subject: [PATCH] opt: resize client when client commit a different size --- src/mango.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mango.c b/src/mango.c index a9d9908..307b4fb 100644 --- a/src/mango.c +++ b/src/mango.c @@ -2150,6 +2150,7 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) { void commitnotify(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, commit); + struct wlr_box *new_geo; if (c->surface.xdg->initial_commit) { // xdg client will first enter this before mapnotify @@ -2193,12 +2194,19 @@ void commitnotify(struct wl_listener *listener, void *data) { c->configure_serial <= c->surface.xdg->current.configure_serial) c->configure_serial = 0; + if (!c->dirty) { + new_geo = &c->surface.xdg->geometry; + c->dirty = new_geo->width != c->geom.width - 2 * c->bw || + new_geo->height != c->geom.height - 2 * c->bw || + new_geo->x != 0 || new_geo->y != 0; + } + if (c == grabc || !c->dirty) return; resize(c, c->geom, 0); - struct wlr_box *new_geo = &c->surface.xdg->geometry; + new_geo = &c->surface.xdg->geometry; c->dirty = new_geo->width != c->geom.width - 2 * c->bw || new_geo->height != c->geom.height - 2 * c->bw || new_geo->x != 0 || new_geo->y != 0;