Skip to content

Commit

Permalink
EVENTS: Rename synthetic to kbdRepeat
Browse files Browse the repository at this point in the history
  • Loading branch information
bgK committed Nov 19, 2017
1 parent 7689fd7 commit 8beb519
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions backends/events/default/default-events.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/android/events.cpp
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion backends/platform/tizen/form.cpp
Expand Up @@ -243,7 +243,6 @@ void TizenAppForm::pushEvent(Common::EventType type, const Point &currentPositio
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;
Expand Down
1 change: 0 additions & 1 deletion backends/vkeybd/virtual-keyboard.cpp
Expand Up @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions common/events.h
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/recorderfile.cpp
Expand Up @@ -390,7 +390,7 @@ void PlaybackFile::readEvent(RecorderEvent& event) {
}
break;
}
event.synthetic = true;
event.kbdRepeat = true;
}

void PlaybackFile::readEventsToBuffer(uint32 size) {
Expand Down
16 changes: 8 additions & 8 deletions engines/agi/keyboard.cpp
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion engines/dm/eventman.cpp
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions gui/EventRecorder.cpp
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -445,7 +445,7 @@ Common::List<Common::Event> 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<Common::Event>();
}
return Common::DefaultEventMapper::mapEvent(ev, source);
Expand Down

0 comments on commit 8beb519

Please sign in to comment.