diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 7c48730d2a..83d54348b6 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -1091,16 +1091,14 @@ static LRESULT CALLBACK wnd_proc_common_internal(HWND hwnd, unsigned keysym = (lparam >> 16) & 0xff; bool extended = (lparam >> 24) & 0x1; + /* NumLock vs Pause correction */ + if (keysym == 0x45 && (wparam == VK_NUMLOCK || wparam == VK_PAUSE)) + extended = !extended; + /* extended keys will map to dinput if the high bit is set */ if (extended) keysym |= 0x80; - /* NumLock vs Pause correction */ - if (GetKeyState(VK_NUMLOCK) & 0x80 && extended) - keysym &= ~0x80; - else if (GetKeyState(VK_PAUSE) & 0x80 && !extended) - keysym |= 0x80; - keycode = input_keymaps_translate_keysym_to_rk(keysym); if (GetKeyState(VK_SHIFT) & 0x80) @@ -1344,16 +1342,14 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd, unsigned keysym = (lparam >> 16) & 0xff; bool extended = (lparam >> 24) & 0x1; + /* NumLock vs Pause correction */ + if (keysym == 0x45 && (wparam == VK_NUMLOCK || wparam == VK_PAUSE)) + extended = !extended; + /* extended keys will map to dinput if the high bit is set */ if (extended) keysym |= 0x80; - /* NumLock vs Pause correction */ - if (GetKeyState(VK_NUMLOCK) & 0x80 && extended) - keysym &= ~0x80; - else if (GetKeyState(VK_PAUSE) & 0x80 && !extended) - keysym |= 0x80; - keycode = input_keymaps_translate_keysym_to_rk(keysym); switch (keycode) {