diff options
author | Liang Qi <liang.qi@qt.io> | 2018-05-24 16:27:08 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-05-24 16:29:14 +0200 |
commit | f82e5085169876e0ec7c1b744d021b068c281cfe (patch) | |
tree | a870e1f68ce62818a0793c4c78a67971e841e676 /src/plugins/platforms/windows | |
parent | f74d4fb1dacc682e2e6f4a44e4240f642a2c3b70 (diff) | |
parent | ee47999333dde1d38b73d04e142e05f06f8c56ed (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
mkspecs/features/qt_common.prf
src/corelib/tools/qstring.cpp
src/plugins/platforms/windows/qwindowsmousehandler.cpp
src/widgets/widgets/qmainwindowlayout_p.h
Change-Id: I5df613008f6336f69b257d08e49a133d033a9d65
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsmousehandler.cpp | 20 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 4 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 4e28b2f219..bec935cd80 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -520,11 +520,25 @@ static bool isValidWheelReceiver(QWindow *candidate) static void redirectWheelEvent(QWindow *window, const QPoint &globalPos, int delta, Qt::Orientation orientation, Qt::KeyboardModifiers mods) { + // Redirect wheel event to one of the following, in order of preference: + // 1) The window under mouse + // 2) The window receiving the event // If a window is blocked by modality, it can't get the event. - if (isValidWheelReceiver(window)) { + + QWindow *receiver = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE); + while (receiver && receiver->flags().testFlag(Qt::WindowTransparentForInput)) + receiver = receiver->parent(); + bool handleEvent = true; + if (!isValidWheelReceiver(receiver)) { + receiver = window; + if (!isValidWheelReceiver(receiver)) + handleEvent = false; + } + + if (handleEvent) { const QPoint point = (orientation == Qt::Vertical) ? QPoint(0, delta) : QPoint(delta, 0); - QWindowSystemInterface::handleWheelEvent(window, - QWindowsGeometryHint::mapFromGlobal(window, globalPos), + QWindowSystemInterface::handleWheelEvent(receiver, + QWindowsGeometryHint::mapFromGlobal(receiver, globalPos), globalPos, QPoint(), point, mods); } } diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9e931dbb3f..5951821462 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1174,11 +1174,11 @@ void QWindowsWindow::initialize() const Qt::WindowState state = w->windowState(); if (state != Qt::WindowMaximized && state != Qt::WindowFullScreen && creationContext->requestedGeometryIn != creationContext->obtainedGeometry) { - QWindowSystemInterface::handleGeometryChange(w, creationContext->obtainedGeometry); + QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(w, creationContext->obtainedGeometry); } QPlatformScreen *obtainedScreen = screenForGeometry(creationContext->obtainedGeometry); if (obtainedScreen && screen() != obtainedScreen) - QWindowSystemInterface::handleWindowScreenChanged(w, obtainedScreen->screen()); + QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(w, obtainedScreen->screen()); } } |