dmx: fix dmxKeySymToKeyCode to work with mandatory XKB.
Approach taken is inefficient, it converts the xkb symbol table to a core symbol table first and then extracts the keycode from there. Consider this a todo for a rainy afternoon when the beer fridge demands emptying. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
61ae0a5ca5
commit
6e52f92331
|
@ -625,13 +625,16 @@ out:
|
||||||
static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
|
static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
|
||||||
int tryFirst)
|
int tryFirst)
|
||||||
{
|
{
|
||||||
KeySymsPtr pKeySyms = &dmxLocal->pDevice->key->curKeySyms;
|
/* FIXME: this is quite ineffective, converting to a core map first and
|
||||||
|
* then extracting the info from there. It'd be better to run the actual
|
||||||
|
* xkb map */
|
||||||
|
XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo;
|
||||||
|
KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Optimize for similar maps */
|
/* Optimize for similar maps */
|
||||||
if (tryFirst >= pKeySyms->minKeyCode
|
if (XkbKeycodeInRange(xkbi->desc, tryFirst)
|
||||||
&& tryFirst <= pKeySyms->maxKeyCode
|
&& pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
|
||||||
&& pKeySyms->map[(tryFirst - pKeySyms->minKeyCode)
|
|
||||||
* pKeySyms->mapWidth] == keySym)
|
* pKeySyms->mapWidth] == keySym)
|
||||||
return tryFirst;
|
return tryFirst;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue