From cf2a75e41bc6715958d170d42f37fc6bb609f830 Mon Sep 17 00:00:00 2001 From: Jon Severinsson Date: Tue, 23 Oct 2012 18:52:29 +0200 Subject: Fix QGuiApplication::keyboardModifiers() and QGuiApplication::mouseButtons() Previous commit b2363a935c8dac fixed keyboardModifiers() after QPA event processing, but broke QTestLib, which expects spontaneous input events sent to qApp->notify() to update keyboardModifiers() and mouseButtons(). The commit also did not fix mouseButtons() after QPA event processing, and missed keyboardModifiers() after QPA Tablet event processing. This commit fixes all these shortcommings in b2363a935c8dac. Includes test case by David Faure Task-Number: QTBUG-26887 Change-Id: I8518b06c4ce86ea7b35120e3353a45ea2a81d356 Reviewed-by: David Faure (KDE) Reviewed-by: Lars Knoll --- src/gui/kernel/qguiapplication.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gui/kernel/qguiapplication.cpp') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 72e95c996c..190d52776a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1392,7 +1392,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo // Ignore mouse events that don't change the current state. return; } - buttons = e->buttons; + mouse_buttons = buttons = e->buttons; if (button & e->buttons) { ulong doubleClickInterval = static_cast(qApp->styleHints()->mouseDoubleClickInterval()); doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton; @@ -1688,7 +1688,10 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T type = e->down ? QEvent::TabletPress : QEvent::TabletRelease; tabletState = e->down; } + QWindow *window = e->window.data(); + modifier_buttons = e->modifiers; + bool localValid = true; // If window is null, pick one based on the global position and make sure all // subsequent events up to the release are delivered to that same window. @@ -1719,7 +1722,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T QTabletEvent ev(type, local, e->global, e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt, e->tangentialPressure, e->rotation, e->z, - e->mods, e->uid); + e->modifiers, e->uid); ev.setTimestamp(e->timestamp); QGuiApplication::sendSpontaneousEvent(window, &ev); #else -- cgit v1.2.3