From f1f07525e50440ceb3cf7540455e9f4ac2e6aae3 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 16 May 2026 15:13:39 +0800 Subject: [PATCH] opt: dont let window get pointer focus in overview --- src/animation/client.h | 4 +++- src/dispatch/bind_define.h | 5 +++++ src/mango.c | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/animation/client.h b/src/animation/client.h index 503da61d..a804ab29 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -888,7 +888,9 @@ void client_animation_next_tick(Client *c) { surface = pointer_c && pointer_c == c ? client_surface(pointer_c) : NULL; - if (surface && pointer_c == selmon->sel) { + + // avoid game window force grab pointer in overview mode + if (surface && pointer_c == selmon->sel && !selmon->isoverview) { wlr_seat_pointer_notify_enter(seat, surface, sx, sy); } diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 71ff7ce2..ba357850 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -1737,6 +1737,11 @@ int32_t toggleoverview(const Arg *arg) { // 正常视图到overview,退出所有窗口的浮动和全屏状态参与平铺, // overview到正常视图,还原之前退出的浮动和全屏窗口状态 if (selmon->isoverview) { + + // 让游戏窗口无法强制约束鼠标 + wlr_seat_pointer_clear_focus(seat); + wlr_cursor_set_xcursor(cursor, cursor_mgr, "default"); + wl_list_for_each(c, &clients, link) { if (c && c->mon == selmon && !client_is_unmanaged(c) && !client_is_x11_popup(c) && !c->isunglobal) diff --git a/src/mango.c b/src/mango.c index b7513fce..9b8ba73e 100644 --- a/src/mango.c +++ b/src/mango.c @@ -4816,7 +4816,13 @@ void pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, /* Let the client know that the mouse cursor has entered one * of its surfaces, and make keyboard focus follow if desired. * wlroots makes this a no-op if surface is already focused */ - wlr_seat_pointer_notify_enter(seat, surface, sx, sy); + + if (!c || !c->mon || !c->mon->isoverview) { + // don't let window get pointer focus, + // avoid game window force grab pointer in overview mode + wlr_seat_pointer_notify_enter(seat, surface, sx, sy); + } + wlr_seat_pointer_notify_motion(seat, time, sx, sy); }