summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-03-13 10:17:10 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-03-13 12:49:54 +0000
commita060ee2802c72d8ce22f42635d1740bf2f84bed7 (patch)
tree804e7b01b30137940bdefb0894597856abfdde03 /src
parentaaace8fbdb0d4d4db703abe3a67f4c9f67df1f5b (diff)
QWindowWindow: Avoid resize events from the ctor
When calling showFullScreen(), the setwindowStates call in the QWindowsWindow constructor led to generating a resize event. This is pretty bad for example when QOpenGLWindow is involved since the QWindow's platformWindow member is not even set yet (handle() == nullptr) so everything related to OpenGL contexts starts failing (as there is no underlying platform window yet as far as the QWindow is concerned). In short, generating geometry changes from the platformwindow ctor is a bad idea. Use initialize() instead for that. Task-number: QTBUG-67027 Change-Id: I35d11949213eb21f81b2ff2d4f2282cb36510210 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qopenglwindow.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index cf3d712421..c3a264f1e8 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -222,6 +222,9 @@ void QOpenGLWindowPrivate::initialize()
if (context)
return;
+ if (!q->handle())
+ qWarning("Attempted to initialize QOpenGLWindow without a platform window");
+
context.reset(new QOpenGLContext);
context->setShareContext(shareContext);
context->setFormat(q->requestedFormat());
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index d639f27c1a..9fff4b5e42 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1107,7 +1107,6 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
updateDropSite(window()->isTopLevel());
registerTouchWindow();
- setWindowState(aWindow->windowStates());
const qreal opacity = qt_window_private(aWindow)->opacity;
if (!qFuzzyCompare(opacity, qreal(1.0)))
setOpacity(opacity);
@@ -1136,9 +1135,11 @@ void QWindowsWindow::initialize()
QWindowCreationContextPtr creationContext =
QWindowsContext::instance()->setWindowCreationContext(QWindowCreationContextPtr());
+ QWindow *w = window();
+ setWindowState(w->windowStates());
+
// Trigger geometry change (unless it has a special state in which case setWindowState()
// will send the message) and screen change signals of QWindow.
- QWindow *w = window();
if (w->type() != Qt::Desktop) {
const Qt::WindowState state = w->windowState();
if (state != Qt::WindowMaximized && state != Qt::WindowFullScreen