From deb7f9a7c3b2044ef6d6253a3f836fe1837bde6e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 18 Jul 2017 09:02:46 +0200 Subject: Windows QPA: Implement QPlatformWindow::initialize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the code that sends geometry change events from QWindowsIntegration::createPlatformWindow() to QWindowsWindow::initialize(), using the obtained geometry from the creation context. Drop the check for window flags since they are not changed. Complements change 4c855a9f9ff523e2753157897100393d14bf2f9e Task-number: QTBUG-61977 Change-Id: I0c23abefc45110cc4bf11e10d65dc7ddbb9d20d5 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/windows/qwindowswindow.cpp | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9c8a3d4956..6b737207f5 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -76,6 +76,8 @@ QT_BEGIN_NAMESPACE +typedef QSharedPointer QWindowCreationContextPtr; + enum { defaultWindowWidth = 160, defaultWindowHeight = 160 @@ -621,8 +623,6 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag QWindowsWindowData WindowCreationData::create(const QWindow *w, const WindowData &data, QString title) const { - typedef QSharedPointer QWindowCreationContextPtr; - WindowData result; result.flags = flags; @@ -1070,8 +1070,6 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) , m_vkSurface(0) #endif { - // Clear the creation context as the window can be found in QWindowsContext's map. - QWindowsContext::instance()->setWindowCreationContext(QSharedPointer()); QWindowsContext::instance()->addWindow(m_data.hwnd, this); const Qt::WindowType type = aWindow->type(); if (type == Qt::Desktop) @@ -1112,6 +1110,27 @@ QWindowsWindow::~QWindowsWindow() destroyIcon(); } +void QWindowsWindow::initialize() +{ + // Clear the creation context as the window can be found in QWindowsContext's map. + QWindowCreationContextPtr creationContext = + QWindowsContext::instance()->setWindowCreationContext(QWindowCreationContextPtr()); + + // 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 + && creationContext->requestedGeometry != creationContext->obtainedGeometry) { + QWindowSystemInterface::handleGeometryChange(w, creationContext->obtainedGeometry); + } + QPlatformScreen *obtainedScreen = screenForGeometry(creationContext->obtainedGeometry); + if (obtainedScreen && screen() != obtainedScreen) + QWindowSystemInterface::handleWindowScreenChanged(w, obtainedScreen->screen()); + } +} + void QWindowsWindow::fireExpose(const QRegion ®ion, bool force) { if (region.isEmpty() && !force) -- cgit v1.2.3