From cd4008c249ed51869efc3b4677f076605f17d502 Mon Sep 17 00:00:00 2001 From: tuwuna <56817415+tuwuna@users.noreply.github.com> Date: Sat, 22 Jan 2022 18:28:24 +0700 Subject: [PATCH] Refocus focused window for focus in events on the root window. (#3543) This deals with (admittedly somewhat misbehaving) clients which use XSetInputFocus to take focus, but then don't properly restore focus. This has been observed with TK apps, but also, e.g., Steam. Ported from https://github.com/i3/i3/commit/a06e66982bc921d05b68b75f8e12323c284233d0 by @psychon Fixes https://github.com/awesomeWM/awesome/issues/3379 --- event.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/event.c b/event.c index 030f86166..0e0ac4329 100644 --- a/event.c +++ b/event.c @@ -696,6 +696,11 @@ event_handle_enternotify(xcb_enter_notify_event_t *ev) static void event_handle_focusin(xcb_focus_in_event_t *ev) { + if (ev->event == globalconf.screen->root) { + /* Received focus in for root window, refocusing the focused window */ + globalconf.focus.need_update = true; + } + if (ev->mode == XCB_NOTIFY_MODE_GRAB || ev->mode == XCB_NOTIFY_MODE_UNGRAB) /* Ignore focus changes due to keyboard grabs */