xwayland: Activate no_focus_window when a Wayland window is activated

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 <rbernon@codeweavers.com>
This commit is contained in:
Rémi Bernon 2025-05-22 11:27:57 +02:00
parent 87ae07b63f
commit 2f35f84d8e
No known key found for this signature in database
GPG key ID: 38D0E5827B54E5C9

View file

@ -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);