diff options
author | Le Philousophe | 2019-05-21 17:42:55 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-05-22 00:14:56 +0200 |
commit | dc0bfbc7241c0085f5dabb80b051f82b77187952 (patch) | |
tree | 8fdf2c3d92daf88ee4ec88780af3dfe4eb4f67fa /backends/events/default | |
parent | d2b8f9284caa2e8e1e632b8382875c3f2b90c257 (diff) | |
download | scummvm-rg350-dc0bfbc7241c0085f5dabb80b051f82b77187952.tar.gz scummvm-rg350-dc0bfbc7241c0085f5dabb80b051f82b77187952.tar.bz2 scummvm-rg350-dc0bfbc7241c0085f5dabb80b051f82b77187952.zip |
COMMON: Fix button state desynchronization when warping mouse
Diffstat (limited to 'backends/events/default')
-rw-r--r-- | backends/events/default/default-events.cpp | 19 |
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: |