From 2f35f84d8e3cacfbfd481c1ce9d90044b5201404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 22 May 2025 11:27:57 +0200 Subject: [PATCH] xwayland: Activate no_focus_window when a Wayland window is activated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit None active window might be interpreted from an X point of view as a transient focus state, and is used by multiple X window managers when a temporary focus change is in progress, or simply when grabbing the keyboard. From Wine side, we translate any active window change to the Win32 application, and handling None active window as an actual window deactivation and focus loss creates spurious events and an undesired feedback loop, as apps might react to it. We still want to be able to detect actual focus loss under an XWayland session, and having XWayland window manager focus an actual X window instead will make the distinction possible. Signed-off-by: Rémi Bernon --- xwayland/window-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index c33ec4038..7a3be4d73 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -987,7 +987,7 @@ weston_wm_send_focus_window(struct weston_wm *wm, } else { xcb_set_input_focus (wm->conn, XCB_INPUT_FOCUS_POINTER_ROOT, - XCB_NONE, + wm->no_focus_window, XCB_TIME_CURRENT_TIME); } } @@ -1011,7 +1011,7 @@ weston_wm_window_activate(struct wl_listener *listener, void *data) if (window) { weston_wm_set_net_active_window(wm, window->id); } else { - weston_wm_set_net_active_window(wm, XCB_WINDOW_NONE); + weston_wm_set_net_active_window(wm, wm->no_focus_window); } weston_wm_send_focus_window(wm, window);