aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBastien Bouclet2017-11-24 19:37:58 +0100
committerGitHub2017-11-24 19:37:58 +0100
commit5ed745f5329a54d33f1b1551569cf9856990bea1 (patch)
treee444facb6330945c3ee03c6252b386dc8e70acad /common
parentc5caf9825e0d02036795afa87f49b7aa274cc983 (diff)
parentacf87add2751ae68298f4d5b5480635d06b0ec5e (diff)
downloadscummvm-rg350-5ed745f5329a54d33f1b1551569cf9856990bea1.tar.gz
scummvm-rg350-5ed745f5329a54d33f1b1551569cf9856990bea1.tar.bz2
scummvm-rg350-5ed745f5329a54d33f1b1551569cf9856990bea1.zip
Merge pull request #1063 from bgK/keyboard-repeat
SDL2: Improve handling of keyboard repeat events
Diffstat (limited to 'common')
-rw-r--r--common/events.h18
-rw-r--r--common/recorderfile.cpp2
2 files changed, 14 insertions, 6 deletions
diff --git a/common/events.h b/common/events.h
index e5bb8cab50..a514ea291e 100644
--- a/common/events.h
+++ b/common/events.h
@@ -90,22 +90,29 @@ enum EventType {
};
typedef uint32 CustomEventType;
+
/**
* Data structure for an event. A pointer to an instance of Event
* can be passed to pollEvent.
*/
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.
*/
KeyState kbd;
+
/**
* The mouse coordinates, in virtual screen coordinates. Only valid
* for mouse events.
@@ -120,7 +127,7 @@ struct Event {
CustomEventType customType;
#endif
- Event() : type(EVENT_INVALID), synthetic(false) {
+ Event() : type(EVENT_INVALID), kbdRepeat(false) {
#ifdef ENABLE_KEYMAPPER
customType = 0;
#endif
@@ -383,6 +390,7 @@ public:
* @note called after graphics system has been set up
*/
virtual void init() {}
+
/**
* Get the next event in the event queue.
* @param event point to an Event struct, which will be filled with the event data.
diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp
index 71f8272b44..1f283715d0 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) {