Adapt to the API change in QPlatformWindow::setWindowState
Change-Id: Ic6655f239ea449baf862934608feda182799c42d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
a74c82edb4
commit
15b3e52c18
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user