diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-02-09 08:43:59 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2017-03-28 07:36:21 +0000 |
commit | 3f4b8826233d379e0180c27fda6721284a44c1fe (patch) | |
tree | 0e6a60073004c51a74b5676a9f64ee9944e5ae2a | |
parent | 03ea62d4d7391db7beb6b987b7c965c7b5240d96 (diff) |
Adapt to the API change in QPlatformWindow::setWindowState
Change-Id: Ic6655f239ea449baf862934608feda182799c42d
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r-- | src/client/qwaylandwindow.cpp | 43 | ||||
-rw-r--r-- | src/client/qwaylandwindow_p.h | 10 |
2 files changed, 24 insertions, 29 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 75c5b2f9d..540403bce 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -195,7 +195,7 @@ void QWaylandWindow::initWindow() else setGeometry_helper(window()->geometry()); setMask(window()->mask()); - setWindowStateInternal(window()->windowState()); + setWindowStateInternal(window()->windowStates()); handleContentOrientationChange(window()->contentOrientation()); mFlags = window()->flags(); } @@ -571,7 +571,7 @@ void QWaylandWindow::setOrientationMask(Qt::ScreenOrientations mask) mShellSurface->setContentOrientationMask(mask); } -void QWaylandWindow::setWindowState(Qt::WindowState state) +void QWaylandWindow::setWindowState(Qt::WindowStates state) { if (setWindowStateInternal(state)) QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged @@ -589,16 +589,16 @@ void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags) bool QWaylandWindow::createDecoration() { // so far only xdg-shell support this "unminimize" trick, may be moved elsewhere - if (mState == Qt::WindowMinimized) { + if (mState & Qt::WindowMinimized) { QWaylandXdgSurface *xdgSurface = qobject_cast<QWaylandXdgSurface *>(mShellSurface); if ( xdgSurface ) { - if (xdgSurface->isFullscreen()) { - setWindowStateInternal(Qt::WindowFullScreen); - } else if (xdgSurface->isMaximized()) { - setWindowStateInternal(Qt::WindowMaximized); - } else { - setWindowStateInternal(Qt::WindowNoState); - } + Qt::WindowStates states; + if (xdgSurface->isFullscreen()) + states |= Qt::WindowFullScreen; + if (xdgSurface->isMaximized()) + states |= Qt::WindowMaximized; + + setWindowStateInternal(states); } } @@ -849,7 +849,7 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab) return true; } -bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) +bool QWaylandWindow::setWindowStateInternal(Qt::WindowStates state) { if (mState == state) { return false; @@ -862,19 +862,14 @@ bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state) if (mShellSurface) { createDecoration(); - switch (state) { - case Qt::WindowFullScreen: - mShellSurface->setFullscreen(); - break; - case Qt::WindowMaximized: - mShellSurface->setMaximized(); - break; - case Qt::WindowMinimized: - mShellSurface->setMinimized(); - break; - default: - mShellSurface->setNormal(); - } + if (state & Qt::WindowMaximized) + mShellSurface->setMaximized(); + if (state & Qt::WindowFullScreen) + mShellSurface->setFullscreen(); + if (state & Qt::WindowMinimized) + mShellSurface->setMinimized(); + if (!state) + mShellSurface->setNormal(); } QWindowSystemInterface::handleWindowStateChanged(window(), mState); diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index b9ca5ee0e..7e8db74bc 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -148,7 +148,7 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); - void setWindowState(Qt::WindowState state); // ### Change to WindowStates once qtbase change is in + void setWindowState(Qt::WindowStates state) override; void setWindowFlags(Qt::WindowFlags flags) override; void raise() override; @@ -173,8 +173,8 @@ public: bool createDecoration(); - inline bool isMaximized() const { return mState == Qt::WindowMaximized; } - inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; } + inline bool isMaximized() const { return mState & Qt::WindowMaximized; } + inline bool isFullscreen() const { return mState & Qt::WindowFullScreen; } #if QT_CONFIG(cursor) void setMouseCursor(QWaylandInputDevice *device, const QCursor &cursor); @@ -238,14 +238,14 @@ protected: QIcon mWindowIcon; - Qt::WindowState mState; + Qt::WindowStates mState; Qt::WindowFlags mFlags; QRegion mMask; QWaylandShmBackingStore *mBackingStore; private: - bool setWindowStateInternal(Qt::WindowState flags); + bool setWindowStateInternal(Qt::WindowStates flags); void setGeometry_helper(const QRect &rect); void initWindow(); bool shouldCreateShellSurface() const; |