Support MaximizeUsingFullscreenGeometryHint in resizeMaximizedWindows()
In QPlatformScreen there is a convenience function which resizes windows when the screen changes. This did not have support for MaximizeUsingFullscreenGeometryHint and would mistakenly resize these windows to the available geometry. Since not all QPA plugins support this hint, we have to add a capability flag to avoid changing behavior on platforms where it works as intended. Task-number: QTBUG-74202 Change-Id: Ife88f597fbb3affa722f63ac18fb5719ffa8ed33 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
33f1eb50e2
commit
3e529369eb
@ -106,7 +106,8 @@ public:
|
||||
ApplicationIcon,
|
||||
SwitchableWidgetComposition,
|
||||
TopStackedNativeChildWindows,
|
||||
OpenGLOnRasterSurface
|
||||
OpenGLOnRasterSurface,
|
||||
MaximizeUsingFullscreenGeometry
|
||||
};
|
||||
|
||||
virtual ~QPlatformIntegration() { }
|
||||
|
@ -410,15 +410,22 @@ void QPlatformScreen::resizeMaximizedWindows()
|
||||
const QRect newGeometry = deviceIndependentGeometry();
|
||||
const QRect newAvailableGeometry = QHighDpi::fromNative(availableGeometry(), QHighDpiScaling::factor(this), newGeometry.topLeft());
|
||||
|
||||
const bool supportsMaximizeUsingFullscreen = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MaximizeUsingFullscreenGeometry);
|
||||
|
||||
for (QWindow *w : windows()) {
|
||||
// Skip non-platform windows, e.g., offscreen windows.
|
||||
if (!w->handle())
|
||||
continue;
|
||||
|
||||
if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry)
|
||||
w->setGeometry(newAvailableGeometry);
|
||||
else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry)
|
||||
if (supportsMaximizeUsingFullscreen
|
||||
&& w->windowState() & Qt::WindowMaximized
|
||||
&& w->flags() & Qt::MaximizeUsingFullscreenGeometryHint) {
|
||||
w->setGeometry(newGeometry);
|
||||
} else if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry) {
|
||||
w->setGeometry(newAvailableGeometry);
|
||||
} else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry) {
|
||||
w->setGeometry(newGeometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user