From 54de782f90a11540826e159b3c8c89cdf87032db Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 12 Apr 2025 12:45:06 +0800 Subject: [PATCH] opt: Avoid unnecessary resize --- maomao.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/maomao.c b/maomao.c index c2dea86..3ad33d0 100644 --- a/maomao.c +++ b/maomao.c @@ -2502,7 +2502,6 @@ double output_frame_duration_ms(Client *c) { } void client_commit(Client *c) { - c->dirty = false; c->current = c->pending; // 设置动画的结束位置 if (c->animation.should_animate) { @@ -2532,13 +2531,16 @@ void commitnotify(struct wl_listener *listener, void *data) { if(!c->dirty) return; - wlr_log(WLR_DEBUG, "app commit event handle:%s",client_get_appid(c)); + struct wlr_box geometry; + client_get_geometry(c, &geometry); + if(geometry.width == c->animation.current.width - 2 * c->bw && geometry.height == c->animation.current.height - 2 * c->bw) { + c->dirty = false; + return; + } + + wlr_log(WLR_DEBUG, "app commit event handle:%s,%d,%d",client_get_appid(c),geometry.width - c->animation.current.width,geometry.height - c->animation.current.height); resize(c, c->geom, (c->isfloating && !c->isfullscreen)); - uint32_t width, height; - client_actual_size(c, &width, &height); - if(width == c->geom.width && height == c->geom.height) - c->dirty = false; // if (c->configure_serial && c->configure_serial <= // c->surface.xdg->current.configure_serial) c->configure_serial = 0; }