From 42f722ada2fa4cba0d9426b4273d269e1ba59d53 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 29 Dec 2025 09:51:12 +0800 Subject: [PATCH] opt: reset global window record per when arrange --- src/fetch/client.h | 11 +++++++++++ src/layout/arrange.h | 17 +++++++++++++++++ src/mango.c | 1 + 3 files changed, 29 insertions(+) diff --git a/src/fetch/client.h b/src/fetch/client.h index 5dc0edd..56ca982 100644 --- a/src/fetch/client.h +++ b/src/fetch/client.h @@ -430,4 +430,15 @@ float *get_border_color(Client *c) { } else { return bordercolor; } +} + +int is_single_bit_set(uint32_t x) { return x && !(x & (x - 1)); } + +bool client_only_in_one_tag(Client *c) { + uint32_t masked = c->tags & TAGMASK; + if (is_single_bit_set(masked)) { + return true; + } else { + return false; + } } \ No newline at end of file diff --git a/src/layout/arrange.h b/src/layout/arrange.h index a7805af..dc8b47e 100644 --- a/src/layout/arrange.h +++ b/src/layout/arrange.h @@ -576,6 +576,23 @@ void reset_size_per_mon(Monitor *m, int tile_cilent_num, } } +void reset_multi_tag_client_per(Monitor *m) { + Client *c = NULL; + wl_list_for_each(c, &clients, link) { + + if (c->isglobal || c->isunglobal) { + set_size_per(m, c); + } + + if (!VISIBLEON(c, m)) + continue; + + if (!client_only_in_one_tag(c)) { + set_size_per(m, c); + } + } +} + void // 17 arrange(Monitor *m, bool want_animation) { Client *c = NULL; diff --git a/src/mango.c b/src/mango.c index d7f0de2..230387c 100644 --- a/src/mango.c +++ b/src/mango.c @@ -5693,6 +5693,7 @@ toggleseltags: if (changefocus) focusclient(focustop(m), 1); + reset_multi_tag_client_per(m); arrange(m, want_animation); printstatus(); }