feat: support the repeated exchange of the same two clients

This commit is contained in:
DreamMaoMao 2026-03-06 14:17:26 +08:00
parent 81fcf208a4
commit dcea22bfda
2 changed files with 8 additions and 1 deletions

View file

@ -111,7 +111,9 @@ int32_t exchange_client(const Arg *arg) {
if ((c->isfullscreen || c->ismaximizescreen) && !is_scroller_layout(c->mon)) if ((c->isfullscreen || c->ismaximizescreen) && !is_scroller_layout(c->mon))
return 0; return 0;
exchange_two_client(c, direction_select(arg)); Client *tc = direction_select(arg);
tc = get_focused_stack_client(tc);
exchange_two_client(c, tc);
return 0; return 0;
} }

View file

@ -4828,6 +4828,11 @@ void exchange_two_client(Client *c1, Client *c2) {
} else { } else {
arrange(c1->mon, false, false); arrange(c1->mon, false, false);
} }
// In order to facilitate repeated exchanges for get_focused_stack_client
// set c2 focus order behind c1
wl_list_remove(&c2->flink);
wl_list_insert(&c1->flink, &c2->flink);
} }
void set_activation_env() { void set_activation_env() {