Remove keycode_range_is_legal
It was a pretty pointless check. Also sanitise the _x11 variant to actually do what it says on the box. Signed-off-by: Daniel Stone <daniel@fooishbar.org>master
parent
6433d72e7c
commit
3e3ddd43e9
|
@ -101,12 +101,7 @@ typedef uint32_t xkb_led_index_t;
|
|||
|
||||
#define XKB_KEYCODE_MAX (0xffffffff - 1)
|
||||
#define xkb_keycode_is_legal_ext(kc) (kc <= XKB_KEYCODE_MAX)
|
||||
#define xkb_keycode_is_legal_x11(kc) (kc <= XKB_KEYCODE_MAX)
|
||||
#define xkb_keymap_keycode_range_is_legal(xkb) \
|
||||
(xkb->max_key_code > 0 && \
|
||||
xkb->max_key_code > xkb->min_key_code && \
|
||||
xkb_keycode_is_legal_ext(xkb->min_key_code) && \
|
||||
xkb_keycode_is_legal_ext(xkb->max_key_code))
|
||||
#define xkb_keycode_is_legal_x11(kc) (kc >= 8 && kc <= 255)
|
||||
|
||||
/**
|
||||
* Names to compile a keymap with, also known as RMLVO. These names together
|
||||
|
|
15
src/alloc.c
15
src/alloc.c
|
@ -35,15 +35,6 @@ XkbcAllocClientMap(struct xkb_keymap *keymap, unsigned which,
|
|||
if (!keymap || ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes)))
|
||||
return BadValue;
|
||||
|
||||
if ((which & XkbKeySymsMask) &&
|
||||
!xkb_keymap_keycode_range_is_legal(keymap)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "bad keycode (%d,%d) in XkbAllocClientMap\n",
|
||||
keymap->min_key_code, keymap->max_key_code);
|
||||
#endif
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (!keymap->map) {
|
||||
map = uTypedCalloc(1, struct xkb_client_map);
|
||||
if (!map)
|
||||
|
@ -126,9 +117,6 @@ XkbcAllocServerMap(struct xkb_keymap *keymap, unsigned which,
|
|||
if (!which)
|
||||
return Success;
|
||||
|
||||
if (!xkb_keymap_keycode_range_is_legal(keymap))
|
||||
return BadMatch;
|
||||
|
||||
if (!map->explicit) {
|
||||
i = keymap->max_key_code + 1;
|
||||
map->explicit = uTypedCalloc(i, unsigned char);
|
||||
|
@ -469,9 +457,6 @@ XkbcAllocNames(struct xkb_keymap *keymap, unsigned which,
|
|||
}
|
||||
|
||||
if ((which & XkbKeyNamesMask) && !names->keys) {
|
||||
if (!xkb_keymap_keycode_range_is_legal(keymap))
|
||||
return BadMatch;
|
||||
|
||||
names->keys = uTypedCalloc(keymap->max_key_code + 1,
|
||||
struct xkb_key_name);
|
||||
if (!names->keys)
|
||||
|
|
Loading…
Reference in New Issue