From 36b70779b922afcbf70153d63f66f7f13220d2a7 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 17 Jan 2021 21:22:41 -0500 Subject: [PATCH] [client] app: move SDL key event handling out of main.c --- client/displayservers/SDL/sdl.c | 14 ++++++++++++++ client/src/main.c | 17 ----------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/client/displayservers/SDL/sdl.c b/client/displayservers/SDL/sdl.c index ba0d0672..8fb919bd 100644 --- a/client/displayservers/SDL/sdl.c +++ b/client/displayservers/SDL/sdl.c @@ -109,6 +109,20 @@ static bool sdlEventFilter(SDL_Event * event) return true; } + case SDL_KEYDOWN: + { + SDL_Scancode sc = event->key.keysym.scancode; + app_handleKeyPress(sc); + break; + } + + case SDL_KEYUP: + { + SDL_Scancode sc = event->key.keysym.scancode; + app_handleKeyRelease(sc); + break; + } + case SDL_WINDOWEVENT: switch(event->window.event) { diff --git a/client/src/main.c b/client/src/main.c index 4976821e..56e7eb36 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1455,23 +1455,6 @@ int eventFilter(void * userdata, SDL_Event * event) return 0; } - switch(event->type) - { - case SDL_KEYDOWN: - { - SDL_Scancode sc = event->key.keysym.scancode; - app_handleKeyPress(sc); - break; - } - - case SDL_KEYUP: - { - SDL_Scancode sc = event->key.keysym.scancode; - app_handleKeyRelease(sc); - break; - } - } - // consume all events return 0; }