summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-03-22 08:39:23 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-11 10:48:59 +0000
commit10327549cb91aa77e778c03c797a705241f1f06d (patch)
treed677cf142c9f1fd955b6041bb2367df267382f31 /src/gui/kernel
parente1167ed650afae90ab4b73036f58ae0f416ae500 (diff)
QOffscreenSurface: Suppress setting of a default geometry on the window
When investigating the bug report, it was discovered that the offscreen window is assigned a default geometry by QPlatformWindow::initialGeometry(), causing subsequent resize events and flushing of event queues. Suppress that by making it a popup which is not subject to window title bar restrictions on Windows and setting the respective flags. Task-number: QTBUG-74176 Change-Id: I7f9c1a3bfd57072c8188a98124bde87491dd25eb Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index ae027af627..0cc11ca3bb 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -46,6 +46,8 @@
#include "qwindow.h"
#include "qplatformwindow.h"
+#include <private/qwindow_p.h>
+
QT_BEGIN_NAMESPACE
/*!
@@ -199,12 +201,18 @@ void QOffscreenSurface::create()
if (QThread::currentThread() != qGuiApp->thread())
qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
d->offscreenWindow = new QWindow(d->screen);
+ // Make the window frameless to prevent Windows from enlarging it, should it
+ // violate the minimum title bar width on the platform.
+ d->offscreenWindow->setFlags(d->offscreenWindow->flags()
+ | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface"));
// Remove this window from the global list since we do not want it to be destroyed when closing the app.
// The QOffscreenSurface has to be usable even after exiting the event loop.
QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);
d->offscreenWindow->setSurfaceType(QWindow::OpenGLSurface);
d->offscreenWindow->setFormat(d->requestedFormat);
+ // Prevent QPlatformWindow::initialGeometry() and platforms from setting a default geometry.
+ qt_window_private(d->offscreenWindow)->setAutomaticPositionAndResizeEnabled(false);
d->offscreenWindow->setGeometry(0, 0, d->size.width(), d->size.height());
d->offscreenWindow->create();
}