From 8beb519c5ea2964ce409aabbe03b54afe37e0ac1 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 9 Sep 2017 16:43:55 +0200 Subject: [PATCH] EVENTS: Rename synthetic to kbdRepeat --- backends/events/default/default-events.cpp | 4 ++-- backends/platform/android/events.cpp | 2 +- backends/platform/tizen/form.cpp | 1 - backends/vkeybd/virtual-keyboard.cpp | 1 - common/events.h | 12 +++++++----- common/recorderfile.cpp | 2 +- engines/agi/keyboard.cpp | 16 ++++++++-------- engines/dm/eventman.cpp | 2 +- gui/EventRecorder.cpp | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 667914b023c..ad7cfced862 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -97,7 +97,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { } if (result) { - event.synthetic = false; + event.kbdRepeat = false; switch (event.type) { case Common::EVENT_KEYDOWN: _modifierState = event.kbd.flags; @@ -233,7 +233,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { if (_currentKeyDown.keycode != 0 && _keyRepeatTime < time) { // fire event event.type = Common::EVENT_KEYDOWN; - event.synthetic = true; + event.kbdRepeat = true; event.kbd.ascii = _currentKeyDown.ascii; event.kbd.keycode = (Common::KeyCode)_currentKeyDown.keycode; event.kbd.flags = _currentKeyDown.flags; diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index b146945a01b..d13d381f952 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -443,7 +443,7 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, } if (arg5 > 0) - e.synthetic = true; + e.kbdRepeat = true; // map special keys to 'our' ascii codes switch (e.kbd.keycode) { diff --git a/backends/platform/tizen/form.cpp b/backends/platform/tizen/form.cpp index 2a9a3967cc8..22e15f61c41 100644 --- a/backends/platform/tizen/form.cpp +++ b/backends/platform/tizen/form.cpp @@ -243,7 +243,6 @@ void TizenAppForm::pushEvent(Common::EventType type, const Point ¤tPositio void TizenAppForm::pushKey(Common::KeyCode keycode) { if (_eventQueueLock) { Common::Event e; - e.synthetic = false; e.kbd.keycode = keycode; e.kbd.ascii = keycode; e.kbd.flags = 0; diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index ce19e9d4625..80d7313a8cb 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -242,7 +242,6 @@ void VirtualKeyboard::show() { // push keydown & keyup events into the event manager Event evt; - evt.synthetic = false; while (!_keyQueue.empty()) { evt.kbd = _keyQueue.pop(); evt.type = EVENT_KEYDOWN; diff --git a/common/events.h b/common/events.h index e5bb8cab503..d5eb59fdd41 100644 --- a/common/events.h +++ b/common/events.h @@ -97,10 +97,12 @@ typedef uint32 CustomEventType; struct Event { /** The type of the event. */ EventType type; - /** Flag to indicate if the event is real or synthetic. E.g. keyboard - * repeat events are synthetic. - */ - bool synthetic; + /** + * True if this is a key down repeat event. + * + * Only valid for EVENT_KEYDOWN events. + */ + bool kbdRepeat; /** * Keyboard data; only valid for keyboard events (EVENT_KEYDOWN and * EVENT_KEYUP). For all other event types, content is undefined. @@ -120,7 +122,7 @@ struct Event { CustomEventType customType; #endif - Event() : type(EVENT_INVALID), synthetic(false) { + Event() : type(EVENT_INVALID), kbdRepeat(false) { #ifdef ENABLE_KEYMAPPER customType = 0; #endif diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp index 71f8272b444..1f283715d08 100644 --- a/common/recorderfile.cpp +++ b/common/recorderfile.cpp @@ -390,7 +390,7 @@ void PlaybackFile::readEvent(RecorderEvent& event) { } break; } - event.synthetic = true; + event.kbdRepeat = true; } void PlaybackFile::readEventsToBuffer(uint32 size) { diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index 8fb49fdf024..8fd30eda546 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -164,42 +164,42 @@ void AgiEngine::processScummVMEvents() { switch (event.kbd.keycode) { case Common::KEYCODE_LEFT: case Common::KEYCODE_KP4: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_LEFT; break; case Common::KEYCODE_RIGHT: case Common::KEYCODE_KP6: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_RIGHT; break; case Common::KEYCODE_UP: case Common::KEYCODE_KP8: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_UP; break; case Common::KEYCODE_DOWN: case Common::KEYCODE_KP2: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_DOWN; break; case Common::KEYCODE_PAGEUP: case Common::KEYCODE_KP9: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_UP_RIGHT; break; case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_KP3: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_DOWN_RIGHT; break; case Common::KEYCODE_HOME: case Common::KEYCODE_KP7: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_UP_LEFT; break; case Common::KEYCODE_END: case Common::KEYCODE_KP1: - if (_allowSynthetic || !event.synthetic) + if (_allowSynthetic || !event.kbdRepeat) key = AGI_KEY_DOWN_LEFT; break; case Common::KEYCODE_KP5: diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index f424672b675..1d914bb1834 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -609,7 +609,7 @@ Common::EventType EventManager::processInput(Common::Event *grabKey, Common::Eve while (g_system->getEventManager()->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: { - if (event.synthetic) + if (event.kbdRepeat) break; if (event.kbd.keycode == Common::KEYCODE_d && event.kbd.hasFlags(Common::KBD_CTRL)) { diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index 3f91cfa259e..f1b486d3948 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -177,7 +177,7 @@ bool EventRecorder::processDelayMillis() { } void EventRecorder::checkForKeyCode(const Common::Event &event) { - if ((event.type == Common::EVENT_KEYDOWN) && (event.kbd.flags & Common::KBD_CTRL) && (event.kbd.keycode == Common::KEYCODE_p) && (!event.synthetic)) { + if ((event.type == Common::EVENT_KEYDOWN) && (event.kbd.flags & Common::KBD_CTRL) && (event.kbd.keycode == Common::KEYCODE_p) && (!event.kbdRepeat)) { togglePause(); } } @@ -445,7 +445,7 @@ Common::List EventRecorder::mapEvent(const Common::Event &ev, Com evt.mouse.y = evt.mouse.y * (g_system->getOverlayHeight() / g_system->getHeight()); switch (_recordMode) { case kRecorderPlayback: - if (ev.synthetic != true) { + if (ev.kbdRepeat != true) { return Common::List(); } return Common::DefaultEventMapper::mapEvent(ev, source);