Branch :
| Author | Commit | Date | CI | Message |
|---|---|---|---|---|
| 09ac27f7 | 2021-05-22 19:51:02 | ignore: remove no longer relevant gitignore files These were relevant for the autoconf build but now we're meson only. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 1915632e | 2021-05-08 21:08:37 | compose: add mapped locale to Compose-file-not-found error log Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 16fe837d | 2019-11-02 16:19:32 | atom: rewrite as a hash table While the previous 1987-style[0] scheme was fun (and I reasonably optimized it for a fair comparison), this task is more suited to a hash table. Even a simple implementation beats the old one. [0] Seems to have first appeared in X11R1, released September 1987. See server/dix/atom.c here: https://www.x.org/releases/X11R1/X.V11R1.tar.gz Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 68dddd41 | 2021-04-22 00:37:03 | keysym: fix underflow in binary searches This is hit when passing an empty string and XKB_KEYSYM_CASE_INSENSITIVE to xkb_keysym_from_name currently if `(lo + hi) / 2` is 0 and `cmp < 0`, causing mid to underflow and the the array access into name_to_keysym on the next iteration of the loop to be out of bounds . We *would* use ssize_t here as it is the appropriate type, but windows unfortunately does not define it. | ||
| 29af25ea | 2021-04-07 10:47:15 | x11: fix xkb_x11_keymap_new_from_device failing when a level name is empty The numpad:mac option doesn't specify a name for the first level: // On Mac keypads, level 1 and 2 are swapped. partial xkb_types "mac" { type "KEYPAD" { modifiers = None; map[None] = Level2; level_name[Level2] = "Number"; }; include "extra(keypad)" }; This means the atom for level name is XCB_ATOM_NONE. We tried to get its name, which fails. This regressed in 40c00b472144d1684d2fb97cafef39. Instead, translate it to XKB_ATOM_NONE, same as the previous behavior. Fixes: https://github.com/xkbcommon/libxkbcommon/issues/229 Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 7e6d942a | 2021-04-02 15:00:46 | compose: fix max compose nodes check Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 45b1ca22 | 2021-04-01 22:46:56 | keysym: speed up the perfect hash function Make it use a bit operation instead of an expensive modulo. perf diff: Baseline Delta Abs Shared Object Symbol ........ ......... ................. ................................... 28.15% -6.57% bench-compose [.] xkb_keysym_from_name Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 8cd688c0 | 2021-04-01 22:07:28 | keysym: avoid strtoul in xkb_keysym_from_name Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 68e69b7d | 2021-03-28 20:22:54 | keysym: use a perfect hash function for case sensitive xkb_keysym_from_name In 7d84809fdccbb5898d0838849ec7c321410182d5 I added a fast path for the case-sensitive case, but it is still slowing down Compose parsing. Instead of the binary search, use a perfect hash function, computed with a simple python module I found (vendored). It is faster -- perf diff is: Baseline Delta Abs Shared Object Symbol ........ ......... ................. ................................... 22.35% -14.04% libc-2.33.so [.] __strcmp_avx2 16.75% +10.28% bench-compose [.] xkb_keysym_from_name 20.72% +2.40% bench-compose [.] parse.constprop.0 2.29% -1.97% bench-compose [.] strcmp@plt 2.56% +1.81% bench-compose [.] resolve_name 2.37% +0.92% libc-2.33.so [.] __GI_____strtoull_l_internal 26.19% -0.63% bench-compose [.] lex 1.45% +0.56% libc-2.33.so [.] __memchr_avx2 1.13% -0.31% libc-2.33.so [.] __strcpy_avx2 Also reduces the binary size: Before: text data bss dec hex filename 341111 5064 8 346183 54847 build/libxkbcommon.so.0.0.0 After: text data bss dec hex filename 330215 5064 8 335287 51db7 build/libxkbcommon.so.0.0.0 Note however that it's still larger than before 7d84809fdccbb5898d08388: text data bss dec hex filename 320617 5168 8 325793 4f8a1 build/libxkbcommon.so.0.0.0 Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 02b9cabf | 2021-03-29 16:05:14 | compose: use a ternary tree instead of a regular trie Previously we used a simple trie with a linked list for each chain. Unfortunately most compose files have very long chains which means the constructions performs an almost quadratic number of comparisons. Switch to using a ternary search tree instead. This is very similar to a trie, only the linked list is essentially replaced with a binary tree. On the en_US/Compose file, the perf diff is the following (the modified function is `parse`): Event 'cycles:u' Baseline Delta Abs Shared Object Symbol ........ ......... ................ ................................. 39.91% -17.62% bench-compose [.] parse.constprop.0 20.54% +6.47% bench-compose [.] lex 17.28% +5.55% libc-2.33.so [.] __strcmp_avx2 12.78% +4.01% bench-compose [.] xkb_keysym_from_name 2.30% +0.83% libc-2.33.so [.] __GI_____strtoull_l_internal 3.36% +0.78% bench-compose [.] strcmp@plt Thanks to some careful packing, the memory usage is pretty much the same. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 3a6c3b2c | 2021-03-30 20:34:11 | ast: remove comment re. anonymous struct C11 is not sufficient for this, needs `--ms-extensions` which we don't want to enable. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 8b09e177 | 2021-03-30 20:12:08 | compose: use anonymous union Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 1c0e28ad | 2021-03-30 19:11:59 | keysym: properly handle overflow in 0x keysym names Relatedly, strtoul allows a lot of unwanted stuff (spaces, +/- sign, thousand seperators), we really ought not use it. But that's for another time. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 1638409b | 2021-03-30 17:52:36 | compose: add a limit of 65535 sequences Fits in uint16_t, which enables some future optimizations. But also a good idea to have some limit. Not aware of any compose files which come close. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 127f8c97 | 2021-03-30 08:09:37 | utils: assert on streq for NULL pointers We have streq_null for that purpose Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| fa86433e | 2021-03-30 07:56:09 | xkbcomp: remove useless assignment ../../../src/xkbcomp/compat.c:693:16: warning: Although the value stored to 'merge' is used in the enclosing expression, the value is never actually read from 'merge' [deadcode.DeadStores] si.merge = merge = (def->merge == MERGE_DEFAULT ? merge : def->merge); Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 20f7f80c | 2021-03-29 16:23:28 | xkbcomp: use memcpy over strncpy to avoid analyzer warnings The target buffer is 7 bytes long, null-termination is optional (as the comment already suggests). Coverity is unhappy about this though so let's use memset and memcpy instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 7d84809f | 2021-03-28 15:51:01 | keysym: fast path for case sensitive xkb_keysym_from_name xkb_keysym_from_name() is called a lot in Compose file parsing. The lower case handling slows things down a lot (particularly given we can't use the optimized strcasecmp() due to locale issues). So add separate handling for the non-case-sensitive case which is used by Compose. To do this we need to add another version of the ks_tables table. This adds ~20kb to the shared library binary. We can probably do something better here but I think it's fine. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 3b506497 | 2021-03-28 15:21:47 | keysym: inline find_sym function It's easier when everything is in one place. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 2d87ab08 | 2021-03-28 15:23:40 | keysym: use a more descriptive argument name Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| a717549e | 2021-03-28 15:03:31 | keysym: open-code bsearch We want to optimize things here which requires messing with the binary search some. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 62b5b4a1 | 2021-03-28 13:01:57 | x11: fix comparison of integer expressions of different signedness src/x11/keymap.c:980:26: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare] 980 | for (size_t i = 0; i < length; i++) { | ^ Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 95e29079 | 2021-03-18 12:22:34 | xkbcomp: plug a potential memory leak libxkbcommon-1.0.3/src/xkbcomp/ast-build.c:526: leaked_storage: Variable "file" going out of scope leaks the storage it points to. Where we exit the loop early, we don't release the various allocated memory. Make this patch more obvious my moving the declaration for those into the loop as well, this way we know that they aren't used outside the loop anywhere. Found by coverity Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 01aa2222 | 2021-03-18 11:22:38 | registry: plug a potential memleak for invalid rules files If the name is missing in a configItem, we'd fail and leak the memory for description, brief and vendor. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 21c864cc | 2021-03-09 09:44:25 | Inline x11_atom_interner_adopt_atoms() into callers Signed-off-by: Uli Schlachter <psychon@znc.in> | ||
| c0339701 | 2021-03-07 09:24:40 | Save another GetAtomName round trip Both get_atom_name() and the new atom interner required a round trip. Move get_atom_name() into the atom interner to save one more round trip. This brings xkb_x11_keymap_new_from_device() down to two round trips, which is the minimum possible number. (Also, I think the new code in keymap.c is more readable than the mess I previously created) With this last commit in the series, this definitely: Fixes: https://github.com/xkbcommon/libxkbcommon/pull/217 Signed-off-by: Uli Schlachter <psychon@znc.in> | ||
| c8efc3d6 | 2021-03-07 08:48:34 | Also batch the XKB GetNames request This gets rid of another round trip. Signed-off-by: Uli Schlachter <psychon@znc.in> | ||
| 599064cf | 2021-03-07 08:46:19 | Also batch the XKB-GetMapMap request This gets rid of one more round trip. Signed-off-by: Uli Schlachter <psychon@znc.in> | ||
| 1b3a1c27 | 2021-03-07 08:42:54 | Remove three more round trips There are a number of XKB requests needed to request all the information from the X11 server. So far, the code was sending one request and waiting for the reply. This commit starts batching the request so that we get multiple replies with one round trip. This removes three round trips. Only the simple requests are converted. get_map() and get_names() use some bitmasks that are needed for both the request and the reply. These will be dealt with separately. Signed-off-by: Uli Schlachter <psychon@znc.in> | ||
| b9707c1d | 2021-03-07 08:01:49 | Save three more round trips in xkb_x11_keymap_new_from_device() Instead of asking for an atom name and waiting for the reply four times, this now sends four GetAtomName requests and waits for all the replies at once. Thus, this saves three round trips. Signed-off-by: Uli Schlachter <psychon@znc.in> | ||
| 40c00b47 | 2021-03-07 07:42:28 | xkb_x11_keymap_new_from_device: Less X11 round-trips On my system, calling xkb_x11_keymap_new_from_device() did 78 round trips to the X11 server, which seems excessive. This commit brings this number down to about 9 to 10 round trips. The existing functions adopt_atom() and adopt_atoms() guarantee that the atom was adopted by the time they return. Thus, each call to these functions must do a round-trip. However, none of the callers need this guarantee. This commit makes "atom adopting" asynchronous: Only some time later is the atom actually adopted. Until then, it is in some pending "limbo" state. This actually fixes a TODO in the comments. Fixes: https://github.com/xkbcommon/libxkbcommon/issues/216 Signed-off-by: Uli Schlachter <psychon@znc.in> | ||
| 30ce6c04 | 2021-02-26 10:54:31 | Fix a few keysymtab entries to match their comment in xkbcommon-keysyms.h Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 0bfc71e7 | 2021-02-22 08:20:40 | Update keysym definitions to latest xorgproto As of xorgproto commit e5d8af9711516385f8346c9e077692b29c914478 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| fbf087ea | 2020-11-23 19:51:04 | keymap-dump: follow xkbcomp in printing affect=both in pointer actions It is equivalent to nothing but good to match up. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| ac6cd20c | 2020-11-23 18:49:49 | x11: fix type level names missing When reading the keymap, the level names would get discarded. Regressed in 26453b84732da870f5695ee347970b337cfea9c1. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 4aed3c68 | 2020-11-23 18:24:52 | x11/keymap: fix case with no actions Possible regression in f41e609bbea8447fc82849a1a6ea0d116189f2f8 (not confirmed yet). Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 1bd3b3c7 | 2020-11-19 00:28:37 | x11: cache X11 atoms On every keymap notify event, the keymap should be refreshed, which fetches the required X11 atoms. A big keymap might have a few hundred of atoms. A profile by a user has shown this *might* be slow when some intensive amount of keymap activity is occurring. It might also be slow on a remote X server. While I'm not really sure this is the actual bottleneck, caching the atoms is easy enough and only needs a couple kb of memory, so do that. On the added bench-x11: Before: retrieved 2500 keymaps from X in 11.233237s After : retrieved 2500 keymaps from X in 1.592339s Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| f41e609b | 2020-11-20 12:45:42 | x11: eliminate slow divisions Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| afdc9cee | 2020-10-19 10:49:37 | xkbcomp: where a keysym cannot be resolved, set it to NoSymbol Where resolve_keysym fails we warn but use the otherwise uninitialized variable as our keysym. That later ends up in the keymap as random garbage hex value. Simplest test case, set this in the 'us' keymap: key <TLDE> { [ xyz ] }; And without this patch we get random garbage: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ 0x018a5cf0 ] }; With this patch, we now get NoSymbol: ./build/xkbcli-compile-keymap --layout us | grep TLDE: key <TLDE> { [ NoSymbol ] }; | ||
| 69713ce3 | 2020-09-11 05:06:23 | parser: fix another format string for int64_t (#191) | ||
| d3274752 | 2020-09-07 19:49:36 | utils: include unistd.h where we have it MacOS doesn't have eaccess/euidaccess but it does have unistd.h, so let's include it to silence the R_OK redefinition compiler warnings. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| a350222c | 2020-09-07 19:47:42 | context: fix a compiler warning ../src/context.c:57:9: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 3039d62a | 2020-09-07 19:38:47 | registry: mark the rxkb_log function as attribute printf Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| bbc7005b | 2020-07-27 11:55:32 | xkbcomp: simplify the include path handling Streamline the code a bit - instead of handling all the if (!file) conditions handle the case of where we have a file and jump to the end. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 351b4b9c | 2020-07-27 11:48:29 | xkbcomp: move the logging of include paths into a helper function No functional changes, prep work for some other refacturing. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| d7b39f6f | 2020-07-10 08:50:02 | Add /etc/xkb as extra lookup path for system data files This completes the usual triplet of configuration locations available for most processes: - vendor-provided data files in /usr/share/X11/xkb - system-specific data files in /etc/xkb - user-specific data files in $XDG_CONFIG_HOME/xkb The default lookup order user, system, vendor, just like everything else that uses these conventions. For include directives in rules files, the '%E' resolves to that path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 05d6efc4 | 2020-07-10 15:16:50 | xkbcomp: allow including kccgst files from other paths Previously, a 'symbols/us' file in path A would shadow the same file in path B. This is suboptimal, we rarely need to hide the system files - we care mostly about *extending* them. By continuing to check other lookup paths, we make it possible for a XDG_CONFIG_HOME/xkb/symbols/us file to have sections including those from /usr/share/X11/xkb/symbols/us. Note that this is not possible for rules files which need to be manually controlled to get the right bits resolved. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| ddd1188d | 2020-07-17 01:09:47 | Make path retrieval consistent in xkb_compose_table_new_from_locale() | ||
| 17ad0df1 | 2020-07-16 12:06:49 | compose: add xdg base directory support Before reading ~/.XCompose, try to read $XDG_CONFIG_HOME/XCompose (falling back to ~/.config/XCompose). This helps unclutter the home directory of users who want that. | ||
| dcb6c7b8 | 2020-07-10 15:13:38 | xkbcomp: return NULL, not false in place of a FILE* Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| d4b78a5f | 2020-07-10 15:01:31 | xkbcomp: simplify buffer handling in the include handling Don't do the realloc dance, just asprintf to the buffer and move on. The check is likely pointless anyway, if we run out of asprintf size, log_error will probably blow up as well. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 41a7c975 | 2020-07-10 14:57:57 | Add asprintf_safe helper function We only ever care about whether we error out or not, so let's wrap this into something more sane. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| ce286601 | 2020-07-07 10:16:25 | context: log include paths for debugging Now that we're relying on various different include paths, let's log that ones we use and the ones we failed to use. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| e55587f4 | 2020-07-08 09:12:23 | meson.build: always set the default variants/options Make this more balanced with the rules/layouts so we can rely on that #define to exist. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| afb26e7d | 2020-05-12 14:09:50 | Add libxkbregistry to query available RMLVO This library is the replacement for clients parsing evdev.xml directly. Instead, they should use the API here so that in the future we may even be able to swap evdev.xml for a more suitable data format. The library parses through evdev.xml (using libxml2) and - if requested - through evdev.extras.xml as well. The merge approach is optimised for the default case where we have a system-installed rules XML and another file in $XDG_CONFIG_DIR that adds a few entries. We load the system file first, then append any custom ones to that. It's not possible to overwrite the MLVO list provided by the system files - if you want to do that, get the change upstream. XML validation is handled through the DTD itself which means we only need to check for a nonempty name, everything else the DTD validation should complain about. The logging system is effectively identical to xkbcommon. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| fe886133 | 2020-06-23 11:07:53 | utils: add streq_null() for streq that allows NULL values Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 9b1b0c57 | 2020-06-16 10:34:07 | Add a snprintf_safe() helper function Returns true on success or false on error _or_ truncation. Since truncation is almost always an error anyway, we might as well make this easier to check. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| d075c3e6 | 2020-06-01 14:16:23 | Factor the access check for paths out Easier to re-use without having to duplicate ifdefs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 892cfef8 | 2020-05-20 20:42:02 | keysyms: add XKB_KEY_XF86FullScreen Updated using ./scripts/update-keysyms using latest xorgproto. Fixes: https://github.com/xkbcommon/libxkbcommon/issues/147 Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 860cfc03 | 2020-04-05 00:07:57 | keymap: don't forget about fallback mappings in xkb_keymap_key_get_mods_for_level() If the active set of modifiers doesn't match any explicit entry of the key type, the resulting level is 0 (i.e. Level 1). Some key types don't explicitly map Level 1, taking advantage of this fallback. Previously, xkb_keymap_key_get_mods_for_level didn't consider this, and only reported masks for explicit mappings. But this causes some glaring omissions, like matching "a" in the "us" keymap returning not results. Since every mask which isn't explicitly mapped falls back to 0, we can't return the all. Almost always the best choice for this is the empty mask, so return that, when applicable. Fixes https://github.com/xkbcommon/libxkbcommon/issues/140. Reported-by: https://github.com/AliKet Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| d92a248c | 2020-02-05 17:42:06 | API to query modifier set required to type a keysym The new API is useful to implement features like auto-type and desktop automation. Since the inputs for these features is usually specified in terms of the symbols that need to be typed, the implementation needs to be able to invert the keycode->keysym transformation and produce a sequence of keycodes that can be used to type the requested character(s). | ||
| 0345aba0 | 2020-02-12 23:44:42 | Support translation Unicode codepoints to keysyms 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(). | ||
| 5354dee2 | 2019-08-05 13:52:18 | MSVC: Use <io.h> as an alternative for <unistd.h> Only the input/output functions from <unistd.h> options are used, so using <io.h> when building with MSVC should be enough. The inclusion of the header in context-priv.c does not seem to be needed (tested on GNU/Linux) and so it is removed. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| fadfb13c | 2019-12-28 14:19:22 | xkbcomp/rules: support \r\n line endings Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| da4a90c1 | 2019-12-28 13:49:40 | Open files in binary mode This turns off some misfeatures on Windows, and does nothing on POSIX. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 521bb498 | 2019-12-27 22:08:57 | xkbcomp: remove cast which triggers warning on gcc Will need some other way to take care of the warning on MSVC. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| fbd0e643 | 2019-12-27 21:51:34 | xkbcomp: make a couple of casts explicit to mark them as checked This acknowledges some "possible loss of data cast" warnings from MSVC. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 1849158a | 2019-12-27 15:10:10 | xkbcomp/keywords: regenerate with newer gperf Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 823708b7 | 2019-12-27 14:51:31 | parser: fix format string for int64_t Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 670566f0 | 2019-12-27 15:03:10 | Only add GCC diagnostic pragmas when compiler is GCC compatible Avoid "unknown pragma" warnings on other compilers. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 40bea8e9 | 2019-12-27 14:52:49 | xkbcomp: fix wrong return type Detected by MSVC: xkbcomp\xkbcomp.c(111): warning C4047: 'return': 'bool' differs in levels of indirection from 'void *' Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 6ca1a0c9 | 2019-12-27 14:17:55 | parser: use int64_t for all numbers Don't use int which can have different size on different machines. Also avoid some warnings from MSVC: xkbcomp/parser.y(760): warning C4244: '=': conversion from 'int64_t' to 'int', possible loss of data xkbcomp/parser.y(761): warning C4244: '=': conversion from 'int64_t' to 'int', possible loss of data xkbcomp/parser.y(767): warning C4244: '=': conversion from 'int64_t' to 'int', possible loss of data Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| c3ac58a9 | 2019-12-27 14:06:47 | scanner-utils: avoid possible implicit truncating of line/column This increases the size of the struct a bit but it's not very important. Fixes these MSVC warnings: src\scanner-utils.h(112): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data src\scanner-utils.h(147): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 0fdd29bb | 2019-12-27 13:55:24 | utils: move macro defines to before they're used Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 64137a4a | 2019-12-27 13:52:51 | utils: fix typo in strndup fallback Fixup 93a1305 - we will have CI for this soon. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 40aab05e | 2019-12-27 13:03:20 | build: include config.h manually 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> | ||
| bdff8ebe | 2019-08-05 16:18:05 | Provide a fallback implementation of [v]asprintf() Some environments (e.g. Windows + MSVC) do not provide asprintf() or vasprintf(). This tries to detect their presence, and provides suitable fallback implementations when not available. | ||
| 93a13050 | 2019-08-05 16:07:57 | Provide a fallback implementation of strndup() Some environments (e.g. Windows + MSVC) do not provide strndup(), this tries to detect its presence and provide a fallback implementation when not available. [ran: some tweaks] | ||
| a8acc2ff | 2019-08-05 15:59:20 | Use built-in istr[n]cmp() instead of strcase[n]cmp() This avoids the problem that MSVC does not provide strcasecmp() nor strncasecmp(), and at the same time avoids potential problems due to locale configuration by using istrcmp() and istrncmp() which are already in the source tree and written to cover only ASCII. | ||
| 34122f9f | 2019-12-27 12:34:49 | utils: use MIN/MAX instead of min/max min/max symbols conflict on some systems (msvc), so just use the macros. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| ade13130 | 2019-12-27 12:22:37 | xkbcomp: downgrade "Symbol added to modifier map for multiple modifiers" log to a warning This condition happens in xkeyboard-config keymaps and seems hard to fix. Currently it incessantly spams people's logs who have no idea what to do about it. So downgrade to "warning" level, so it doesn't show up by default. When working on keymaps, set `XKB_LOG_LEVEL=debug XKB_LOG_VERBOSITY=10` to see all possible messages. Refs https://github.com/xkbcommon/libxkbcommon/issues/111 Fixes https://github.com/xkbcommon/libxkbcommon/issues/128 Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 00f31e0d | 2019-11-13 11:38:39 | rules: eliminate an extra fopen/fclose cycle FindXkbFileInPath() opens the file so we're guaranteed that the file not only exists, but that we can read it. Changing that would alter behavior so instead let's just pass that file handle along and do the same for include files. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| ca033a29 | 2019-09-03 11:23:14 | rules: add include statements to rules files The majority use-case for extending XKB on a machine is to override one or a few keys with custom keycodes, not to define whole layouts. Previously, we relied on the rules file to be a single file, making it hard to extend. libxkbcommon parses $XDG_CONFIG_HOME/xkb/ but that only works as long as there is a rule that matches the user-specified RMLVO. This works for MLV but not for options which don't have a wildcard defined. Users have to copy the whole rules file and then work from there - not something easy to extend and maintain. This patch adds a new ! include directive to rules files that allows including another file. The file path must be without quotes and may not start with the literal "include". Two directives are supported, %H to $HOME and %S for the system-installed rules directory (usually /usr/share/X11/xkb/rules). A user would typically use a custom rules file like this: ! option = symbols custom:foo = +custom(foo) custom:bar = +custom(baz) ! include %S/evdev Where the above defines the two options and then includes the system-installed evdev rule. Since most current implementations default to loading the "evdev" ruleset, it's best to name this $XDG_CONFIG_HOME/xkb/rules/evdev, but any valid name is allowed. The include functionally replaces the line with the content of the included file which means the behavior of rules files is maintained. Specifically, custom options must be defined before including another file because the first match usually wins. In other words, the following ruleset will not assign my_model as one would expect: ! include %S/evdev ! model = symbols my_model = +custom(foo) The default evdev ruleset has wildcards for model and those match before the my_model is hit. The actual resolved components need only be in one of the XKB lookup directories, e.g. for the example above: $ cat $XDG_CONFIG_HOME/xkb/symbols/custom partial alphanumeric_keys xkb_symbols "foo" { key <TLDE> { [ VoidSymbol ] }; }; partial alphanumeric_keys xkb_symbols "baz" { key <AB01> { [ k, K ] }; }; This can then be loaded with the XKB option "custom:foo,custom:bar". The use of "custom" is just as an example, there are no naming requirements beyond avoiding already-used ones. Also note the bar/baz above - the option names don't have to match the component names. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 67b538dd | 2019-09-30 15:39:08 | context: add a helper function to return the default system include path No functional changes but we'll need that same lookup in the rules file include handling in a future patch. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 3c57b328 | 2019-11-12 15:27:22 | rules: move the matcher result handling to the caller This shouldn't be processed in the matcher itself, especially in the glorious future when we can have nested matchers. Only handle this once in the caller to the original parsed file. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 2ec07b62 | 2019-11-12 14:19:55 | rules: put the scanner on the stack This allows nesting the scanner for the future !include directive. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| bb7551a6 | 2019-11-12 15:25:16 | rules: simplify an error path Initialize to NULL so we don't have to care about whether the cleanups can be called or not. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| d9b98856 | 2019-11-12 14:39:47 | rules: rename a variable from 's' to 'str' To avoid name conflicts with a future patch. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 2a578a60 | 2019-11-12 14:17:44 | rules: drop the matcher_err() macro and use scanner_err directly No functional changes, this is what the macro expanded to anyway. Prep work for putting the scanner on the stack and removing it from the matcher struct. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| f57c13ea | 2019-09-03 10:56:01 | rules: factor out the function to parse a rules file No functional changes, this just makes the part to parse a single rules file re-usable. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| 13b30f4f | 2019-12-13 13:35:25 | keysym: handle ssharp in XConvertCase() lowercase: LATIN SMALL LETTER SHARP S (U+00DF) uppercase: LATIN CAPITAL LETTER SHARP S (U+1E9E) The uppercase sharp s (XK_ssharp) is a relatively recent addition to unicode but was added to the relevant keyboard layouts in xkeyboard-config-2.25 (d1411e5e95c) https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/issues/144 Alas, the CapsLock behavior was broken on the finnish layout (maybe others). This was due XConvertCase() never returning the uppercase characters. Let's make this function return the right lower/upper symbols for the sharp s and hope that the world won't get any worse because of it. Corresponding Xlib issue: https://gitlab.freedesktop.org/xorg/lib/libx11/issues/110 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> | ||
| a237f4f6 | 2019-12-14 13:44:33 | parser: fix the remaining pointer chasing Fix the TODO added in 7c42945. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 7c42945e | 2019-11-13 22:41:38 | parser: fix quadratic pointer chasing In the AST, lists (e.g. the list of statements in a file) are kept in singly-linked lists -- each AST node has a `next` pointer available for this purpose. Previously, a node was added to the list by starting from the head, chasing to the last, and appending. So creating a list of length N would take ~N^2/2 pointer dereferences. Now, we always (temporarily) keep the last as well, so appending is O(1) instead of O(N). Given a keymap xkb_keymap { xkb_keycodes { minimum = 8; minimum = 8; minimum = 8; minimum = 8; minimum = 8; [... repeated N times ...] }; xkb_types {}; xkb_compat {}; xkb_symbols {}; }; The compilation times are N | Before | After --------|----------|------- 10,000 | 0.407s | 0.006s 20,000 | 1.851s | 0.015s 30,000 | 5.737s | 0.021s 40,000 | 12.759s | 0.023s 50,000 | 21.489s | 0.035s 60,000 | 40.473s | 0.041s 70,000 | 53.336s | 0.039s 80,000 | 72.485s | 0.044s 90,000 | 94.703s | 0.048s 100,000 | 118.390s | 0.057s Another option is to ditch the linked lists and use arrays instead. I got it to work, but its more involved and allocation heavy so turns out to be worse without further optimizations. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| f9b95c06 | 2019-11-13 23:37:47 | parser: remove an unneeded check Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 3d43f480 | 2019-11-12 22:31:46 | compat: reject interpret modifier predicate with more than one value Given interpret ISO_Level3_Shift+AnyOf(all,extraneous) { ... }; Previously, extraneous (and further) was ignored. Now it's rejected. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 7d44c7a9 | 2019-11-12 22:09:19 | expr: fix log message on some unexpected expression types Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 406beeca | 2019-11-12 22:06:02 | Replace some tabs that sneaked in with spaces Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 322cd856 | 2019-11-12 20:34:31 | parser: fix merge mode only applied to first vmod in a virtual_modifiers statement Given augment virtual_modifiers NumLock,Alt,LevelThree Previously it was expanded (directly in the parser) to augment virtual_modifiers NumLock; virtual_modifiers Alt; virtual_modifiers LevelThree; Now it expands to augment virtual_modifiers NumLock; augment virtual_modifiers Alt; augment virtual_modifiers LevelThree; Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 400cc849 | 2019-11-12 20:04:13 | ast: use a separate expr struct for action list Currently it's under UnaryExpr, which just doesn't make sense. Signed-off-by: Ran Benita <ran@unusedvar.com> | ||
| 8c62d48c | 2019-11-12 19:16:08 | ast-build: get rid of unhelpful macro Straightforward code is better here. Signed-off-by: Ran Benita <ran@unusedvar.com> |