|
ca7aa69c
|
2023-09-26T17:05:05
|
|
Disallow producing NULL character with escape sequences
NULL usually terminates the strings; allowing to produce it via escape
sequences may lead to undefined behaviour.
- Make NULL escape sequences (e.g. `\0` and `\x0`) invalid.
- Add corresponding test.
- Introduce the new message: XKB_WARNING_INVALID_ESCAPE_SEQUENCE.
|
|
a1770132
|
2023-09-25T11:41:48
|
|
Compose: add iterator API
Allow users to iterate the entries in a compose table. This is useful
for other projects which want programmable access to the sequences,
without having to write their own parser.
- New API:
- `xkb_compose_table_entry_sequence`;
- `xkb_compose_table_entry_keysym`;
- `xkb_compose_table_entry_utf8`;
- `xkb_compose_table_iterator_new`;
- `xkb_compose_table_iterator_free`;
- `xkb_compose_table_iterator_next`.
- Add tests in `test/compose.c`.
- Add benchmark for compose traversal.
- `tools/compose.c`:
- Print entries instead of just validating them.
- Add `--file` option.
- TODO: make this tool part of the xkbcli commands.
Co-authored-by: Pierre Le Marre <dev@wismill.eu>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
a83d745b
|
2023-09-21T20:06:27
|
|
Messages: add new messages to registry
This commit is another step to identify and document the maximum number
of logging messages. Bulk changes:
- Rename `conflicting-key-type` to `conflicting-key-type-merging-groups`.
Giving more context in the name allow us to introduce
`conflicting-key-type-definitions` later.
- Add conflicting-key-type-definitions
- Add conflicting-key-type-map-entry
- Add undeclared-modifiers-in-key-type
Also improve the log messages.
- Add conflicting-key-type-preserve-entries
- Use XKB_ERROR_UNSUPPORTED_MODIFIER_MASK
- Add illegal-key-type-preserve-result
- Add conflicting-key-type-level-names
- Add duplicate-entry
- Add unsupported-symbols-field
- Add missing-symbols-group-name-index
- Use XKB_ERROR_WRONG_FIELD_TYPE
- Add conflicting-key-name
- Use XKB_WARNING_UNDEFINED_KEYCODE
- Add illegal-keycode-alias
- Add unsupported-geometry-section
- Add missing-default-section
- Add XKB_LOG_MESSAGE_NO_ID
- Rename log_vrb_with_code to log_vrb
- Use ERROR_WRONG_FIELD_TYPE & ERROR_INVALID_SYNTAX
- Add unknown-identifier
- Add invalid-expression-type
- Add invalid-operation + fixes
- Add unknown-operator
- Rename ERROR_UNKNOWN_IDENTIFIER to ERROR_INVALID_IDENTIFIER
- Add undeclared-virtual-modifier
- Add expected-array-entry
- Add invalid-include-statement
- Add included-file-not-found
- Add allocation-error
- Add invalid-included-file
- Process symbols.c
- Add invalid-value
- Add invalid-real-modifier
- Add unknown-field
- Add wrong-scope
- Add invalid-modmap-entry
- Add wrong-statement-type
- Add conflicting-key-symbols-entry
- Add invalid-set-default-statement
|
|
c0065c95
|
2023-09-21T20:06:27
|
|
Messages: merge macros with and without message code
Previously we had two types of macros for logging: with and without
message code. They were intended to be merged afterwards.
The idea is to use a special code – `XKB_LOG_MESSAGE_NO_ID = 0` – that
should *not* be displayed. But we would like to avoid checking this
special code at run time. This is achieved using macro tricks; they
are detailed in the code (see: `PREPEND_MESSAGE_ID`).
Now it is also easier to spot the remaining undocumented log entries:
just search `XKB_LOG_MESSAGE_NO_ID`.
|
|
ef81d04e
|
2023-09-18T18:17:34
|
|
Structured log messages with a message registry
Currently there is little structure in the log messages, making
difficult to use them for the following use cases:
- A user looking for help about a log message: the user probably
uses a search engine, thus the results will depend on the proper
indexing of our documentation and the various forums. It relies
only on the wording of the message, which may change with time.
- A user wants to filter the logs resulting of the use of one of the
components of xkbcommon. A typical example would be testing
xkeyboard-config against libxkbcommon. It requires the use of a
pattern (simple words detection or regex). The issue is that the
pattern may become silently out-of-sync with xkbcommon.
A common practice (e.g. in compilers) is to assign unique error codes
to reference theses messages, along with an error index for
documentation.
Thus this commit implements the following features:
- Create a message registry (message-registry.yaml) that defines the
log messages produced by xkbcommon. This is a simple YAML file that
provides, for each message:
- A unique numeric code as a short identifier. It is used in the
output message and thus can be easily be filtered to spot errors
or searched in the internet. It must not change: if the
semantics of message changes, it is better to introduce a new
message for clarity.
- A unique text identifier, meant for two uses:
1. Generate constants dealing with log information in our code
base.
2. Generate human-friendly names for the documentation.
- A type: currently warning or error. Used to prefix the constants
(see hereinabove) and for basic classification in documentation.
- A short description, used as concise and mandatory documentation.
- An optionnal detailed description.
- Optional examples, intended to help the user to fix issues
themself.
- Version of xkbcommon it was added. For old entries this often
unknown, so they will default to 1.0.0.
- Version of xkbcommon it was removed (optional)
No entry should ever be deleted from this index, even if the message
is not used anymore: it ensures we have unique identifiers along the
history of xkbcommon, and that users can refer to the documentation
even for older versions.
- Add the script update-message-registry.py to generate the following
files:
- messages.h: message code enumeration for the messages currently
used in the code base. Currently a private API.
- message.registry.md: the error index documentation page.
- Modify the logging functions to use structured messages. This is a
work in progress.
|
|
eafd3ace
|
2023-09-18T18:17:39
|
|
Add a new warning for numeric keysyms
Usually it is better to use the corresponding human-friendly keysym
names. If there is none, then the keysym is most probably not
supported in the ecosystem. The only use case I see is similar to the
PUA in Unicode (see: https://en.wikipedia.org/wiki/Private_Use_Areas).
I am not aware of examples of this kind of use.
|
|
e7f02d32
|
2023-08-05T15:29:36
|
|
parser: change deprecated `%pure-parser` to `%define api.pure` (#370)
This is now supported by byacc since version 2.0 20230516
|
|
7a815ad3
|
2023-07-04T09:23:24
|
|
Fix parsing of numeric keysyms in ExprResolveKeySym
`ExprResolveKeySym` in `expr.c` does not parse non-digit numeric
keysyms.
Fixed by checking upper bound; also add warning messages.
|
|
0da68bc6
|
2023-07-04T09:23:24
|
|
Simplify parsing of numeric keysyms in parser.y
In `parser.y`, a numeric keysym is parsed by formatting it in its
hexadecimal form then parsed as a keysym name. This is convoluted.
Fixed by checking directly the upper bound.
|
|
397e7e01
|
2023-07-04T09:23:24
|
|
Fix xkb_keysym_from_name for numeric keysyms
When parsing hexadecimal keysym using `xkb_keysym_from_name`,
the result is limited by `parse_keysym_hex` to 0xffffffff, but the
maximum keysym is XKB_MAX_KEYSYM, i.e. 0x1fffffff.
Fixed by adding an upper bound.
|
|
4823838f
|
2023-07-04T09:23:23
|
|
Move STRINGIFY to utils.h and add STRINGIFY2
|
|
e811743f
|
2023-07-04T09:23:23
|
|
Add XKB_KEYSYM_MIN and XKB_KEYSYM_MAX
Keysyms are 32-bit integers with the 3 most significant bits always set
to zero. See: Appendix A “KEYSYM Encoding” of the X Window System
Protocol at https://www.x.org/releases/current/doc/xproto/x11protocol.html#keysym_encoding.
Add a new constants XKB_KEYSYM_MIN and XKB_KEYSYM_MAX to make the
interval of valid keysyms more obvious in the code.
|
|
f3210cbf
|
2023-05-15T14:23:16
|
|
compose: drop the 65535 node limit (#343)
In commit 1638409b22aef33d487863876ab214b949db4984, the number of
compose nodes was limited to 65535 to enable "future optimizations",
which apparently means slightly reduced memory usage due to fitting in
a uint16_t. At this time, it was mentioned that the author was not
aware of "any compose files which come close".
However, I'm one of the users that actually do require a larger number
of nodes for their compose file. Thus, use a uint32_t again and raise
the limit significantly.
|
|
183761ac
|
2023-05-13T17:26:24
|
|
Do not interpret nor emit invalid Unicode encoding forms
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
|
|
5fbffaf0
|
2023-05-13T07:17:58
|
|
Add warning when RMLVO with no layout but variant set
There is no feedback that they are both replaced with default values.
Fix it by adding a warning informing about missing layout and show the
defaults for both.
|
|
5a5ab3e8
|
2023-05-06T17:14:04
|
|
utils: fix printf format warnings on mingw
See:
https://github.com/mesonbuild/wrapdb/pull/819
https://github.com/Exiv2/exiv2/blob/c86ae6acf597304db37246434ebc393d732c22c2/src/image_int.hpp#L15
https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
b06aedb8
|
2023-05-02T14:15:55
|
|
scanner: allow for a zero terminated string as keymap
As the documentation for xkb_keymap_new_from_buffer() states, the "input string
does not have to be zero-terminated". The actual implementation however failed
with "unrecognized token/syntax error" when it encountered a null byte.
Fix this by allowing a null byte at the last position of the buffer. Anything
else is likely a client error anyway.
Fixes #307
|
|
8b7c1850
|
2021-03-19T09:49:24
|
|
registry: remove a few asprintf/free() calls with snprintf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
a50890b1
|
2021-03-19T09:46:15
|
|
registry: simplify strdup() error handling
strdup() is the least likely call to fail here, let's move it to the bottom so
we don't need to worry about the allocated string.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
5b5b67f2
|
2023-05-01T22:30:41
|
|
Add support for modmap None (#291)
Unlike current xkbcommon, X11’s xkbcomp allows to remove entries in
the modifiers’ map using “modifier_map None { … }”.
“None” is translated to the special value “XkbNoModifier” defined in
“X11/extensions/XKB.h”. Then it relies on the fact that in "CopyModMapDef",
the following code:
1U << entry->modifier
ends up being zero when “entry->modifier” is “XkbNoModifier” (i.e. 0xFF).
Indeed, it relies on the overflow behaviour of the left shift, which in
practice resolves to use only the 5 low bits of the shift amount, i.e.
0x1F here. Then the result of “1U << 0xFF” is cast to “char”, i.e. 0.
This is a good trick but too magical, so in libxkbcommon we will use
an explicit test against our new constant XKB_MOD_NONE.
|
|
003fdee1
|
2023-04-11T22:49:58
|
|
keysyms: add new keysyms XF86EmojiPicker, XF86Dictate
Ref: https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/commit/914d8f5e0f469cd0416364dd008e9eea752bf703
Ref: https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/commit/a839f0c7fc5596d10e786394d3b0953eb8a1731b
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
bd79a960
|
2023-04-11T23:24:47
|
|
Possible fix for non-MSVC windows compilers
`_MSC_VER` is specific to MSVC, but there can be other compilers targeting
windows. Hopefully they do define `_WIN32`, so let's use that.
Refs: https://github.com/xkbcommon/libxkbcommon/issues/305
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
13d4b7f6
|
2023-03-29T08:29:15
|
|
keysym: replace deprecated Serbian_DZE with Cyrillic_DZHE
Same numeric value for both and the Serbian one has been listed as deprecated
for decades.
See https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/69#note_1843415
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
b4e81ca1
|
2022-12-16T01:26:25
|
|
context: add XKB_CONTEXT_NO_SECURE_GETENV flag (#312)
This flag is useful for clients that may have relatively benign capabilities
set, like CAP_SYS_NICE, that also want to use the xkb configuration from the
environment and user configs in XDG_CONFIG_HOME.
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/308
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/129
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
4d829390
|
2022-09-24T10:37:06
|
|
utils: move some MSVC compat stuff to common place
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
4000a1bd
|
2022-05-15T10:41:53
|
|
keysym-utf: remove bogus currency sign entries
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>
|
|
49e8a2d8
|
2022-05-15T10:32:58
|
|
keysym-utf: remove bogus Korean Won sign entry
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>
|
|
25367130
|
2022-04-27T18:45:54
|
|
Remove bogus euro sign entry from keysymtab
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>
|
|
b064b609
|
2022-05-14T01:11:32
|
|
Do not clear sibling entries when override.
lokid and hikid actually stores the sibling to current node, which
should not be cleared when override. This would break the sequence with
a common prefix when override another.
Fix #286
Signed-off-by: Weng Xuetian <wengxt@gmail.com>
|
|
0b3d9092
|
2022-03-14T16:44:13
|
|
scanner: prefix functions with `scanner_` to avoid symbol conflicts
Particularly `eof()` in mingw-w64.
Fixes: https://github.com/xkbcommon/libxkbcommon/pull/285
Reported-by: Marko Lindqvist
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
efa99624
|
2022-01-24T02:16:08
|
|
Variants should inherit iso639, iso3166 and brief from parent layout if omitted (#266)
|
|
9b05825e
|
2022-01-20T13:08:36
|
|
registry: skip over invalid ISO639 or ISO3166 entries
If the XML file is somehow off, don't load entries that are against the spec.
|
|
0e3f72af
|
2022-01-17T13:51:48
|
|
registry: don't call xmlCleanupParser()
From the documentation:
> It does not clean up parser state, it cleans up memory allocated by the library
> itself. It is a cleanup function for the XML library. It tries to reclaim all
> related global memory allocated for the library processing. [...]
> One should call xmlCleanupParser() only when the process has finished using the library.
http://xmlsoft.org/html/libxml-parser.html#xmlCleanupParser
Since we're a library ourselves we cannot know if something else in the same
proces uses the parser, so we must not call this.
Reported-by: M Hickford
|
|
4a576ab1
|
2021-08-31T21:50:52
|
|
x11: try to fix crash in xkb_x11_keymap_new_from_device error handling
In 1b3a1c277a033083fee669e92c8cad862716ebd1 we changed the error
handling in this code to not bail out immediately but only after
everything has been processed, to simplify the code. But I suspect the
code isn't prepared for this and that's what causing the crash reported
in the issue.
Bring back the short-circuit error handling which would hopefully fix
such crashes.
Fixes: https://github.com/xkbcommon/libxkbcommon/issues/252
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
4e361712
|
2021-08-31T22:03:03
|
|
x11: stylistic fixes
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
09ac27f7
|
2021-05-22T19: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-08T21:08:37
|
|
compose: add mapped locale to Compose-file-not-found error log
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
16fe837d
|
2019-11-02T16: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-22T00: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-07T10: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-02T15:00:46
|
|
compose: fix max compose nodes check
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
45b1ca22
|
2021-04-01T22: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-01T22:07:28
|
|
keysym: avoid strtoul in xkb_keysym_from_name
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
68e69b7d
|
2021-03-28T20: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-29T16: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-30T20: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-30T20:12:08
|
|
compose: use anonymous union
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
1c0e28ad
|
2021-03-30T19: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-30T17: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-30T08: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-30T07: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-29T16: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-28T15: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-28T15: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-28T15:23:40
|
|
keysym: use a more descriptive argument name
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
a717549e
|
2021-03-28T15: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-28T13: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-18T12: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-18T11: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-09T09:44:25
|
|
Inline x11_atom_interner_adopt_atoms() into callers
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
c0339701
|
2021-03-07T09: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-07T08: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-07T08: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-07T08: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-07T08: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-07T07: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-26T10: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-22T08: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-23T19: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-23T18: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-23T18: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-19T00: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-20T12:45:42
|
|
x11: eliminate slow divisions
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
afdc9cee
|
2020-10-19T10: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-11T05:06:23
|
|
parser: fix another format string for int64_t (#191)
|
|
d3274752
|
2020-09-07T19: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-07T19: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-07T19:38:47
|
|
registry: mark the rxkb_log function as attribute printf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
d7b39f6f
|
2020-07-10T08: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-10T15: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>
|
|
bbc7005b
|
2020-07-27T11: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-27T11: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>
|
|
ddd1188d
|
2020-07-17T01:09:47
|
|
Make path retrieval consistent in xkb_compose_table_new_from_locale()
|
|
17ad0df1
|
2020-07-16T12: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-10T15: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-10T15: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-10T14: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-07T10: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-08T09: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-12T14: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-23T11: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-16T10: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-01T14: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-20T20: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-05T00: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-05T17: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-12T23: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-05T13: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-28T14:19:22
|
|
xkbcomp/rules: support \r\n line endings
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
da4a90c1
|
2019-12-28T13: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>
|