Skip to content
Permalink
Browse files

COMMON: Fix button state desynchronization when warping mouse

  • Loading branch information...
lephilousophe authored and sev- committed May 21, 2019
1 parent d2b8f92 commit dc0bfbc7241c0085f5dabb80b051f82b77187952
Showing with 18 additions and 1 deletion.
  1. +18 −1 backends/events/default/default-events.cpp
@@ -281,15 +281,32 @@ void DefaultEventManager::purgeMouseEvents() {
while (!_eventQueue.empty()) {
Common::Event event = _eventQueue.pop();
switch (event.type) {
case Common::EVENT_MOUSEMOVE:
// Update button state even when purging events to avoid desynchronisation with real button state
case Common::EVENT_LBUTTONDOWN:
_mousePos = event.mouse;
_buttonState |= LBUTTON;
break;

case Common::EVENT_LBUTTONUP:
_mousePos = event.mouse;
_buttonState &= ~LBUTTON;
break;

case Common::EVENT_RBUTTONDOWN:
_mousePos = event.mouse;
_buttonState |= RBUTTON;
break;

case Common::EVENT_RBUTTONUP:
_mousePos = event.mouse;
_buttonState &= ~RBUTTON;
break;

case Common::EVENT_WHEELUP:
case Common::EVENT_WHEELDOWN:
case Common::EVENT_MBUTTONDOWN:
case Common::EVENT_MBUTTONUP:
case Common::EVENT_MOUSEMOVE:
// do nothing
break;
default:

0 comments on commit dc0bfbc

Please sign in to comment.
You can’t perform that action at this time.