opt: avoid useless actin

This commit is contained in:
DreamMaoMao 2026-01-17 16:00:41 +08:00
parent 2ad2d205c5
commit fdad7e3736
2 changed files with 11 additions and 4 deletions

View file

@ -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;
}

View file

@ -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"