summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 814291c54a..17851618b4 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -395,10 +395,24 @@ 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)) {
- QWindowSystemInterface::handleWheelEvent(window,
- QWindowsGeometryHint::mapFromGlobal(window, globalPos),
+
+ 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) {
+ QWindowSystemInterface::handleWheelEvent(receiver,
+ QWindowsGeometryHint::mapFromGlobal(receiver, globalPos),
globalPos, delta, orientation, mods);
}
}