Correctly detect mouseChanged between polls.

REVIEW: 112392
BUG: 323979
FIXED-IN: 4.11.2
This commit is contained in:
Michael Chang 2013-09-02 08:00:32 -07:00 committed by Martin Gräßlin
parent 29e230dca3
commit f62162eb41

View file

@ -227,13 +227,15 @@ void X11Cursor::doStopCursorTracking()
void X11Cursor::mousePolled() void X11Cursor::mousePolled()
{ {
const QPoint last = currentPos(); static QPoint lastPos = currentPos();
const uint16_t lastMask = m_buttonMask; static uint16_t lastMask = m_buttonMask;
doGetPos(); // Update if needed doGetPos(); // Update if needed
if (last != currentPos() || lastMask != m_buttonMask) { if (lastPos != currentPos() || lastMask != m_buttonMask) {
emit mouseChanged(currentPos(), last, emit mouseChanged(currentPos(), lastPos,
x11ToQtMouseButtons(m_buttonMask), x11ToQtMouseButtons(lastMask), x11ToQtMouseButtons(m_buttonMask), x11ToQtMouseButtons(lastMask),
x11ToQtKeyboardModifiers(m_buttonMask), x11ToQtKeyboardModifiers(lastMask)); x11ToQtKeyboardModifiers(m_buttonMask), x11ToQtKeyboardModifiers(lastMask));
lastPos = currentPos();
lastMask = m_buttonMask;
} }
} }