mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Fix mod-handling in X11.
This commit is contained in:
parent
3a8608fb70
commit
b809a59720
@ -266,18 +266,27 @@ void x11_handle_key_event(XEvent *event)
|
|||||||
if (!g_extern.system.key_event)
|
if (!g_extern.system.key_event)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static XComposeStatus state;
|
|
||||||
char keybuf[32];
|
char keybuf[32];
|
||||||
|
|
||||||
bool down = event->type == KeyPress;
|
bool down = event->type == KeyPress;
|
||||||
uint32_t character = 0;
|
uint32_t character = 0;
|
||||||
unsigned key = input_translate_keysym_to_rk(XLookupKeysym(&event->xkey, 0));
|
unsigned key = input_translate_keysym_to_rk(XLookupKeysym(&event->xkey, 0));
|
||||||
|
|
||||||
// FIXME: UTF-8.
|
// FIXME: UTF.
|
||||||
if (down && XLookupString(&event->xkey, keybuf, sizeof(keybuf), 0, &state))
|
if (down && XLookupString(&event->xkey, keybuf, sizeof(keybuf), 0, NULL))
|
||||||
character = keybuf[0];
|
character = keybuf[0];
|
||||||
|
|
||||||
// FIXME: Mod handling.
|
if (character == -1u)
|
||||||
g_extern.system.key_event(down, key, character, 0);
|
character = 0;
|
||||||
|
|
||||||
|
unsigned state = event->xkey.state;
|
||||||
|
uint16_t mod = 0;
|
||||||
|
mod |= (state & ShiftMask) ? RETROKMOD_SHIFT : 0;
|
||||||
|
mod |= (state & LockMask) ? RETROKMOD_SCROLLOCK : 0;
|
||||||
|
mod |= (state & ControlMask) ? RETROKMOD_CTRL : 0;
|
||||||
|
mod |= (state & Mod1Mask) ? RETROKMOD_ALT : 0;
|
||||||
|
mod |= (state & Mod4Mask) ? RETROKMOD_META : 0;
|
||||||
|
|
||||||
|
g_extern.system.key_event(down, key, character, mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user