diff options
author | Gatis Paeglis <gatis.paeglis@digia.com> | 2014-02-05 16:25:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-19 15:42:13 +0100 |
commit | b19b0808940c8c54b102012be134a370b26e348e (patch) | |
tree | 63d951814f771e87508be7b0f8d4346d0079dc05 /src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c | |
parent | c6b555dac389f9a599a9ad342de56dea329fff60 (diff) |
Update bundled libxkbcommon version to 0.4.0
This release comes with important bug fixes. Also we can now
remove the workaround code which was needed for libxkbcommon 0.2.0.
Task-number: QTBUG-31712
Task-number: QTBUG-33732
Task-number: QTBUG-34056
Change-Id: I57caf7f803b9a01a15541a5ad82e464de3b8abbb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c')
-rw-r--r-- | src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c b/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c index edc54c94f3..59916b7266 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c @@ -231,7 +231,10 @@ InitKeyNamesInfo(KeyNamesInfo *info, struct xkb_context *ctx) { memset(info, 0, sizeof(*info)); info->ctx = ctx; - info->min_key_code = XKB_KEYCODE_MAX; + info->min_key_code = XKB_KEYCODE_INVALID; +#if XKB_KEYCODE_INVALID < XKB_KEYCODE_MAX +#error "Hey, you can't be changing stuff like that." +#endif } static xkb_keycode_t @@ -604,16 +607,28 @@ CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) unsigned i; keymap->keycodes_section_name = strdup_safe(info->name); + XkbEscapeMapName(keymap->keycodes_section_name); - keymap->min_key_code = info->min_key_code; - keymap->max_key_code = info->max_key_code; + if (info->min_key_code != XKB_KEYCODE_INVALID) { + keymap->min_key_code = info->min_key_code; + keymap->max_key_code = info->max_key_code; + } + else { + /* + * If the keymap has no keys, let's just use the safest pair + * we know. + */ + keymap->min_key_code = 8; + keymap->max_key_code = 255; + } - /* Copy key names. */ - keymap->keys = calloc(info->max_key_code + 1, sizeof(*keymap->keys)); - for (kc = info->min_key_code; kc <= info->max_key_code; kc++) { + keymap->keys = calloc(keymap->max_key_code + 1, sizeof(*keymap->keys)); + for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) keymap->keys[kc].keycode = kc; + + /* Copy key names. */ + for (kc = info->min_key_code; kc <= info->max_key_code; kc++) keymap->keys[kc].name = darray_item(info->key_names, kc); - } /* * Do some sanity checking on the aliases. We can't do it before |