From 8078a04e1950d1e9957c3b3c3ea8e6e0c3d34b80 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 May 2013 13:04:26 +0200 Subject: [PATCH] Observe initial screen for fullscreen windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce flag to determine "create" state and do not try to determine the screen from the geometry. Fixes breakage introduced by ded4613ae43842d4b960137843eb83a7472adc65. Task-number: QTBUG-31166 Task-number: QTBUG-30724 Change-Id: Ibe8df95e0ea84be070fdd06b158a6a10c76d42be Reviewed-by: Samuel Rødal Reviewed-by: Gunnar Sletta --- src/plugins/platforms/windows/qwindowswindow.cpp | 9 ++++++--- 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