summaryrefslogtreecommitdiff
path: root/src/keysym-utf.c
Commit message (Collapse)AuthorAgeFilesLines
* Do not interpret nor emit invalid Unicode encoding formsPierre Le Marre2023-05-131-3/+13
| | | | | | Surrogates are invalid in both UTF-32 and UTF-8. See https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G28875 and https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf#G31703
* keysym-utf: remove bogus currency sign entriesRan Benita2022-05-151-11/+0
| | | | | | | | | | | | | | | | | | | | | | These ended up being mapping in the 0x100xxxx Unicode range, which are handled automatically ; these special keysyms don't exist (except for EuroSign). #define XKB_KEY_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ #define XKB_KEY_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */ #define XKB_KEY_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ #define XKB_KEY_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */ #define XKB_KEY_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */ #define XKB_KEY_MillSign 0x10020a5 /* U+20A5 MILL SIGN */ #define XKB_KEY_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */ #define XKB_KEY_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */ #define XKB_KEY_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */ #define XKB_KEY_WonSign 0x10020a9 /* U+20A9 WON SIGN */ #define XKB_KEY_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */ #define XKB_KEY_DongSign 0x10020ab /* U+20AB DONG SIGN */ #define XKB_KEY_EuroSign 0x20ac /* U+20AC EURO SIGN */ Signed-off-by: Ran Benita <ran@unusedvar.com>
* keysym-utf: remove bogus Korean Won sign entryRan Benita2022-05-151-1/+0
| | | | | | | This entry maps a non existing special keysym 0x20a9. The correct mapping for XKB_KEY_Korean_Won (0x0eff) already exists. Signed-off-by: Ran Benita <ran@unusedvar.com>
* Remove bogus euro sign entry from keysymtabSam Lantinga2022-05-151-1/+0
| | | | | | | | | | | | Not sure what it's doing here, but converting "€" to a keysym doesn't work with this entry. 0x13a4 doesn't appear in xkbcommon-keysyms.h. 0x20ac is the keysym documented in the header (and it's the last entry in the table). It's been in the table since it was introduced in e0524296d2e0 ("Add API for getting unicode representation of a keysym"). Co-authored-by: Simon Ser <contact@emersion.fr>
* Fix a few keysymtab entries to match their comment in xkbcommon-keysyms.hPierre Le Marre2021-02-271-3/+3
| | | | Signed-off-by: Ran Benita <ran@unusedvar.com>
* Support translation Unicode codepoints to keysymsJaroslaw Kubik2020-02-241-0/+29
| | | | | | | | | In order to support features like auto-type and UI automation, the relevant tools need to be able to invert the keycode->keysym->text transformation. In order to facilitate that, a new API was added. It allows querying the keysyms that correspond to particular Unicode codepoints. For all practical purposes, it can be thought of as an inverse of xkb_keysym_to_utf32().
* build: include config.h manuallyRan Benita2019-12-271-0/+2
| | | | | | | | | Previously we included it with an `-include` compiler directive. But that's not portable. And it's better to be explicit anyway. Every .c file should have `include "config.h"` first thing. Signed-off-by: Ran Benita <ran@unusedvar.com>
* keysym-utf: reject out-of-range Unicode codepoints in xkb_keysym_to_utf{8,32}Ran Benita2018-06-231-3/+9
| | | | | | | | | | It used to be UTF-8 was defined for inputs > 0x10FFFF, but nowadays that's the maximum and a codepoint is encoded up to 4 bytes, not 6. Fixes: https://github.com/xkbcommon/libxkbcommon/issues/58 Fixes: https://github.com/xkbcommon/libxkbcommon/issues/59 Reported-by: @andrecbarros Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym-utf: replace the Unicode characters for leftanglebracket and ↵Ran Benita2018-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rightanglebracket Looking at leftanglebracket - The standard[1] does not specify any Unicode value for it. - The keysym list keysymdef.h in x11proto[2] says U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET in a comment. - The keysym->unicode list in xkbcommon which comes from [3] has U+2329 LEFT-POINTING ANGLE BRACKET. - The keysym->unicode list in Xlib[4] has U+2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK. [1] https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#Legacy_KEYSYMs [2] https://cgit.freedesktop.org/xorg/proto/x11proto/tree/keysymdef.h [3] https://www.cl.cam.ac.uk/%7Emgk25/ucs/keysym2ucs.c [4] https://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xlibi18n/imKStoUCS.c The symbols we are using, {LEFT,RIGHT}-POINTING ANGLE BRACKET, are deprecated according to Unicode[5]: These characters are deprecated and are strongly discouraged for mathematical use because of their canonical equivalence to CJK punctuation. [5] https://www.unicode.org/charts/PDF/U2300.pdf Hence, switch to the MATHEMATICAL codepoints which seem to be the best fit. Fixes: https://github.com/xkbcommon/libxkbcommon/issues/47 Reported-by: @bytensky Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym-utf: Add missing codes for signifblank and permille keysymsMatt Whitlock2017-09-281-1/+2
|
* Add utf8.{c,h} for common UTF-8 util functionsRan Benita2014-03-221-41/+1
| | | | | | | We need to validate some UTF-8, so this adds an is_valid_utf8() function, which is probably pretty slow but should work correctly. Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym: fix types in bin_searchRan Benita2014-02-081-3/+3
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* Fix some cppcheck warningsRan Benita2014-01-111-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Someone was nice enough to run this for us: ftp://ftp.sunet.se/pub/Linux/distributions/Debian/debian/pool/main/libx/libxkbcommon/libxkbcommon_0.3.1.orig.tar.gz [libxkbcommon-0.3.1/src/keymap.c:86]: (style) The scope of the variable 'j' can be reduced. [libxkbcommon-0.3.1/src/keymap.c:87]: (style) The scope of the variable 'key' can be reduced. [libxkbcommon-0.3.1/src/keysym-utf.c:843]: (style) The scope of the variable 'mid' can be reduced. [libxkbcommon-0.3.1/src/state.c:992]: (style) The scope of the variable 'str' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/action.c:467]: (style) The scope of the variable 'absolute' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:468]: (style) The scope of the variable 'consumed' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:862]: (style) The scope of the variable 'mlvo' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:863]: (style) The scope of the variable 'kccgst' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/rules.c:865]: (style) The scope of the variable 'match_type' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/symbols.c:753]: (style) The scope of the variable 'toAct' can be reduced. [libxkbcommon-0.3.1/src/xkbcomp/symbols.c:1573]: (style) The scope of the variable 'key' can be reduced. [libxkbcommon-0.3.1/test/common.c:80]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [libxkbcommon-0.3.1/test/interactive.c:358]: (style) The scope of the variable 'nevs' can be reduced. [libxkbcommon-0.3.1/test/interactive.c:236]: (style) Checking if unsigned variable 'nsyms' is less than zero. [libxkbcommon-0.3.1/test/interactive.c:226]: (style) Unused variable: unicode Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym-utf: Fix a warning about shadowingSiddharth Heroor2013-10-071-6/+6
| | | | | | | | | | | | Change variable names to avoid the name clash. The warning seen is src/keysym-utf.c: In function 'bin_search': src/keysym-utf.c:841: warning: declaration of 'min' shadows a global declaration src/utils.h:109: warning: shadowed declaration is here src/keysym-utf.c:842: warning: declaration of 'max' shadows a global declaration src/utils.h:115: warning: shadowed declaration is here Signed-off-by: Siddharth Heroor <heroor@ti.com>
* keysym-utf: mark keysymtab array as staticRan Benita2012-11-051-1/+1
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym-utf: also translate special keysyms like Tab and ReturnRan Benita2012-11-051-25/+12
| | | | | | | | | | | | | | | The keysym2ucs.c file apparently leaves out some keysyms, which libX11 deals with separately (like in _XkbHandleSpecialSym()). The problematic keysyms are the keypad ones (for which we already added some support) and keysyms which use 0xff** instead of 0x00** < 0x20. This code should fix them properly, as much as I could gather from libX11 and http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c and other sources (which are not aware of locale). https://bugs.freedesktop.org/show_bug.cgi?id=56780 Reported-by: Gatis Paeglis <gatis.paeglis@digia.com> Signed-off-by: Ran Benita <ran234@gmail.com>
* utils: add and use ARRAY_SIZE macroRan Benita2012-10-161-4/+2
| | | | Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym-utf: make keysym->unicode table a bit smallerRan Benita2012-10-061-1/+2
| | | | | | Saves a few kbytes, and unlikely to change. Signed-off-by: Ran Benita <ran234@gmail.com>
* keysym-utf8: Optimise the keysym to utf8 lookupRob Bradford2012-09-181-17/+42
| | | | | | | | | | | | | This change adds range checks based on the lowest keysym and highest keysym in the table. This allows a quick check to be applied to identify if the keysym is inside the table. To really give value to this optimisation the table is split to have a separate table for the keypad keysyms. The test suite passes with this change. Signed-off-by: Rob Bradford <rob@linux.intel.com>
* Organize src/ and test/ headersRan Benita2012-09-161-1/+1
| | | | | | | | | | | | - Add context.h and move context-related functions from xkb-priv.h to it. - Move xkb_context definition back to context.c. - Add keysym.h and move keysym upper/lower/keypad from xkb-priv.h to it. - Rename xkb-priv.h to map.h since it only contains keymap-related definitions and declarations now. - Remove unnecessary includes and some and some other small cleanups. Signed-off-by: Ran Benita <ran234@gmail.com>
* Constify keysym <-> Unicode lookup tableDaniel Stone2012-09-111-1/+1
| | | | | | | | | | | | Before: text data bss dec hex filename 234422 11288 2304 248014 3c8ce obj-amd64/.libs/libxkbcommon.so.0.0.0 After: text data bss dec hex filename 240694 5016 2304 248014 3c8ce obj-amd64/.libs/libxkbcommon.so.0.0.0 Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* utils: remove Xfuncproto.h and use our own macrosRan Benita2012-07-231-2/+2
| | | | | | | Add XKB_EXPORT to replace _X_EXPORT, and copy the definitions of _X_ATTRIBUTE_FOO as ATTR_FOO. Signed-off-by: Ran Benita <ran234@gmail.com>
* Run source tree through uncrustifyDaniel Stone2012-07-171-7/+10
| | | | | | | .uncrustify.cfg committed for future reference also, but had to manually fix up a few things: it really likes justifying struct initialisers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Add keypad sequences to UTF-8 keysym printingDaniel Stone2012-06-081-1/+16
| | | | Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Add API for getting unicode representation of a keysymRob Bradford2012-06-081-0/+942
This code uses a table and code derived from http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c The added API calls are: xkb_keysym_to_utf32 xkb_keysym_to_utf8 [daniels: Changed API to be more in line with keysym_get_name, added test, changed formatting to 4-space.]