From 7941659ad049143f7a0946a48bc8c384bcfca32d Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Tue, 15 Jun 2021 15:26:04 +0300 Subject: [PATCH] Ignore key events in message pump if they aren't accelerators. Fixes alt-f4 closing sdl renderer window. --- src/win/win_ui.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 002cb270d..0c74499a9 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -1533,7 +1533,15 @@ ui_init(int nCmdShow) break; } - if (! TranslateAccelerator(hwnd, haccel, &messages)) { + if (! TranslateAccelerator(hwnd, haccel, &messages)) + { + /* Don't process other keypresses. */ + if (messages.message == WM_SYSKEYDOWN || + messages.message == WM_SYSKEYUP || + messages.message == WM_KEYDOWN || + messages.message == WM_KEYUP) + continue; + TranslateMessage(&messages); DispatchMessage(&messages); }