Deliver wheel events when window is null

The generic input plugins do not set the window parameter. So,
use the same technique we use with mouse event handling to determine
the window to deliver the event to.

Done-with: Johannes Zellner

Change-Id: I950c0ad2f330dccfdcc41b8d01f62cd39902bc9c
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
This commit is contained in:
Girish Ramakrishnan 2012-06-12 10:59:27 -07:00 committed by Qt by Nokia
parent 4618bc3ea0
commit 7020c2fe2a

View File

@ -1255,16 +1255,18 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
{ {
if (!e->window) QWindow *window = e->window.data();
return;
QPointF globalPoint = e->globalPos; QPointF globalPoint = e->globalPos;
if (!window) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
if (!window)
return;
}
QGuiApplicationPrivate::lastCursorPosition = globalPoint; QGuiApplicationPrivate::lastCursorPosition = globalPoint;
modifier_buttons = e->modifiers; modifier_buttons = e->modifiers;
QWindow *window = e->window.data();
if (window) {
if (window->d_func()->blockedByModalWindow) { if (window->d_func()->blockedByModalWindow) {
// a modal window is blocking this window, don't allow wheel events through // a modal window is blocking this window, don't allow wheel events through
return; return;
@ -1273,8 +1275,6 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
QWheelEvent ev(e->localPos, e->globalPos, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, buttons, e->modifiers); QWheelEvent ev(e->localPos, e->globalPos, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, buttons, e->modifiers);
ev.setTimestamp(e->timestamp); ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev); QGuiApplication::sendSpontaneousEvent(window, &ev);
return;
}
} }
// Remember, Qt convention is: keyboard state is state *before* // Remember, Qt convention is: keyboard state is state *before*