Skip to content

Commit

Permalink
Add support for the numeric keypad enter key when toggling fullscreen…
Browse files Browse the repository at this point in the history
…, and when typing a hostname/IP address
  • Loading branch information
techknight committed Dec 1, 2023
1 parent fb2eb70 commit 33ff938
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/sdl/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static void getevents(void)
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_LALT) {
if (event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_RALT) {
altdown = 1;
} else if (event.key.keysym.sym == SDLK_LCTRL
|| event.key.keysym.sym == SDLK_RCTRL) {
Expand All @@ -616,12 +616,17 @@ static void getevents(void)
swinitlevel();
} else if (ctrldown && event.key.keysym.sym == SDLK_q && !isNetworkGame()) {
swrestart();
} else if (event.key.keysym.sym == SDLK_RETURN) {
if (altdown) {
} else if (altdown && (event.key.keysym.sym == SDLK_RETURN || event.key.keysym.sym == SDLK_KP_ENTER)) {
vid_fullscreen = !vid_fullscreen;
Vid_Reset();
altdown = 0;
continue;
} else if (!altdown && event.key.keysym.sym == SDLK_KP_ENTER && SDL_IsTextInputActive()) {
SDL_Keysym fake;
fake.sym = '\n';
fake.scancode = SDL_SCANCODE_UNKNOWN;
input_buffer_push(fake);
continue;
}
}
if (!SDL_IsTextInputActive()
|| IsSpecialKey(&event.key.keysym)) {
Expand All @@ -635,7 +640,7 @@ static void getevents(void)
break;

case SDL_KEYUP:
if (event.key.keysym.sym == SDLK_LALT) {
if (event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_RALT) {
altdown = 0;
} else if (event.key.keysym.sym == SDLK_LCTRL
|| event.key.keysym.sym == SDLK_RCTRL) {
Expand Down

0 comments on commit 33ff938

Please sign in to comment.