diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-08 16:43:04 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-13 10:30:15 +1000 |
commit | a6f3f6a63ae76afbe01eb9049a63609476d2ed4d (patch) | |
tree | a1bacacbcc98df5c916f636015057a2397647c8c /hw/dmx | |
parent | 5d81aee5f75e80ae9d3ac7cb32d293ade62d6c5c (diff) |
dmx: switch lnx-input and usb-input over to xkb-only.
kbd*Convert are nearly identical, it just asks for merging. Not today
though.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/dmx')
-rw-r--r-- | hw/dmx/input/lnx-keyboard.c | 17 | ||||
-rw-r--r-- | hw/dmx/input/usb-keyboard.c | 13 |
2 files changed, 20 insertions, 10 deletions
diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c index 744b6ace5..939a32f07 100644 --- a/hw/dmx/input/lnx-keyboard.c +++ b/hw/dmx/input/lnx-keyboard.c @@ -167,6 +167,7 @@ #include "xf86Keymap.h" #endif #include <linux/keyboard.h> +#include <xkbsrv.h> #define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) #define NUM_STATE_ENTRIES (256/32) @@ -660,7 +661,7 @@ static void kbdLinuxConvert(DevicePtr pDev, BLOCK block) { GETPRIV; - KeySymsPtr pKeySyms = &priv->pKeyboard->key->curKeySyms; + XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; int type; KeySym keySym = NoSymbol; int keyCode; @@ -673,10 +674,14 @@ static void kbdLinuxConvert(DevicePtr pDev, keyCode = (scanCode & 0x7f) + MIN_KEYCODE; /* Handle repeats */ - - if (keyCode >= pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { - keySym = pKeySyms->map[(keyCode - pKeySyms->minKeyCode) - * pKeySyms->mapWidth]; + + if (keyCode >= xkbi->desc->min_key_code && + keyCode <= xkbi->desc->max_key_code) { + + int effectiveGroup = XkbGetEffectiveGroup(xkbi, + &xkbi->state, + scanCode); + keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); #if 0 switch (keySym) { case XK_Num_Lock: @@ -690,7 +695,7 @@ static void kbdLinuxConvert(DevicePtr pDev, break; } #endif - + /* If key is already down, ignore or autorepeat */ if (type == KeyPress && kbdLinuxKeyDown(priv, keyCode)) { KbdFeedbackClassRec *feed = priv->pKeyboard->kbdfeed; diff --git a/hw/dmx/input/usb-keyboard.c b/hw/dmx/input/usb-keyboard.c index 12ca8ab96..c4667a3c3 100644 --- a/hw/dmx/input/usb-keyboard.c +++ b/hw/dmx/input/usb-keyboard.c @@ -85,6 +85,7 @@ * part of the Xserver tree. All calls to the dmx* layer are #defined * here for the .c file. The .h file will also have to be edited. */ #include "usb-keyboard.h" +#include <xkbsrv.h> #define GETPRIV myPrivate *priv \ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private @@ -296,7 +297,7 @@ static void kbdUSBConvert(DevicePtr pDev, BLOCK block) { GETPRIV; - KeySymsPtr pKeySyms = &priv->pDevice->key->curKeySyms; + XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; int type; int keyCode; KeySym keySym = NoSymbol; @@ -308,9 +309,13 @@ static void kbdUSBConvert(DevicePtr pDev, /* Handle repeats */ - if (keyCode >= pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { - keySym = pKeySyms->map[(keyCode - pKeySyms->minKeyCode) - * pKeySyms->mapWidth]; + if (keyCode >= xkbi->desc->min_key_code && + keyCode <= xkbi->desc->max_key_code) { + + int effectiveGroup = XkbGetEffectiveGroup(xkbi, + &xkbi->state, + scanCode); + keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); #if 0 switch (keySym) { case XK_Num_Lock: |