diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-10-18 20:26:00 +0100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2009-01-22 15:08:59 +1100 |
commit | 4fa3872dc2bcfd6d1fc88d0a94c7071683eea899 (patch) | |
tree | 0585901468faf3fac862bf6cb667dc2b302ced91 /Xi/getkmap.c | |
parent | bc909f71367a02297e725bb5769c2bcadab22395 (diff) |
Input: Remove core keysyms from KeyClassRec
Instead of always keeping two copies of the keymap, only generate the
core keymap from the XKB keymap when we really need to, and use the XKB
keymap as the canonical keymap.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi/getkmap.c')
-rw-r--r-- | Xi/getkmap.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/Xi/getkmap.c b/Xi/getkmap.c index 540184682..78449e212 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -59,6 +59,8 @@ SOFTWARE. #include <X11/extensions/XIproto.h> #include "exglobals.h" #include "swaprep.h" +#include "xkbsrv.h" +#include "xkbstr.h" #include "getkmap.h" @@ -90,7 +92,8 @@ ProcXGetDeviceKeyMapping(ClientPtr client) { xGetDeviceKeyMappingReply rep; DeviceIntPtr dev; - KeySymsPtr k; + XkbDescPtr xkb; + KeySymsPtr syms; int rc; REQUEST(xGetDeviceKeyMappingReq); @@ -101,31 +104,37 @@ ProcXGetDeviceKeyMapping(ClientPtr client) return rc; if (dev->key == NULL) return BadMatch; - k = &dev->key->curKeySyms; + xkb = dev->key->xkbInfo->desc; - if ((stuff->firstKeyCode < k->minKeyCode) || - (stuff->firstKeyCode > k->maxKeyCode)) { + if (stuff->firstKeyCode < xkb->min_key_code || + stuff->firstKeyCode > xkb->max_key_code) { client->errorValue = stuff->firstKeyCode; return BadValue; } - if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) { + if (stuff->firstKeyCode + stuff->count > xkb->max_key_code + 1) { client->errorValue = stuff->count; return BadValue; } + syms = XkbGetCoreMap(dev); + if (!syms) + return BadAlloc; + rep.repType = X_Reply; rep.RepType = X_GetDeviceKeyMapping; rep.sequenceNumber = client->sequence; - rep.keySymsPerKeyCode = k->mapWidth; - rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */ + rep.keySymsPerKeyCode = syms->mapWidth; + rep.length = (syms->mapWidth * stuff->count); /* KeySyms are 4 bytes */ WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; WriteSwappedDataToClient(client, - k->mapWidth * stuff->count * sizeof(KeySym), - &k->map[(stuff->firstKeyCode - k->minKeyCode) * - k->mapWidth]); + syms->mapWidth * stuff->count * sizeof(KeySym), + &syms->map[syms->mapWidth * (stuff->firstKeyCode - + syms->minKeyCode)]); + xfree(syms->map); + xfree(syms); return Success; } |