From bd40a7cc446cafb8c9922d7d19845da580868859 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 28 Mar 2014 16:22:14 +0100 Subject: Update bundled libxkbcommon version to 0.4.1 This is the latest version, released on Mar 27 2014. It includes: https://bugs.freedesktop.org/show_bug.cgi?id=75798 https://bugs.freedesktop.org/show_bug.cgi?id=75892 Required for fixing input when running Qt application on Mac OS X with XQuartz and for fixing QTBUG-36281. Change-Id: Idc4d3c99a4008a10b91ab51c8910b36909974703 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- .../xkbcommon/xkbcommon/xkbcommon-compat.h | 4 + src/3rdparty/xkbcommon/xkbcommon/xkbcommon-x11.h | 8 ++ src/3rdparty/xkbcommon/xkbcommon/xkbcommon.h | 140 +++++++++++++++++---- 3 files changed, 129 insertions(+), 23 deletions(-) (limited to 'src/3rdparty/xkbcommon/xkbcommon') diff --git a/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-compat.h b/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-compat.h index f96e4c806f..299732fdc3 100644 --- a/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-compat.h +++ b/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-compat.h @@ -91,4 +91,8 @@ #define xkb_state_get_map(state) xkb_state_get_keymap(state) +/* Not needed anymore, since there's NO_FLAGS. */ +#define XKB_MAP_COMPILE_PLACEHOLDER XKB_KEYMAP_COMPILE_NO_FLAGS +#define XKB_MAP_COMPILE_NO_FLAGS XKB_KEYMAP_COMPILE_NO_FLAGS + #endif diff --git a/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-x11.h b/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-x11.h index 4ec9b649c7..d9e2a4f11a 100644 --- a/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-x11.h +++ b/src/3rdparty/xkbcommon/xkbcommon/xkbcommon-x11.h @@ -27,6 +27,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @file * libxkbcommon-x11 API - Additional X11 support for xkbcommon. @@ -163,4 +167,8 @@ xkb_x11_state_new_from_device(struct xkb_keymap *keymap, /** @} */ +#ifdef __cplusplus +} /* extern "C" */ #endif + +#endif /* _XKBCOMMON_X11_H */ diff --git a/src/3rdparty/xkbcommon/xkbcommon/xkbcommon.h b/src/3rdparty/xkbcommon/xkbcommon/xkbcommon.h index cc9262ff89..36251db443 100644 --- a/src/3rdparty/xkbcommon/xkbcommon/xkbcommon.h +++ b/src/3rdparty/xkbcommon/xkbcommon/xkbcommon.h @@ -305,26 +305,60 @@ typedef uint32_t xkb_led_mask_t; /** * Names to compile a keymap with, also known as RMLVO. * - * These names together are the primary identifier for a keymap. - * If any of the members is NULL or an empty string (""), a default value is - * used. It is recommended to use the system default by passing NULL for - * unspecified values, instead of providing your own defaults. + * The names are the common configuration values by which a user picks + * a keymap. + * + * If the entire struct is NULL, then each field is taken to be NULL. + * You should prefer passing NULL instead of choosing your own defaults. */ struct xkb_rule_names { - /** The rules file to use. The rules file describes how to interpret - * the values of the model, layout, variant and options fields. */ + /** + * The rules file to use. The rules file describes how to interpret + * the values of the model, layout, variant and options fields. + * + * If NULL or the empty string "", a default value is used. + * If the XKB_DEFAULT_RULES environment variable is set, it is used + * as the default. Otherwise the system default is used. + */ const char *rules; - /** The keyboard model by which to interpret keycodes and LEDs. */ + /** + * The keyboard model by which to interpret keycodes and LEDs. + * + * If NULL or the empty string "", a default value is used. + * If the XKB_DEFAULT_MODEL environment variable is set, it is used + * as the default. Otherwise the system default is used. + */ const char *model; - /** A comma separated list of layouts (languages) to include in the - * keymap. */ + /** + * A comma separated list of layouts (languages) to include in the + * keymap. + * + * If NULL or the empty string "", a default value is used. + * If the XKB_DEFAULT_LAYOUT environment variable is set, it is used + * as the default. Otherwise the system default is used. + */ const char *layout; - /** A comma separated list of variants, one per layout, which may - * modify or augment the respective layout in various ways. */ + /** + * A comma separated list of variants, one per layout, which may + * modify or augment the respective layout in various ways. + * + * If NULL or the empty string "", and a default value is also used + * for the layout, a default value is used. Otherwise no variant is + * used. + * If the XKB_DEFAULT_VARIANT environment variable is set, it is used + * as the default. Otherwise the system default is used. + */ const char *variant; - /** A comma separated list of options, through which the user specifies - * non-layout related preferences, like which key combinations are used - * for switching layouts, or which key is the Compose key. */ + /** + * A comma separated list of options, through which the user specifies + * non-layout related preferences, like which key combinations are used + * for switching layouts, or which key is the Compose key. + * + * If NULL, a default value is used. If the empty string "", no + * options are used. + * If the XKB_DEFAULT_OPTIONS environment variable is set, it is used + * as the default. Otherwise the system default is used. + */ const char *options; }; @@ -399,6 +433,11 @@ xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags); * @returns The number of bytes written to the buffer (including the * terminating byte). If the keysym does not have a Unicode * representation, returns 0. If the buffer is too small, returns -1. + * + * Prefer not to use this function on keysyms obtained from an + * xkb_state. In this case, use xkb_state_key_get_utf8() instead. + * + * @sa xkb_state_key_get_utf8() */ int xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size); @@ -409,6 +448,11 @@ xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size); * @returns The Unicode/UTF-32 representation of keysym, which is also * compatible with UCS-4. If the keysym does not have a Unicode * representation, returns 0. + * + * Prefer not to use this function on keysyms obtained from an + * xkb_state. In this case, use xkb_state_key_get_utf32() instead. + * + * @sa xkb_state_key_get_utf32() */ uint32_t xkb_keysym_to_utf32(xkb_keysym_t keysym); @@ -681,9 +725,7 @@ xkb_context_set_log_fn(struct xkb_context *context, /** Flags for keymap compilation. */ enum xkb_keymap_compile_flags { /** Do not apply any flags. */ - XKB_MAP_COMPILE_NO_FLAGS = 0, - /** Apparently you can't have empty enums. What a drag. */ - XKB_MAP_COMPILE_PLACEHOLDER = 0 + XKB_KEYMAP_COMPILE_NO_FLAGS = 0 }; /** @@ -692,13 +734,8 @@ enum xkb_keymap_compile_flags { * The primary keymap entry point: creates a new XKB keymap from a set of * RMLVO (Rules + Model + Layouts + Variants + Options) names. * - * You should almost certainly be using this and nothing else to create - * keymaps. - * * @param context The context in which to create the keymap. - * @param names The RMLVO names to use. In xkbcommon versions prior - * to 0.2.1, this field must be non-NULL. In later - * versions, passing NULL will use the default keymap. + * @param names The RMLVO names to use. See xkb_rule_names. * @param flags Optional flags for the keymap, or 0. * * @returns A keymap compiled according to the RMLVO names, or NULL if @@ -1159,6 +1196,13 @@ enum xkb_state_component { * is pressed twice, it should be released twice; etc. Otherwise (e.g. due * to missed input events), situations like "stuck modifiers" may occur. * + * This function is often used in conjunction with the function + * xkb_state_key_get_syms() (or xkb_state_key_get_one_sym()), for example, + * when handling a key event. In this case, you should prefer to get the + * keysyms *before* updating the key, such that the keysyms reported for + * the key event are not affected by the event itself. This is the + * conventional behavior. + * * @returns A mask of state components that have changed as a result of * the update. If nothing in the state has changed, returns 0. * @@ -1234,6 +1278,44 @@ int xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key, const xkb_keysym_t **syms_out); +/** + * Get the Unicode/UTF-8 string obtained from pressing a particular key + * in a given keyboard state. + * + * @param[in] state The keyboard state object. + * @param[in] key The keycode of the key. + * @param[out] buffer A buffer to write the string into. + * @param[in] size Size of the buffer. + * + * @warning If the buffer passed is too small, the string is truncated + * (though still NUL-terminated). + * + * @returns The number of bytes required for the string, excluding the + * NUL byte. If there is nothing to write, returns 0. + * + * You may check if truncation has occurred by comparing the return value + * with the size of @p buffer, similarly to the snprintf(3) function. + * You may safely pass NULL and 0 to @p buffer and @p size to find the + * required size (without the NUL-byte). + * + * @memberof xkb_state + */ +int +xkb_state_key_get_utf8(struct xkb_state *state, xkb_keycode_t key, + char *buffer, size_t size); + +/** + * Get the Unicode/UTF-32 codepoint obtained from pressing a particular + * key in a a given keyboard state. + * + * @returns The UTF-32 representation for the key, if it consists of only + * a single codepoint. Otherwise, returns 0. + * + * @memberof xkb_state + */ +uint32_t +xkb_state_key_get_utf32(struct xkb_state *state, xkb_keycode_t key); + /** * Get the single keysym obtained from pressing a particular key in a * given keyboard state. @@ -1485,6 +1567,7 @@ xkb_state_mod_indices_are_active(struct xkb_state *state, * index is not valid in the keymap, returns -1. * * @sa xkb_state_mod_mask_remove_consumed() + * @sa xkb_state_key_get_consumed_mods() * @memberof xkb_state */ int @@ -1504,6 +1587,17 @@ xkb_mod_mask_t xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key, xkb_mod_mask_t mask); +/** + * Get the mask of modifiers consumed by translating a given key. + * + * @returns a mask of the consumed modifiers. + * + * @sa xkb_state_mod_index_is_consumed() + * @memberof xkb_state + */ +xkb_mod_mask_t +xkb_state_key_get_consumed_mods(struct xkb_state *state, xkb_keycode_t key); + /** * Test whether a layout is active in a given keyboard state by name. * -- cgit v1.2.3