[PATCH 07/16] dmx: fix dmxKeySymToKeyCode to work with mandatory XKB.

Peter Hutterer peter.hutterer at who-t.net
Wed Sep 9 23:54:13 PDT 2009


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 at who-t.net>
---
 hw/dmx/input/dmxevents.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 235c8eb..528e968 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -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;
 
-- 
1.6.3.rc1.2.g0164.dirty



More information about the xorg-devel mailing list