From 826b2245ecd6e1764fc505a2a866c0e94f95ca7d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 19 Jan 2020 12:17:26 +0100 Subject: [PATCH] WndProcCommon - small optimization --- gfx/common/win32_common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 9bb809ad75..370f2fd73d 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -841,6 +841,8 @@ static LRESULT win32_menu_loop(HWND owner, WPARAM wparam) static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { + bool keydown = true; + switch (message) { case WM_NCLBUTTONDBLCLK: @@ -887,13 +889,15 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, return TRUE; case WM_KEYUP: case WM_SYSKEYUP: + /* Key released */ + keydown = false; + /* fall-through */ case WM_KEYDOWN: case WM_SYSKEYDOWN: *quit = true; { uint16_t mod = 0; unsigned keycode = 0; - bool keydown = true; unsigned keysym = (lparam >> 16) & 0xff; #if _WIN32_WINNT >= 0x0501 /* XP */ settings_t *settings = config_get_ptr(); @@ -928,10 +932,6 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message, #endif } - /* Key released? */ - if (message == WM_KEYUP || message == WM_SYSKEYUP) - keydown = false; - keycode = input_keymaps_translate_keysym_to_rk(keysym); input_keyboard_event(keydown, keycode,