mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-02-11 04:28:19 -05:00
opt: ignore direction arg if the direction not match the scroller direction
This commit is contained in:
parent
deaa26c779
commit
00f56fa3aa
1 changed files with 22 additions and 9 deletions
|
|
@ -1613,12 +1613,16 @@ int32_t scroller_stack(const Arg *arg) {
|
|||
Client *c = selmon->sel;
|
||||
Client *stack_head = NULL;
|
||||
Client *source_stack_head = NULL;
|
||||
if (!c || c->isfloating || !is_scroller_layout(selmon))
|
||||
if (!c || !c->mon || c->isfloating || !is_scroller_layout(selmon))
|
||||
return 0;
|
||||
|
||||
if (c && (!client_only_in_one_tag(c) || c->isglobal || c->isunglobal))
|
||||
return 0;
|
||||
|
||||
bool is_horizontal_layout =
|
||||
c->mon->pertag->ltidxs[c->mon->pertag->curtag]->id == SCROLLER ? true
|
||||
: false;
|
||||
|
||||
Client *target_client = find_client_by_direction(c, arg, false, true);
|
||||
|
||||
if (target_client && (!client_only_in_one_tag(target_client) ||
|
||||
|
|
@ -1646,27 +1650,36 @@ int32_t scroller_stack(const Arg *arg) {
|
|||
}
|
||||
|
||||
if (c->prev_in_stack) {
|
||||
exit_scroller_stack(c);
|
||||
if (arg->i == LEFT || arg->i == UP) {
|
||||
if ((is_horizontal_layout && arg->i == LEFT) ||
|
||||
(!is_horizontal_layout && arg->i == UP)) {
|
||||
exit_scroller_stack(c);
|
||||
wl_list_remove(&c->link);
|
||||
wl_list_insert(source_stack_head->link.prev, &c->link);
|
||||
} else {
|
||||
arrange(selmon, false, false);
|
||||
|
||||
} else if ((is_horizontal_layout && arg->i == RIGHT) ||
|
||||
(!is_horizontal_layout && arg->i == DOWN)) {
|
||||
exit_scroller_stack(c);
|
||||
wl_list_remove(&c->link);
|
||||
wl_list_insert(&source_stack_head->link, &c->link);
|
||||
arrange(selmon, false, false);
|
||||
}
|
||||
arrange(selmon, false, false);
|
||||
return 0;
|
||||
} else if (c->next_in_stack) {
|
||||
Client *next_in_stack = c->next_in_stack;
|
||||
exit_scroller_stack(c);
|
||||
if (arg->i == LEFT || arg->i == UP) {
|
||||
if ((is_horizontal_layout && arg->i == LEFT) ||
|
||||
(!is_horizontal_layout && arg->i == UP)) {
|
||||
exit_scroller_stack(c);
|
||||
wl_list_remove(&c->link);
|
||||
wl_list_insert(next_in_stack->link.prev, &c->link);
|
||||
} else {
|
||||
arrange(selmon, false, false);
|
||||
} else if ((is_horizontal_layout && arg->i == RIGHT) ||
|
||||
(!is_horizontal_layout && arg->i == DOWN)) {
|
||||
exit_scroller_stack(c);
|
||||
wl_list_remove(&c->link);
|
||||
wl_list_insert(&next_in_stack->link, &c->link);
|
||||
arrange(selmon, false, false);
|
||||
}
|
||||
arrange(selmon, false, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue