mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 18:40:09 +00:00
Rename to gfx/context/win32_common.c to input/keyboard_event_win32.c
This commit is contained in:
parent
e3d3316502
commit
9214469470
@ -615,7 +615,7 @@ endif
|
|||||||
|
|
||||||
ifneq ($(findstring Win32,$(OS)),)
|
ifneq ($(findstring Win32,$(OS)),)
|
||||||
OBJ += media/rarch.o \
|
OBJ += media/rarch.o \
|
||||||
gfx/context/win32_common.o
|
input/keyboard_event_win32.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Record
|
# Record
|
||||||
|
@ -351,7 +351,7 @@ INPUT
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_XBOX)
|
#if defined(_WIN32) && !defined(_XBOX)
|
||||||
#include "../gfx/context/win32_common.c"
|
#include "../input/keyboard_event_win32.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__CELLOS_LV2__)
|
#if defined(__CELLOS_LV2__)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
/* RetroArch - A frontend for libretro.
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
|
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||||
*
|
*
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||||
* of the GNU General Public License as published by the Free Software Found-
|
* of the GNU General Public License as published by the Free Software Found-
|
||||||
@ -13,61 +14,50 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../general.h"
|
#include "../general.h"
|
||||||
#include "../../input/keyboard_line.h"
|
#include "keyboard_line.h"
|
||||||
#include "win32_common.h"
|
#include "../gfx/context/win32_common.h"
|
||||||
#include "../../input/input_common.h"
|
#include "input_common.h"
|
||||||
#include "../../input/input_keymaps.h"
|
#include "input_keymaps.h"
|
||||||
|
|
||||||
LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
|
LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
|
||||||
|
WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
|
unsigned scancode = (lparam >> 16) & 0xff;
|
||||||
|
unsigned keycode = input_translate_keysym_to_rk(scancode);
|
||||||
uint16_t mod = 0;
|
uint16_t mod = 0;
|
||||||
mod |= (GetKeyState(VK_SHIFT) & 0x80) ? RETROKMOD_SHIFT : 0;
|
mod |= (GetKeyState(VK_SHIFT) & 0x80) ? RETROKMOD_SHIFT : 0;
|
||||||
mod |= (GetKeyState(VK_CONTROL) & 0x80) ? RETROKMOD_CTRL : 0;
|
mod |= (GetKeyState(VK_CONTROL) & 0x80) ? RETROKMOD_CTRL : 0;
|
||||||
mod |= (GetKeyState(VK_MENU) & 0x80) ? RETROKMOD_ALT : 0;
|
mod |= (GetKeyState(VK_MENU) & 0x80) ? RETROKMOD_ALT : 0;
|
||||||
mod |= (GetKeyState(VK_CAPITAL) & 0x81) ? RETROKMOD_CAPSLOCK : 0;
|
mod |= (GetKeyState(VK_CAPITAL) & 0x81) ? RETROKMOD_CAPSLOCK : 0;
|
||||||
mod |= (GetKeyState(VK_SCROLL) & 0x81) ? RETROKMOD_SCROLLOCK : 0;
|
mod |= (GetKeyState(VK_SCROLL) & 0x81) ? RETROKMOD_SCROLLOCK : 0;
|
||||||
mod |= ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80) ? RETROKMOD_META : 0;
|
mod |= ((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x80) ?
|
||||||
|
RETROKMOD_META : 0;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
// Seems to be hard to synchronize WM_CHAR and WM_KEYDOWN properly.
|
/* Seems to be hard to synchronize
|
||||||
|
* WM_CHAR and WM_KEYDOWN properly.
|
||||||
|
*/
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
{
|
|
||||||
input_keyboard_event(true, RETROK_UNKNOWN, wparam, mod);
|
input_keyboard_event(true, RETROK_UNKNOWN, wparam, mod);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
{
|
/* DirectInput uses scancodes directly. */
|
||||||
// DirectInput uses scancodes directly.
|
|
||||||
unsigned scancode = (lparam >> 16) & 0xff;
|
|
||||||
unsigned keycode = input_translate_keysym_to_rk(scancode);
|
|
||||||
input_keyboard_event(true, keycode, 0, mod);
|
input_keyboard_event(true, keycode, 0, mod);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
{
|
/* DirectInput uses scancodes directly. */
|
||||||
// DirectInput uses scancodes directly.
|
|
||||||
unsigned scancode = (lparam >> 16) & 0xff;
|
|
||||||
unsigned keycode = input_translate_keysym_to_rk(scancode);
|
|
||||||
input_keyboard_event(false, keycode, 0, mod);
|
input_keyboard_event(false, keycode, 0, mod);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
{
|
|
||||||
unsigned scancode = (lparam >> 16) & 0xff;
|
|
||||||
unsigned keycode = input_translate_keysym_to_rk(scancode);
|
|
||||||
input_keyboard_event(false, keycode, 0, mod);
|
input_keyboard_event(false, keycode, 0, mod);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
{
|
|
||||||
unsigned scancode = (lparam >> 16) & 0xff;
|
|
||||||
unsigned keycode = input_translate_keysym_to_rk(scancode);
|
|
||||||
input_keyboard_event(true, keycode, 0, mod);
|
input_keyboard_event(true, keycode, 0, mod);
|
||||||
|
|
||||||
switch (wparam)
|
switch (wparam)
|
||||||
@ -78,7 +68,6 @@ LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message, WPARAM wparam, LPAR
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, message, wparam, lparam);
|
return DefWindowProc(hwnd, message, wparam, lparam);
|
Loading…
x
Reference in New Issue
Block a user