From bb381c305172133ad85f5844344c4f6eb898e84c Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 21 Apr 2025 16:44:05 +0800 Subject: [PATCH] fix: miss tell the client that they have maximized Tell the client that they have reached the maximum to prevent the window from thinking it is in the normal state. In this state, the window will constantly try to reset its size, which will conflict with the maomao Settings and cause surface jitter --- src/client.h | 3 +-- src/maomao.c | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/client.h b/src/client.h index 18000b0..3b9a0dd 100644 --- a/src/client.h +++ b/src/client.h @@ -378,9 +378,8 @@ client_set_tiled(Client *c, uint32_t edges) if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >= XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) { wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges); - } else { - wlr_xdg_toplevel_set_maximized(c->surface.xdg->toplevel, edges != WLR_EDGE_NONE); } + wlr_xdg_toplevel_set_maximized(c->surface.xdg->toplevel, edges != WLR_EDGE_NONE); } static inline void diff --git a/src/maomao.c b/src/maomao.c index c864b9b..853d50c 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -2584,6 +2584,9 @@ void client_commit(Client *c) { void commitnotify(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, commit); + + if(!c->surface.xdg->initialized) return; + if (c->surface.xdg->initial_commit) { // xdg client will first enter this before mapnotify applyrules(c); @@ -2594,6 +2597,8 @@ void commitnotify(struct wl_listener *listener, void *data) { wlr_xdg_toplevel_set_wm_capabilities( c->surface.xdg->toplevel, WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, 0, 0); + client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | + WLR_EDGE_RIGHT); if (c->decoration) requestdecorationmode(&c->set_decoration_mode, c->decoration); return; @@ -2606,24 +2611,26 @@ void commitnotify(struct wl_listener *listener, void *data) { if (c == grabc) return; - if (!c->dirty || client_is_unmanaged(c)) + if (client_is_unmanaged(c)) return; + uint32_t serial = c->surface.xdg->current.configure_serial; + if(!c->dirty || serial < c->configure_serial) return; + 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)); + if (geometry.width == c->geom.width - 2 * c->bw && + geometry.height == c->geom.height - 2 * c->bw) { + c->dirty = false; + return; + } - // if (c->configure_serial && c->configure_serial <= - // c->surface.xdg->current.configure_serial) c->configure_serial = 0; + resize(c, c->geom, (c->isfloating && !c->isfullscreen)); } void destroydecoration(struct wl_listener *listener, void *data) {