Do not let X translate control key combinations to key codes for us.
This commit is contained in:
parent
6546508cc6
commit
15fcaa80fa
@ -23,7 +23,11 @@ static bool ProcessXKeyEvent(XEvent * x_event, Jtk_Event * event)
|
|||||||
{
|
{
|
||||||
char buffer;
|
char buffer;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
if (XLookupString(&x_event->xkey, &buffer, 1, &keysym, nullptr) > 0)
|
/* Make a copy of x_event and turn off the ControlMask bit for lookup
|
||||||
|
* up keycodes. We'll handle control keys ourselves. */
|
||||||
|
XEvent x_event_for_key_lookup = *x_event;
|
||||||
|
x_event_for_key_lookup.xkey.state &= ~ControlMask;
|
||||||
|
if (XLookupString(&x_event_for_key_lookup.xkey, &buffer, 1, &keysym, nullptr) > 0)
|
||||||
{
|
{
|
||||||
uint8_t mods = 0u;
|
uint8_t mods = 0u;
|
||||||
if (x_event->xkey.state & ShiftMask)
|
if (x_event->xkey.state & ShiftMask)
|
||||||
@ -38,7 +42,14 @@ static bool ProcessXKeyEvent(XEvent * x_event, Jtk_Event * event)
|
|||||||
{
|
{
|
||||||
mods |= JTK_KEY_MODS_CTRL;
|
mods |= JTK_KEY_MODS_CTRL;
|
||||||
}
|
}
|
||||||
event->key.key = buffer;
|
if (buffer == '\r')
|
||||||
|
{
|
||||||
|
event->key.key = '\n';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event->key.key = buffer;
|
||||||
|
}
|
||||||
event->key.mods = mods;
|
event->key.mods = mods;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user