summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorkernelkinetic <[email protected]>2020-11-03 23:39:56 +0100
committerGitHub <[email protected]>2020-11-03 23:39:56 +0100
commitf46514b855f5790b9ccef440ce8df2c84ce92415 (patch)
treee7607c8893a250c91f684db2a205d61d1ecc1587 /src/core.c
parent05ab39ed9f995fc5577fa72a0a5338eff2460cd8 (diff)
downloadraylib-f46514b855f5790b9ccef440ce8df2c84ce92415.tar.gz
raylib-f46514b855f5790b9ccef440ce8df2c84ce92415.zip
Fixed keyboard stuttering but for cmake only (#1422)
* fixed mouse movements are bound to the screen resolution (https://github.com/raysan5/raylib/issues/1392) * fixed keyboard stuttering on PLATFORM_RPI and PLATFORM_DRM (https://github.com/raysan5/raylib/issues/1392) * fixed keyboard stuttering on PLATFORM_RPI and PLATFORM_DRM (https://github.com/raysan5/raylib/issues/1392)
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c
index ff9687de..6e4425e9 100644
--- a/src/core.c
+++ b/src/core.c
@@ -4873,7 +4873,7 @@ static void ProcessKeyboard(void)
bufferByteCount = read(STDIN_FILENO, keysBuffer, MAX_KEYBUFFER_SIZE); // POSIX system call
// Reset pressed keys array (it will be filled below)
- for (int i = 0; i < 512; i++) CORE.Input.Keyboard.currentKeyState[i] = 0;
+ if (bufferByteCount > 0) for (int i = 0; i < 512; i++) CORE.Input.Keyboard.currentKeyState[i] = 0;
// Check keys from event input workers (This is the new keyboard reading method)
//for (int i = 0; i < 512; i++) CORE.Input.Keyboard.currentKeyState[i] = CORE.Input.Keyboard.currentKeyStateEvdev[i];
@@ -5253,7 +5253,7 @@ static void *EventThread(void *arg)
while (!CORE.Window.shouldClose)
{
// Try to read data from the device and only continue if successful
- if (read(worker->fd, &event, sizeof(event)) == (int)sizeof(event))
+ while(read(worker->fd, &event, sizeof(event)) == (int)sizeof(event))
{
// Relative movement parsing
if (event.type == EV_REL)
@@ -5421,7 +5421,7 @@ static void *EventThread(void *arg)
#endif
}
}
- else Wait(5); // Sleep for 5ms to avoid hogging CPU time
+ Wait(5); // Sleep for 5ms to avoid hogging CPU time
}
close(worker->fd);