mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-19 01:12:33 +00:00
Use XLookupKeysym instead. Add test.
XKeycodeToKeysym is deprecated.
This commit is contained in:
parent
94f89b4a70
commit
6709dcb274
@ -222,13 +222,13 @@ static void gfx_ctx_check_window(bool *quit,
|
||||
{
|
||||
static XComposeStatus state;
|
||||
char keybuf[32];
|
||||
const unsigned x_keycode = XKeycodeToKeysym(g_dpy, event.xkey.keycode, 0);
|
||||
const unsigned x_keycode = XLookupKeysym(&event.xkey, 0);
|
||||
|
||||
bool down = event.type == KeyPress;
|
||||
uint32_t character = 0;
|
||||
unsigned key = RETROK_UNKNOWN;
|
||||
|
||||
for (int i = 0; i != RETROK_LAST; i ++)
|
||||
for (int i = 0; i < RETROK_LAST; i++)
|
||||
{
|
||||
if (keysym_lut[i] == x_keycode)
|
||||
{
|
||||
|
@ -187,6 +187,13 @@ void retro_run(void)
|
||||
render_audio();
|
||||
}
|
||||
|
||||
static void keyboard_cb(bool down, unsigned keycode,
|
||||
uint32_t character, uint16_t mod)
|
||||
{
|
||||
fprintf(stderr, "Down: %s, Code: %d, Char: %u, Mod: %u.\n",
|
||||
down ? "yes" : "no", keycode, character, mod);
|
||||
}
|
||||
|
||||
bool retro_load_game(const struct retro_game_info *info)
|
||||
{
|
||||
struct retro_input_descriptor desc[] = {
|
||||
@ -206,6 +213,9 @@ bool retro_load_game(const struct retro_game_info *info)
|
||||
return false;
|
||||
}
|
||||
|
||||
struct retro_keyboard_callback cb = { keyboard_cb };
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb);
|
||||
|
||||
(void)info;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user