From 122502a84de530edce16f81a6ab8699037761001 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 15 Feb 2025 11:21:06 +0800 Subject: [PATCH] fix: click empty desktop focus to the last client --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 899f4e4..f5a4f71 100644 --- a/main.c +++ b/main.c @@ -1586,6 +1586,7 @@ buttonpress(struct wl_listener *listener, void *data) { uint32_t mods; Client *c; const Button *b; + struct wlr_surface *surface; wlr_idle_notifier_v1_notify_activity(idle_notifier, seat); @@ -1597,10 +1598,13 @@ buttonpress(struct wl_listener *listener, void *data) { break; /* Change focus if the button was _pressed_ over a client */ - xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); + xytonode(cursor->x, cursor->y, &surface, &c, NULL, NULL, NULL); if (c && (!client_is_unmanaged(c) || client_wants_focus(c))) focusclient(c, 1); + if (!surface) + wlr_seat_pointer_notify_clear_focus(seat); + keyboard = wlr_seat_get_keyboard(seat); mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0; for (b = buttons; b < END(buttons); b++) {