From 2466dd66494de8d9ccbe4841d5d2062e96ac6dd7 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 17 Jan 2026 19:35:29 +0800 Subject: [PATCH] fix: remove useless code --- src/dispatch/bind_define.h | 4 ++-- src/mango.c | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 2b9591e..cffe359 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -107,7 +107,7 @@ int32_t exchange_client(const Arg *arg) { if ((c->isfullscreen || c->ismaximizescreen) && !is_scroller_layout(c->mon)) return 0; - exchange_two_client(c, direction_select(arg), false); + exchange_two_client(c, direction_select(arg)); return 0; } @@ -122,7 +122,7 @@ int32_t exchange_stack_client(const Arg *arg) { tc = get_next_stack_client(c, true); } if (tc) - exchange_two_client(c, tc, false); + exchange_two_client(c, tc); return 0; } diff --git a/src/mango.c b/src/mango.c index f1941d1..08095a9 100644 --- a/src/mango.c +++ b/src/mango.c @@ -630,7 +630,7 @@ static void motionrelative(struct wl_listener *listener, void *data); static void reset_foreign_tolevel(Client *c); static void remove_foreign_topleve(Client *c); static void add_foreign_topleve(Client *c); -static void exchange_two_client(Client *c1, Client *c2, bool samemon); +static void exchange_two_client(Client *c1, Client *c2); static void outputmgrapply(struct wl_listener *listener, void *data); static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int32_t test); @@ -1848,7 +1848,7 @@ void place_drag_tile_client(Client *c) { closest_client->link.prev->next = &c->link; closest_client->link.prev = &c->link; } else if (closest_client) { - exchange_two_client(c, closest_client, false); + exchange_two_client(c, closest_client); } setfloating(c, 0); } @@ -4357,7 +4357,7 @@ void setborder_color(Client *c) { client_set_border_color(c, border_color); } -void exchange_two_client(Client *c1, Client *c2, bool samemon) { +void exchange_two_client(Client *c1, Client *c2) { Monitor *tmp_mon = NULL; uint32_t tmp_tags; @@ -4370,10 +4370,8 @@ void exchange_two_client(Client *c1, Client *c2, bool samemon) { return; } - if (samemon && c1->mon != c2->mon) - return; - - if(c1->mon != c2->mon && (c1->prev_in_stack || c2->prev_in_stack||c1->next_in_stack||c2->next_in_stack)) + if (c1->mon != c2->mon && (c1->prev_in_stack || c2->prev_in_stack || + c1->next_in_stack || c2->next_in_stack)) return; // 交换布局参数 @@ -4417,7 +4415,7 @@ void exchange_two_client(Client *c1, Client *c2, bool samemon) { } else if (c1->prev_in_stack || c2->prev_in_stack) { Client *c1head = get_scroll_stack_head(c1); Client *c2head = get_scroll_stack_head(c2); - exchange_two_client(c1head, c2head, true); + exchange_two_client(c1head, c2head); focusclient(c1, 0); return; }