if ( i > 0 )
e = &realevent;
+ // the pointer is on the wrong screen
+ if (! e->xmotion.same_screen)
+ break;
+
// strip the lock key modifiers
- e->xbutton.state &= ~(NumLockMask | ScrollLockMask | LockMask);
+ e->xmotion.state &= ~(NumLockMask | ScrollLockMask | LockMask);
last_time = e->xmotion.time;