diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-21 20:10:50 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-21 20:10:50 +0000 |
commit | 239364510e41b034ad6ecb6cb51120232e7166cc (patch) | |
tree | 37c3c57c97d3fda8179a0204d94318a738309cc0 /xserver/dix/inpututils.c | |
parent | 9c0c4e62648084518b26f71ef3e5664454486b42 (diff) |
Update to xorg-server 1.9.3. Tested by japser@, landry@ and ajacoutot@
in various configurations.
Diffstat (limited to 'xserver/dix/inpututils.c')
-rw-r--r-- | xserver/dix/inpututils.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/xserver/dix/inpututils.c b/xserver/dix/inpututils.c index 8ec80b5e8..6693c67b3 100644 --- a/xserver/dix/inpututils.c +++ b/xserver/dix/inpututils.c @@ -286,7 +286,7 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, { CARD8 keys_per_mod[8]; int max_keys_per_mod; - KeyCode *modkeymap; + KeyCode *modkeymap = NULL; int i, j, ret; ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGetAttrAccess); @@ -310,18 +310,20 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, } } - modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode)); - if (!modkeymap) - return BadAlloc; + if (max_keys_per_mod != 0) { + modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode)); + if (!modkeymap) + return BadAlloc; - for (i = 0; i < 8; i++) - keys_per_mod[i] = 0; + for (i = 0; i < 8; i++) + keys_per_mod[i] = 0; - for (i = 8; i < MAP_LENGTH; i++) { - for (j = 0; j < 8; j++) { - if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) { - modkeymap[(j * max_keys_per_mod) + keys_per_mod[j]] = i; - keys_per_mod[j]++; + for (i = 8; i < MAP_LENGTH; i++) { + for (j = 0; j < 8; j++) { + if (dev->key->xkbInfo->desc->map->modmap[i] & (1 << j)) { + modkeymap[(j * max_keys_per_mod) + keys_per_mod[j]] = i; + keys_per_mod[j]++; + } } } } |