diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-07-18 09:02:46 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-07-18 14:11:37 +0000 |
commit | deb7f9a7c3b2044ef6d6253a3f836fe1837bde6e (patch) | |
tree | 45b096cf2edebdb7e980b0dc3d9d9d2243d2e3ce /src/plugins/platforms/windows/qwindowswindow.cpp | |
parent | 214fc329813d7c3375ec5d9e8f17de54d7ec42d3 (diff) |
Windows QPA: Implement QPlatformWindow::initialize()
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ø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
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<QWindowCreationContext> 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<QWindowCreationContext> 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<QWindowCreationContext>()); 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) |