From c58e96db6e80c24041e4282441323bd6aa19d26c Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 9 Jul 2026 16:03:51 +0800 Subject: [PATCH] opt: optimize focus lift logic --- src/dispatch/bind_define.h | 2 +- src/layout/horizontal.h | 2 -- src/mango.c | 8 ++++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index c9462b67..3111eccd 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -680,7 +680,7 @@ int32_t restore_minimized(const Arg *arg) { show_hide_client(c); setborder_color(c); arrange(c->mon, false, false); - focusclient(c, 0); + focusclient(c, 1); warp_cursor(c); return 0; } diff --git a/src/layout/horizontal.h b/src/layout/horizontal.h index aa60100b..f3fd0fa8 100644 --- a/src/layout/horizontal.h +++ b/src/layout/horizontal.h @@ -608,8 +608,6 @@ monocle(Monitor *m) { geom.height = m->w.height - 2 * cur_gappov; client_tile_resize(c, geom, 0); } - if ((c = focustop(m))) - wlr_scene_node_raise_to_top(&c->scene->node); } // 网格布局窗口大小和位置计算 diff --git a/src/mango.c b/src/mango.c index b4b23abb..2114bb8a 100644 --- a/src/mango.c +++ b/src/mango.c @@ -1439,7 +1439,7 @@ bool switch_scratchpad_client_state(Client *c) { c->tags = get_tags_first_tag(selmon->tagset[selmon->seltags]); resize(c, c->float_geom, 0); arrange(selmon, false, false); - focusclient(c, true); + focusclient(c, 1); c->scratchpad_switching_mon = false; return true; } else { @@ -1452,7 +1452,7 @@ bool switch_scratchpad_client_state(Client *c) { (c->mon->tagset[c->mon->seltags] & c->tags) == 0) { c->tags = c->mon->tagset[c->mon->seltags]; arrange(c->mon, false, false); - focusclient(c, true); + focusclient(c, 1); return true; } else if (c->is_in_scratchpad && c->is_scratchpad_show && (c->mon->tagset[c->mon->seltags] & c->tags) != 0) { @@ -3876,7 +3876,7 @@ void destroylock(SessionLock *lock, int32_t unlock) { wlr_scene_node_set_enabled(&locked_bg->node, false); } - focusclient(focustop(selmon), 0); + focusclient(focustop(selmon), 1); motionnotify(0, NULL, 0, 0, 0, 0); destroy: @@ -6869,7 +6869,7 @@ void unmapnotify(struct wl_listener *listener, void *data) { } if (nextfocus) { - focusclient(nextfocus, 0); + focusclient(nextfocus, 1); } if (!nextfocus && selmon->isoverview) {