diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 7225d24af9d752d83c74462421f7b61ef2638b46..ae28eb7797095f66a9544d7c5787036c9eae8e57 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -399,13 +399,16 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic { QWaylandWindow *keyboardFocus = inputDevice->keyboardFocus(); - if (!keyboardFocus->shellSurface()->shellManagesActiveState() && mLastKeyboardFocus != keyboardFocus) { - if (keyboardFocus) - handleWindowActivated(keyboardFocus); - if (mLastKeyboardFocus) - handleWindowDeactivated(mLastKeyboardFocus); - } - mLastKeyboardFocus = inputDevice->keyboardFocus(); + if (mLastKeyboardFocus == keyboardFocus) + return; + + if (keyboardFocus && !keyboardFocus->shellManagesActiveState()) + handleWindowActivated(keyboardFocus); + + if (mLastKeyboardFocus && !mLastKeyboardFocus->shellManagesActiveState()) + handleWindowDeactivated(mLastKeyboardFocus); + + mLastKeyboardFocus = keyboardFocus; } void QWaylandDisplay::handleWaylandSync() diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index aba676533bb02dad74fb9b41206ae2b8a7a42be9..8885c0e5d1c36cd5658cc107d7f30c12508a18dc 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -500,6 +500,11 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const return mSubSurfaceWindow; } +bool QWaylandWindow::shellManagesActiveState() const +{ + return mShellSurface && mShellSurface->shellManagesActiveState(); +} + void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { if (mDisplay->compositorVersion() < 2) diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index c60891d49f05cd518b33d1eae795f1d4af4f5261..d7e795159450f2493e264d2e33f41ade1d429a2d 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -136,6 +136,8 @@ public: QWaylandSubSurface *subSurfaceWindow() const; QWaylandScreen *screen() const { return mScreen; } + bool shellManagesActiveState() const; + void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; void setOrientationMask(Qt::ScreenOrientations mask);