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()
{
const QPoint last = currentPos();
const uint16_t lastMask = m_buttonMask;
static QPoint lastPos = currentPos();
static uint16_t lastMask = m_buttonMask;
doGetPos(); // Update if needed
if (last != currentPos() || lastMask != m_buttonMask) {
emit mouseChanged(currentPos(), last,
if (lastPos != currentPos() || lastMask != m_buttonMask) {
emit mouseChanged(currentPos(), lastPos,
x11ToQtMouseButtons(m_buttonMask), x11ToQtMouseButtons(lastMask),
x11ToQtKeyboardModifiers(m_buttonMask), x11ToQtKeyboardModifiers(lastMask));
lastPos = currentPos();
lastMask = m_buttonMask;
}
}