mirror of https://github.com/encounter/SDL.git
Windows: Alt-F4 hotkey should be checked on keydown, not keyup (thanks, Matt!).
Fixes Bugzilla #2780.
This commit is contained in:
parent
72a244da41
commit
41908548b9
|
@ -549,6 +549,16 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_SYSKEYDOWN:
|
||||
{
|
||||
SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam);
|
||||
const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
|
||||
|
||||
/* Detect relevant keyboard shortcuts */
|
||||
if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) {
|
||||
/* ALT+F4: Close window */
|
||||
if (code == SDL_SCANCODE_F4) {
|
||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (code != SDL_SCANCODE_UNKNOWN) {
|
||||
SDL_SendKeyboardKey(SDL_PRESSED, code);
|
||||
}
|
||||
|
@ -577,14 +587,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam);
|
||||
const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
|
||||
|
||||
/* Detect relevant keyboard shortcuts */
|
||||
if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) {
|
||||
/* ALT+F4: Close window */
|
||||
if (code == SDL_SCANCODE_F4) {
|
||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (code != SDL_SCANCODE_UNKNOWN) {
|
||||
if (code == SDL_SCANCODE_PRINTSCREEN &&
|
||||
keyboardState[code] == SDL_RELEASED) {
|
||||
|
|
Loading…
Reference in New Issue