diff options
author | Paul Olav Tvete <paul.tvete@gmail.com> | 2015-05-04 17:48:18 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@gmail.com> | 2015-05-04 17:55:02 +0200 |
commit | c05a8757b095cb554ea3e50f202a0683ca7d5bf7 (patch) | |
tree | 0cc94f6907d57030e7db4e67e59781c269ce9906 /src/gui/kernel/qguiapplication.cpp | |
parent | 3110a6642cb9424069ad89666e3cca01d1d6b420 (diff) |
Multi-screen fixes
Various fixes, including:
* Resize backingstore properly if screen has changed
* Trigger resize event on screen change if necessary
* Fix yet another race condition in screen detection
* Trying to fix screen mapping
Not completely finished, but I think it's better to
keep in sync, and not diverge too much.
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 1665909814..3415d015b7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -957,10 +957,11 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) QList<QScreen *>::const_iterator screen = screens.constBegin(); QList<QScreen *>::const_iterator end = screens.constEnd(); - const QPoint devicePosition = QHighDpi::toNativePixels(pos); while (screen != end) { - if ((*screen)->geometry().contains(pos)) + if ((*screen)->geometry().contains(pos)) { + const QPoint devicePosition = QHighDpi::toNativePixels(pos, *screen); return (*screen)->handle()->topLevelAt(devicePosition); + } ++screen; } return 0; @@ -1814,7 +1815,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo points << point; QEvent::Type type; - QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type); + QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type, window); QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers); fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; @@ -2025,6 +2026,11 @@ void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterf window->d_func()->setTopLevelScreen(screen, false /* recreate */); else // Fall back to default behavior, and try to find some appropriate screen window->setScreen(0); + // we may have changed scaling, so trigger resize event if needed + if (window->handle()) { + QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window), QRect()); + processGeometryChangeEvent(&gce); + } } } |