diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-06-23 13:30:54 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-06-23 13:32:13 -0700 |
commit | fba818080be80667d95807c207ed1c78b1003653 (patch) | |
tree | 580ad95be2681731231cbcf589b09d54fae485e1 | |
parent | b15a58e688689b75563eb2936f7e19c949bca699 (diff) |
sdl_fb: quit on ESC keypress
Let's some a more user-friendly ways of exiting...
-rw-r--r-- | src/sdl_fb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sdl_fb.c b/src/sdl_fb.c index d1e3cd5..2a2ef19 100644 --- a/src/sdl_fb.c +++ b/src/sdl_fb.c @@ -272,6 +272,10 @@ static int sdl_ready() while (SDL_PollEvent(&ev)) { if (ev.type == SDL_QUIT) return -EPIPE; + + if (ev.type == SDL_KEYDOWN && + ev.key.keysym.sym == SDL_GetKeyFromScancode(SDL_SCANCODE_ESCAPE)) + return -EPIPE; } return 0; |