summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-02-09 08:43:59 +0100
committerPaul Olav Tvete <paul.tvete@qt.io>2017-03-28 07:36:21 +0000
commit3f4b8826233d379e0180c27fda6721284a44c1fe (patch)
tree0e6a60073004c51a74b5676a9f64ee9944e5ae2a /src/client/qwaylandwindow.cpp
parent03ea62d4d7391db7beb6b987b7c965c7b5240d96 (diff)
Adapt to the API change in QPlatformWindow::setWindowState
Change-Id: Ic6655f239ea449baf862934608feda182799c42d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r--src/client/qwaylandwindow.cpp43
1 files changed, 19 insertions, 24 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);