mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 15:32:59 +00:00
(keyboard_event_win32.cpp) More simplifications
This commit is contained in:
parent
b5573f0463
commit
4e6cb53920
@ -25,7 +25,8 @@ LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
|
||||
{
|
||||
unsigned scancode = (lparam >> 16) & 0xff;
|
||||
unsigned keycode = input_keymaps_translate_keysym_to_rk(scancode);
|
||||
uint16_t mod = 0;
|
||||
uint16_t mod = 0;
|
||||
bool keydown = true;
|
||||
|
||||
if (GetKeyState(VK_SHIFT) & 0x80)
|
||||
mod |= RETROKMOD_SHIFT;
|
||||
@ -46,7 +47,7 @@ LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
|
||||
* WM_CHAR and WM_KEYDOWN properly.
|
||||
*/
|
||||
case WM_CHAR:
|
||||
input_keyboard_event(true, RETROK_UNKNOWN, wparam, mod,
|
||||
input_keyboard_event(keydown, RETROK_UNKNOWN, wparam, mod,
|
||||
RETRO_DEVICE_KEYBOARD);
|
||||
return TRUE;
|
||||
|
||||
@ -54,32 +55,29 @@ LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
|
||||
case WM_SYSKEYUP:
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
{
|
||||
bool keydown = false;
|
||||
switch (message)
|
||||
{
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
keydown = true;
|
||||
break;
|
||||
}
|
||||
/* DirectInput uses scancodes directly. */
|
||||
input_keyboard_event(keydown, keycode, 0, mod,
|
||||
RETRO_DEVICE_KEYBOARD);
|
||||
/* Key released? */
|
||||
if (message == WM_KEYUP || message == WM_SYSKEYUP)
|
||||
keydown = false;
|
||||
|
||||
/* DirectInput uses scancodes directly. */
|
||||
input_keyboard_event(keydown, keycode, 0, mod,
|
||||
RETRO_DEVICE_KEYBOARD);
|
||||
|
||||
if (message == WM_SYSKEYDOWN)
|
||||
{
|
||||
switch (wparam)
|
||||
{
|
||||
case VK_F10:
|
||||
case VK_MENU:
|
||||
case VK_RSHIFT:
|
||||
if (message == WM_SYSKEYDOWN)
|
||||
return 0;
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (message != WM_SYSKEYDOWN)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user