diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp index d3327ff39a8..2713ac37b9f 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6integration.cpp @@ -41,9 +41,6 @@ #include #include -#include -#include -#include #include QT_BEGIN_NAMESPACE @@ -82,12 +79,12 @@ void QWaylandXdgShellV6Integration::handleKeyboardFocusChanged(QWaylandWindow *n { if (newFocus) { auto *xdgSurface = qobject_cast(newFocus->shellSurface()); - if (xdgSurface && xdgSurface->handlesActiveState()) + if (xdgSurface && !xdgSurface->handlesActiveState()) m_display->handleWindowActivated(newFocus); } - if (oldFocus && qobject_cast(oldFocus->shellSurface())) { + if (oldFocus && qobject_cast(oldFocus->shellSurface())) { auto *xdgSurface = qobject_cast(oldFocus->shellSurface()); - if (xdgSurface && xdgSurface->handlesActiveState()) + if (xdgSurface && !xdgSurface->handlesActiveState()) m_display->handleWindowDeactivated(oldFocus); } } diff --git a/tests/auto/wayland/shared/mocksurface.cpp b/tests/auto/wayland/shared/mocksurface.cpp index 81a865f1194..82ce37acb4c 100644 --- a/tests/auto/wayland/shared/mocksurface.cpp +++ b/tests/auto/wayland/shared/mocksurface.cpp @@ -70,7 +70,10 @@ void Compositor::sendShellSurfaceConfigure(void *data, const QList &pa QSize size = parameters.at(1).toSize(); Q_ASSERT(size.isValid()); if (auto toplevel = surface->xdgToplevelV6()) { - toplevel->send_configure(size.width(), size.height(), QByteArray()); + QVector states = { ZXDG_TOPLEVEL_V6_STATE_ACTIVATED }; + auto statesBytes = QByteArray::fromRawData(reinterpret_cast(states.data()), + states.size() * static_cast(sizeof(uint))); + toplevel->send_configure(size.width(), size.height(), statesBytes); toplevel->xdgSurface()->send_configure(compositor->nextSerial()); } else if (auto wlShellSurface = surface->wlShellSurface()) { const uint edges = 0;