summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-09-08 17:05:12 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-09-13 10:30:15 +1000
commit61ae0a5ca5de24590f444c405445124404ba9753 (patch)
tree757f70e6bde8570b6a6ba04642a0dcc8bea10d60 /hw/dmx
parent9caba3e2abceda0a1ff4ad4bf05708f0166c2218 (diff)
dmx: fix up dmxKeyCodeToKeySym for XKB-only.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/input/dmxevents.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 37f8cb33b..235c8eb98 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -58,6 +58,7 @@
#include "mi.h"
#include "exglobals.h"
+#include "xkbsrv.h"
#include "XIstubs.h"
static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
@@ -600,24 +601,25 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
KeyCode keyCode)
{
- KeySymsPtr pKeySyms = NULL;
+ KeySym keysym = NoSymbol;
+ int effectiveGroup;
+ XkbSrvInfoPtr xkbi;
if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
- return NoSymbol;
- pKeySyms = &dmxLocal->pDevice->key->curKeySyms;
- if (!pKeySyms)
- return NoSymbol;
-
- if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) {
- DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
- keyCode,
- pKeySyms->map[(keyCode - pKeySyms->minKeyCode)
- * pKeySyms->mapWidth]);
-
- return pKeySyms->map[(keyCode - pKeySyms->minKeyCode)
- * pKeySyms->mapWidth];
- }
- return NoSymbol;
+ goto out;
+
+ xkbi = dmxLocal->pDevice->key->xkbInfo;
+ effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode);
+
+ if (effectiveGroup == -1)
+ goto out;
+
+ keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup);
+ DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
+ keyCode, keysym);
+
+out:
+ return keysym;
}
static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,