Windows Platform: Redirect wheel event to a window under mouse cursor

Revert a part of af5c8d04fb
which affected mouse wheel event redirection.

Task-number: QTBUG-63979
Change-Id: Ice88675aadbb8a7477b3758a607db5979d62562c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandra Cherdantseva <neluhus.vagus@gmail.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Alexandra Cherdantseva 2017-12-13 17:29:49 +03:00
parent b145201128
commit 9c707f140e

View File

@ -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);
}
}