From 300d98c54eeb6d9787c64faabc775ca26cdb3999 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 24 Sep 2025 20:17:22 +0800 Subject: [PATCH] opt: optimize scratchpad animaiton set --- src/animation/client.h | 2 +- src/mango.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/animation/client.h b/src/animation/client.h index 07a8875..8d0ef73 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -1012,7 +1012,7 @@ void resize(Client *c, struct wlr_box geo, int interact) { c->animainit_geom = c->geom; } - if (c->isminied) { + if (c->scratchpad_switching_mon) { c->animainit_geom = c->geom; } diff --git a/src/mango.c b/src/mango.c index 44916d7..dca332a 100644 --- a/src/mango.c +++ b/src/mango.c @@ -323,6 +323,7 @@ struct Client { Client *swallowing, *swallowedby; bool is_clip_to_hide; bool drag_to_tile; + bool scratchpad_switching_mon; bool fake_no_border; int nofadein; int nofadeout; @@ -980,7 +981,7 @@ bool switch_scratchpad_client_state(Client *c) { c->is_in_scratchpad) { // 保存原始monitor用于尺寸计算 Monitor *oldmon = c->mon; - + c->scratchpad_switching_mon = true; c->mon = selmon; reset_foreign_tolevel(c); client_update_oldmonname_record(c, selmon); @@ -999,9 +1000,11 @@ bool switch_scratchpad_client_state(Client *c) { resize(c, c->float_geom, 0); arrange(selmon, false); focusclient(c, true); + c->scratchpad_switching_mon = false; return true; } else { resize(c, c->float_geom, 0); + c->scratchpad_switching_mon = false; } } @@ -3454,6 +3457,7 @@ void init_client_properties(Client *c) { c->scroller_proportion = scroller_default_proportion; c->is_pending_open_animation = true; c->drag_to_tile = false; + c->scratchpad_switching_mon = false; c->fake_no_border = false; c->focused_opacity = focused_opacity; c->unfocused_opacity = unfocused_opacity;