summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Also batch the XKB-GetMapMap requestUli Schlachter2021-03-091-15/+15
| | | | | | This gets rid of one more round trip. Signed-off-by: Uli Schlachter <psychon@znc.in>
* Remove three more round tripsUli Schlachter2021-03-091-18/+18
| | | | | | | | | | | | | | | 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>
* Save three more round trips in xkb_x11_keymap_new_from_device()Uli Schlachter2021-03-093-8/+39
| | | | | | | | 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>
* xkb_x11_keymap_new_from_device: Less X11 round-tripsUli Schlachter2021-03-093-104/+157
| | | | | | | | | | | | | | | | | | 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>
* 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>
* Update keysym definitions to latest xorgprotoPeter Hutterer2021-02-221-3499/+3925
| | | | | | As of xorgproto commit e5d8af9711516385f8346c9e077692b29c914478 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* keymap-dump: follow xkbcomp in printing affect=both in pointer actionsRan Benita2020-11-231-4/+6
| | | | | | It is equivalent to nothing but good to match up. Signed-off-by: Ran Benita <ran@unusedvar.com>
* x11: fix type level names missingRan Benita2020-11-231-0/+1
| | | | | | | When reading the keymap, the level names would get discarded. Regressed in 26453b84732da870f5695ee347970b337cfea9c1. Signed-off-by: Ran Benita <ran@unusedvar.com>
* x11/keymap: fix case with no actionsRan Benita2020-11-231-9/+10
| | | | | | | Possible regression in f41e609bbea8447fc82849a1a6ea0d116189f2f8 (not confirmed yet). Signed-off-by: Ran Benita <ran@unusedvar.com>
* x11: cache X11 atomsRan Benita2020-11-203-5/+56
| | | | | | | | | | | | | | | | | | | | 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>
* x11: eliminate slow divisionsRan Benita2020-11-201-22/+23
| | | | Signed-off-by: Ran Benita <ran@unusedvar.com>
* xkbcomp: where a keysym cannot be resolved, set it to NoSymbolPeter Hutterer2020-10-201-1/+3
| | | | | | | | | | | | | | | | 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 ] };
* parser: fix another format string for int64_t (#191)hhb2020-09-111-1/+1
|
* utils: include unistd.h where we have itPeter Hutterer2020-09-071-1/+1
| | | | | | | 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>
* context: fix a compiler warningPeter Hutterer2020-09-071-1/+1
| | | | | | | ../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>
* registry: mark the rxkb_log function as attribute printfPeter Hutterer2020-09-071-0/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add /etc/xkb as extra lookup path for system data filesPeter Hutterer2020-08-304-2/+27
| | | | | | | | | | | | | | | 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>
* xkbcomp: allow including kccgst files from other pathsPeter Hutterer2020-08-303-22/+49
| | | | | | | | | | | | | 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>
* xkbcomp: simplify the include path handlingPeter Hutterer2020-08-301-18/+11
| | | | | | | 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>
* xkbcomp: move the logging of include paths into a helper functionPeter Hutterer2020-08-301-18/+26
| | | | | | No functional changes, prep work for some other refacturing. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Make path retrieval consistent in xkb_compose_table_new_from_locale()Emmanuel Gil Peyrot2020-07-233-15/+13
|
* compose: add xdg base directory supportEmmanuel Gil Peyrot2020-07-233-0/+29
| | | | | | | 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.
* xkbcomp: return NULL, not false in place of a FILE*Peter Hutterer2020-07-131-1/+1
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* xkbcomp: simplify buffer handling in the include handlingPeter Hutterer2020-07-131-23/+9
| | | | | | | | 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>
* Add asprintf_safe helper functionPeter Hutterer2020-07-134-24/+47
| | | | | | | 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>
* context: log include paths for debuggingPeter Hutterer2020-07-081-3/+12
| | | | | | | 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>
* meson.build: always set the default variants/optionsPeter Hutterer2020-07-081-8/+0
| | | | | | | 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>
* Add libxkbregistry to query available RMLVOPeter Hutterer2020-07-064-0/+1361
| | | | | | | | | | | | | | | | | | | | | 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>
* utils: add streq_null() for streq that allows NULL valuesPeter Hutterer2020-07-061-0/+8
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add a snprintf_safe() helper functionPeter Hutterer2020-07-061-0/+15
| | | | | | | 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>
* Factor the access check for paths outPeter Hutterer2020-07-062-6/+24
| | | | | | Easier to re-use without having to duplicate ifdefs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* keysyms: add XKB_KEY_XF86FullScreenRan Benita2020-05-201-327/+330
| | | | | | | Updated using ./scripts/update-keysyms using latest xorgproto. Fixes: https://github.com/xkbcommon/libxkbcommon/issues/147 Signed-off-by: Ran Benita <ran@unusedvar.com>
* keymap: don't forget about fallback mappings in ↵Ran Benita2020-04-181-3/+30
| | | | | | | | | | | | | | | | | | | | 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>
* API to query modifier set required to type a keysymJaroslaw Kubik2020-03-203-11/+44
| | | | | | | | | 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).
* 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().
* MSVC: Use <io.h> as an alternative for <unistd.h>Adrian Perez de Castro2019-12-282-2/+9
| | | | | | | | | 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>
* xkbcomp/rules: support \r\n line endingsRan Benita2019-12-281-1/+3
| | | | Signed-off-by: Ran Benita <ran@unusedvar.com>
* Open files in binary modeRan Benita2019-12-285-7/+7
| | | | | | This turns off some misfeatures on Windows, and does nothing on POSIX. Signed-off-by: Ran Benita <ran@unusedvar.com>
* xkbcomp: remove cast which triggers warning on gccRan Benita2019-12-271-1/+1
| | | | | | Will need some other way to take care of the warning on MSVC. Signed-off-by: Ran Benita <ran@unusedvar.com>
* xkbcomp: make a couple of casts explicit to mark them as checkedRan Benita2019-12-272-2/+5
| | | | | | This acknowledges some "possible loss of data cast" warnings from MSVC. Signed-off-by: Ran Benita <ran@unusedvar.com>
* xkbcomp/keywords: regenerate with newer gperfRan Benita2019-12-273-70/+109
| | | | Signed-off-by: Ran Benita <ran@unusedvar.com>
* parser: fix format string for int64_tRan Benita2019-12-271-1/+1
| | | | Signed-off-by: Ran Benita <ran@unusedvar.com>
* Only add GCC diagnostic pragmas when compiler is GCC compatibleRan Benita2019-12-271-0/+4
| | | | | | Avoid "unknown pragma" warnings on other compilers. Signed-off-by: Ran Benita <ran@unusedvar.com>
* xkbcomp: fix wrong return typeRan Benita2019-12-271-1/+1
| | | | | | | | 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>
* parser: use int64_t for all numbersRan Benita2019-12-271-6/+4
| | | | | | | | | | | 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>
* scanner-utils: avoid possible implicit truncating of line/columnRan Benita2019-12-271-3/+3
| | | | | | | | | | | 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>
* utils: move macro defines to before they're usedRan Benita2019-12-271-8/+8
| | | | Signed-off-by: Ran Benita <ran@unusedvar.com>
* utils: fix typo in strndup fallbackRan Benita2019-12-271-1/+1
| | | | | | Fixup 93a1305 - we will have CI for this soon. Signed-off-by: Ran Benita <ran@unusedvar.com>
* build: include config.h manuallyRan Benita2019-12-2734-0/+67
| | | | | | | | | 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>
* Provide a fallback implementation of [v]asprintf()Adrian Perez de Castro2019-12-272-0/+53
| | | | | | 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.