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:
Peter Hutterer 2009-09-08 17:10:22 +10:00
parent 61ae0a5ca5
commit 6e52f92331

View File

@ -625,13 +625,16 @@ out:
static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
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;
/* Optimize for similar maps */
if (tryFirst >= pKeySyms->minKeyCode
&& tryFirst <= pKeySyms->maxKeyCode
&& pKeySyms->map[(tryFirst - pKeySyms->minKeyCode)
if (XkbKeycodeInRange(xkbi->desc, tryFirst)
&& pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
* pKeySyms->mapWidth] == keySym)
return tryFirst;