Skip to content

Wayland client: use wl_keyboard to determine active state

Commit f497a5bb made QWaylandDisplay use the xdgshell's active state for QWindow::isActive(), instead of using wl_keyboard activate/deactivate events.

That seems to have been a misunderstanding, since xdgshell activation is only supposed to be used to determine visual appearance, and there is an explicit warning not to assume it means focus.

This commit reverts this logic back to listening to wl_keyboard. It adds a fallback when there is no wl_keyboard available to handle activated/deactivated events through xdg-shell, in order to fix QTBUG-53702.

windowStates is handled so that we're not using the Xdg hint for anything with QWindowSystemInterface::handleWindowStateChanged or anything where we need to track only having one active.

We are still exposing it for decorations, which is the only reason to use the Xdghint over keyboard focus - so you can keep the toplevel active whilst you show a popup.

cherry-pick 40036a1b

Change-Id: I4343d2ed9fb5b066cde95628ed0b4ccc84a424db Reviewed-by: default avatarEskil Abrahamsen Blomfeldt eskil.abrahamsen-blomfeldt@qt.io

https://codereview.qt-project.org/c/qt/qtwayland/+/367306

cc @davidedmundson @apol

Edited by Méven Car

Merge request reports