aboutsummaryrefslogtreecommitdiff
path: root/backends/events
diff options
context:
space:
mode:
Diffstat (limited to 'backends/events')
-rw-r--r--backends/events/default/default-events.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 85cf44c960..86c56eadd2 100644
--- a/backends/events/default/default-events.cpp
+++ b/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: