From b55de2874929b146c37b866f9a3e23c35c94c8d8 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 26 Mar 2026 18:57:02 +0800 Subject: [PATCH] opt: dont force request resize when the x11 app reject resize --- src/client/client.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/client/client.h b/src/client/client.h index 648d6600..e7e44748 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -294,9 +294,8 @@ static inline uint32_t client_set_size(Client *c, uint32_t width, uint32_t height) { #ifdef XWAYLAND if (client_is_x11(c)) { - - struct wlr_surface_state *state = - &c->surface.xwayland->surface->current; + struct wlr_xwayland_surface *surface = c->surface.xwayland; + struct wlr_surface_state *state = &surface->surface->current; if ((int32_t)c->geom.width - 2 * (int32_t)c->bw == (int32_t)state->width && @@ -309,6 +308,30 @@ static inline uint32_t client_set_size(Client *c, uint32_t width, return 0; } + if ((int32_t)c->geom.width - 2 * (int32_t)c->bw == + (int32_t)state->width && + (int32_t)c->geom.height - 2 * (int32_t)c->bw == + (int32_t)state->height && + c->mon && !INSIDEMON(c)) { + return 0; + } + + xcb_size_hints_t *size_hints = surface->size_hints; + int32_t width = c->geom.width - 2 * c->bw; + int32_t height = c->geom.height - 2 * c->bw; + + if (c->mon && c->mon->isoverview && size_hints && + c->geom.width - 2 * (int32_t)c->bw < size_hints->min_width && + c->geom.height - 2 * (int32_t)c->bw < size_hints->min_height) + return 0; + + if (size_hints && + c->geom.width - 2 * (int32_t)c->bw < size_hints->min_width) + width = size_hints->min_width; + if (size_hints && + c->geom.height - 2 * (int32_t)c->bw < size_hints->min_height) + height = size_hints->min_height; + wlr_xwayland_surface_configure(c->surface.xwayland, c->geom.x + c->bw, c->geom.y + c->bw, width, height); return 1;