free(keymap->compat_section_name);
}
-int
-XkbcAllocControls(struct xkb_keymap *keymap)
-{
- if (!keymap)
- return BadMatch;
-
- if (!keymap->ctrls) {
- keymap->ctrls = uTypedCalloc(1, struct xkb_controls);
- if (!keymap->ctrls)
- return BadAlloc;
- }
-
- keymap->ctrls->per_key_repeat = uTypedCalloc(keymap->max_key_code >> 3,
- unsigned char);
- if (!keymap->ctrls->per_key_repeat)
- return BadAlloc;
-
- return Success;
-}
-
-static void
-XkbcFreeControls(struct xkb_keymap *keymap)
-{
- if (keymap && keymap->ctrls) {
- free(keymap->ctrls->per_key_repeat);
- free(keymap->ctrls);
- keymap->ctrls = NULL;
- }
-}
-
struct xkb_keymap *
XkbcAllocKeyboard(struct xkb_context *ctx)
{
free(keymap->vmodmap);
darray_free(keymap->sym_interpret);
free_names(keymap);
- XkbcFreeControls(keymap);
+ free(keymap->per_key_repeat);
xkb_context_unref(keymap->ctx);
free(keymap);
}
#include "xkb-priv.h"
-extern int
-XkbcAllocControls(struct xkb_keymap *keymap);
-
extern struct xkb_keymap *
XkbcAllocKeyboard(struct xkb_context *ctx);
darray_item(keymap->types, type).name);
}
}
- if (keymap->ctrls &&
- (keymap->explicit[key] & XkbExplicitAutoRepeatMask)) {
- if (keymap->ctrls->per_key_repeat[key / 8] & (1 << (key % 8)))
+ if (keymap->explicit[key] & XkbExplicitAutoRepeatMask) {
+ if (keymap->per_key_repeat[key / 8] & (1 << (key % 8)))
write_buf(keymap, buf, size, offset,
"\n\t\t\trepeat= Yes,");
else
_X_EXPORT int
xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key)
{
- return !!(keymap->ctrls->per_key_repeat[key / 8] & (1 << (key % 8)));
+ return !!(keymap->per_key_repeat[key / 8] & (1 << (key % 8)));
}
state->leds |= (1 << led);
}
else if (map->ctrls) {
- if ((map->ctrls & state->keymap->ctrls->enabled_ctrls))
+ if ((map->ctrls & state->keymap->enabled_ctrls))
state->leds |= (1 << led);
}
}
};
struct xkb_controls {
- /* unsigned char groups_wrap; */
- /* struct xkb_mods internal; */
- /* struct xkb_mods ignore_lock; */
- unsigned int enabled_ctrls;
- /* unsigned short repeat_delay; */
- /* unsigned short repeat_interval; */
- /* unsigned short slow_keys_delay; */
- /* unsigned short debounce_delay; */
- /* unsigned short ax_options; */
- /* unsigned short ax_timeout; */
- /* unsigned short axt_opts_mask; */
- /* unsigned short axt_opts_values; */
- /* unsigned int axt_ctrls_mask; */
- /* unsigned int axt_ctrls_values; */
- unsigned char *per_key_repeat;
+ unsigned char groups_wrap;
+ struct xkb_mods internal;
+ struct xkb_mods ignore_lock;
+ unsigned short repeat_delay;
+ unsigned short repeat_interval;
+ unsigned short slow_keys_delay;
+ unsigned short debounce_delay;
+ unsigned short ax_options;
+ unsigned short ax_timeout;
+ unsigned short axt_opts_mask;
+ unsigned short axt_opts_values;
+ unsigned int axt_ctrls_mask;
+ unsigned int axt_ctrls_values;
};
/* Common keyboard description structure */
struct xkb_keymap {
- struct xkb_context *ctx;
+ struct xkb_context *ctx;
+
+ int refcnt;
+ enum xkb_map_compile_flags flags;
+
+ unsigned int enabled_ctrls;
- unsigned int refcnt;
- unsigned short flags;
xkb_keycode_t min_key_code;
xkb_keycode_t max_key_code;
- struct xkb_controls * ctrls;
-
/* key -> key name mapping */
darray(struct xkb_key_name) key_names;
/* aliases in no particular order */
/* key -> behavior mapping */
struct xkb_behavior *behaviors;
+ /* key -> should repeat mapping - one bit per key */
+ unsigned char *per_key_repeat;
+
struct xkb_indicator_map indicators[XkbNumIndicators];
char *indicator_names[XkbNumIndicators];
if (group == 0 && level == 0) {
if (!(keymap->explicit[key] & XkbExplicitAutoRepeatMask) &&
(!interp || interp->flags & XkbSI_AutoRepeat))
- keymap->ctrls->per_key_repeat[key / 8] |=
- (1 << (key % 8));
+ keymap->per_key_repeat[key / 8] |= (1 << (key % 8));
if (!(keymap->explicit[key] & XkbExplicitBehaviorMask) &&
interp && (interp->flags & XkbSI_LockingKey))
keymap->behaviors[key].type = XkbKB_Lock;
}
if (key->repeat != RepeatUndefined) {
if (key->repeat == RepeatYes)
- keymap->ctrls->per_key_repeat[kc / 8] |= (1 << (kc % 8));
+ keymap->per_key_repeat[kc / 8] |= (1 << (kc % 8));
else
- keymap->ctrls->per_key_repeat[kc / 8] &= ~(1 << (kc % 8));
+ keymap->per_key_repeat[kc / 8] &= ~(1 << (kc % 8));
keymap->explicit[kc] |= XkbExplicitAutoRepeatMask;
}
if (!keymap->vmodmap)
goto err_info;
- if (XkbcAllocControls(keymap) != Success) {
- WSGO("Could not allocate controls in CompileSymbols\n");
- ACTION("Symbols not added\n");
+ keymap->per_key_repeat = calloc(keymap->max_key_code / 8, 1);
+ if (!keymap->per_key_repeat)
goto err_info;
- }
if (info.name)
keymap->symbols_section_name = strdup(info.name);