From fdad7e3736a7d3d9ea71eda81cf50b340de838c0 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 17 Jan 2026 16:00:41 +0800 Subject: [PATCH] opt: avoid useless actin --- src/dispatch/bind_define.h | 14 ++++++++++---- src/mango.c | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index ae81c49..6dba6cc 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -1596,9 +1596,15 @@ int32_t scroller_stack(const Arg *arg) { if (!c || c->isfloating || !is_scroller_layout(selmon)) return 0; - Client *left_c = find_client_by_direction(c, arg, false, true); + Client *target_client = find_client_by_direction(c, arg, false, true); - if (!left_c) { + if(!target_client) + return 0; + + if(!client_only_in_one_tag(target_client) || target_client->isglobal || target_client->isunglobal) + return 0; + + if (!target_client) { if (arg->i == LEFT || arg->i == UP) { exit_scroller_stack(c); wl_list_remove(&c->link); @@ -1622,8 +1628,8 @@ int32_t scroller_stack(const Arg *arg) { exit_scroller_stack(c); - // Find the tail of left_c's stack - Client *stack_tail = left_c; + // Find the tail of target_client's stack + Client *stack_tail = target_client; while (stack_tail->next_in_stack) { stack_tail = stack_tail->next_in_stack; } diff --git a/src/mango.c b/src/mango.c index 4a9d3b3..9b43a14 100644 --- a/src/mango.c +++ b/src/mango.c @@ -768,6 +768,7 @@ static Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating, bool ignore_align); static void exit_scroller_stack(Client *c); static Client *get_scroll_stack_head(Client *c); +static bool client_only_in_one_tag(Client *c); #include "data/static_keymap.h" #include "dispatch/bind_declare.h"