summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-04-26 13:23:03 +0200
committerraysan5 <[email protected]>2020-04-26 13:23:03 +0200
commit72cc3e053066e21f11ec31d90f8a459ff836857b (patch)
tree8840763877cdacc3308f6b4f438d5470ee7554bc /src/core.c
parent8e59ecb50c0bbf2e46c7c6cf8deb09a3c31c42e7 (diff)
downloadraylib-72cc3e053066e21f11ec31d90f8a459ff836857b.tar.gz
raylib-72cc3e053066e21f11ec31d90f8a459ff836857b.zip
Corrected issue #1203
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/core.c b/src/core.c
index 7c363214..7c994eab 100644
--- a/src/core.c
+++ b/src/core.c
@@ -5076,20 +5076,11 @@ static void *EventThread(void *arg)
// Make sure we got a valid keycode
if ((keycode > 0) && (keycode < sizeof(CORE.Input.Keyboard.currentKeyState)))
{
- /* Disabled buffer !!
- // Store the key information for raylib to later use
- CORE.Input.Keyboard.currentKeyState[keycode] = event.value;
- if (event.value > 0)
- {
- // Add the key int the fifo
- CORE.Input.Keyboard.lastKeyPressed.contents[CORE.Input.Keyboard.lastKeyPressed.head] = keycode; // Put the data at the front of the fifo snake
- CORE.Input.Keyboard.lastKeyPressed.head = (CORE.Input.Keyboard.lastKeyPressed.head + 1) & 0x07; // Increment the head pointer forwards and binary wraparound after 7 (fifo is 8 elements long)
- // TODO: This fifo is not fully threadsafe with multiple writers, so multiple keyboards hitting a key at the exact same time could miss a key (double write to head before it was incremented)
- }
- */
-
- CORE.Input.Keyboard.currentKeyState[keycode] = event.value;
- if (event.value == 1)
+ // WARNING: https://www.kernel.org/doc/Documentation/input/input.txt
+ // Event interface: 'value' is the value the event carries. Either a relative change for EV_REL,
+ // absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY for release, 1 for keypress and 2 for autorepeat
+ CORE.Input.Keyboard.currentKeyState[keycode] = (event.value >= 1)? 1 : 0;
+ if (event.value >= 1)
{
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = keycode; // Register last key pressed
CORE.Input.Keyboard.keyPressedQueueCount++;