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:
parent
b145201128
commit
9c707f140e
@ -395,10 +395,24 @@ static bool isValidWheelReceiver(QWindow *candidate)
|
|||||||
static void redirectWheelEvent(QWindow *window, const QPoint &globalPos, int delta,
|
static void redirectWheelEvent(QWindow *window, const QPoint &globalPos, int delta,
|
||||||
Qt::Orientation orientation, Qt::KeyboardModifiers mods)
|
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 a window is blocked by modality, it can't get the event.
|
||||||
if (isValidWheelReceiver(window)) {
|
|
||||||
QWindowSystemInterface::handleWheelEvent(window,
|
QWindow *receiver = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE);
|
||||||
QWindowsGeometryHint::mapFromGlobal(window, globalPos),
|
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);
|
globalPos, delta, orientation, mods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user