diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.h | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 010197d6d8..a5776e7c4e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -775,7 +775,7 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w, QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : QPlatformWindow(aWindow), m_data(data), - m_flags(0), + m_flags(WithinCreate), m_hdc(0), m_windowState(Qt::WindowNoState), m_opacity(1.0), @@ -826,6 +826,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : const qreal opacity = qt_window_private(aWindow)->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + clearFlag(WithinCreate); } QWindowsWindow::~QWindowsWindow() @@ -1481,8 +1482,10 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) if (visible) newStyle |= WS_VISIBLE; setStyle(newStyle); - - const QRect r = effectiveScreen(window())->geometry(); + // Use geometry of QWindow::screen() within creation or the virtual screen the + // window is in (QTBUG-31166, QTBUG-30724). + const QScreen *screen = testFlag(WithinCreate) ? window()->screen() : effectiveScreen(window()); + const QRect r = screen->geometry(); const UINT swpf = SWP_FRAMECHANGED | SWP_NOACTIVATE; const bool wasSync = testFlag(SynchronousGeometryChangeEvent); setFlag(SynchronousGeometryChangeEvent); diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 6c735ede7d..07f3976d87 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -134,7 +134,8 @@ public: WithinDestroy = 0x1000, TouchRegistered = 0x2000, AlertState = 0x4000, - Exposed = 0x08000 + Exposed = 0x08000, + WithinCreate = 0x10000 }; struct WindowData |