| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Fix the TODO added in 7c42945.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Currently it's under UnaryExpr, which just doesn't make sense.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
| |
Straightforward code is better here.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
| |
Bug accidentally introduced in 9a92b46.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
| |
Use an "add" bool parameter instead. This simplifies the code a bit.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
| |
Fixup of ccab349 - unlike the commit message, hash a byte twice instead
of zero times, which is probably better. This is how it was before.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
| |
FNV-1a instead of the djb2-like one from before.
Keep the unrolling since it seems quite beneficial, even though it loses
one byte if the length is odd...
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
| |
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
| |
The field is redundant.
Due to alignment, this will only save memory on 32bit architectures.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
| |
This requires (well, at least implemented by) casting away `const` which
is undefined behavior, and clang started to warn about it.
The micro optimization didn't save too many allocations, anyway.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use $XDG_CONFIG_HOME/xkb as the primary lookup path for XKB rules. Same
motivation as in 3a91788d9254b, however the XDG directories are more standard
and recommended these days than application-specific dotfiles.
The XDG spec says to fall back to $HOME/.config where XDG_CONFIG_HOME is not
set so we implement that behavior as well.
Fixes #112
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
|
|
|
|
|
|
| |
E.g. when Mutter has CAP_SYS_NICE and thus secure_getenv returns NULL.
Fixes https://bugs.archlinux.org/task/64191
[ran: changed to ignore error]
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
| |
It's used capitalized everywhere except a couple places.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
xkbcomp only accepts the "Level" prefix for a level name for levels 1 to
8, but the keymap dumping code added it always, e.g. "Level15".
The plain integer, e.g. "8", "15" is always accepted, so just use that.
Fixes https://github.com/xkbcommon/libxkbcommon/issues/113
Signed-off-by: Ran Benita <ran@unusedvar.com>
Reported-by: progandy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, the default include path was XKB_CONFIG_ROOT:~/.xkb.
The ~/.xkb include path is intended to allow the local user to customize
their keymaps without having to modify system paths.
But usually, the user only wants to customize specific parts. When
XKB_CONFIG_ROOT is first, the user can only customize through the "entry
point" (the RMLVO). When ~/.xkb is first, the user can drop in a file
and it will override the system one.
The impetus for this change is the rules file. "evdev" is hard-coded
everywhere, so it not often not possible to change to something else.
And the rules files determines how the rest of the RMLVO is interpreted.
So, to enable customization, we have these options:
A: System includes user.
B: User includes system.
C: Library goes over both in one or the other order.
Option A is problematic due to backward compatibility and is also
unnatural.
Option B gives the user control and is backward compatible, so that's
what we choose. This is also how Compose files are handled, and that
seems to work fine in the wild.
Option C is actually less flexible than B, and more complicated.
(The rules file format doesn't have an include statement yet, but it's
planned).
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
|
|
|
|
|
|
|
|
|
| |
We don't need to determine the total number of bits set to determine if
exactly one is set.
Additionally, on x86_64 without any -march=* flag, __builtin_popcount
will get compiled to a function call to the compiler runtime (on gcc),
or a long sequence of bit operations (on clang).
Signed-off-by: Michael Forney <mforney@mforney.org>
|
|
|
|
| |
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
|
|
|
|
|
|
|
|
|
|
| |
xproto recently has been extended with 2 new keysyms:
XF86XK_MonBrightnessCycle
XF86XK_RotationLockToggle
This commit is the result of running "scripts/update-keysyms" on a system
with the updated xproto installed.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Found by Oracle's Parfait 2.2 static analyzer:
Error: Buffer overrun
Read outside array bounds [read-outside-array-bounds] (CWE 125):
In array dereference of xkb_file_type_strings[type] with index type
Array size is 56 bytes, index <= 56
at line 734 of src/xkbcomp/ast-build.c in function 'xkb_file_type_to_string'.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
|
|
| |
Reported-by: @msmeissn
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
actions
Left shift of a negative integer. For some reason the protocol
representation here got really botched (in the spec it is just a nice
and simple INT16).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
|
|
|
|
|
| |
If we fail atom lookup, then we should not claim that we successfully
looked up the expression.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
| |
Don't try to divide through a signed char when indexing an array, lest
ye try to index off the start of it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
| |
The only time we could ever hit this was with count == 0, which seems
unnecessarily pedantic. But OK.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
|
| |
The list should have a NULL sentry. Add one.
testcase: 'interpret KP_Delete+AnyOfOrNaneo(ll)'
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
|
|
|
| |
Every user of ExprReturnLhs goes on to unconditionally dereference the
field return, which can be NULL if xkb_intern_atom fails. Return false
if this is the case, so we fail safely.
testcase: splice geometry data into interp
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
| |
testcase: 'virtualModifiers=LevelThreC'
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
| |
If we have an expression of the form 'l1' in an interp section, we
unconditionally try to dereference its args, even if it has none.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
|
|
|
| |
If the scanner indicates that we might have something which looks like a
map, but the parser in fact fails to create that map, we will try to
access the map regardless. Stop doing that.
testcase: 'xkb_keymap {' -> '#kb_keymap'
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity complains that a 7-byte string may not be null-terminated when copied
into act->data (size 7). This is fine, make a note of it.
All the strings in xkeyboard-config only use 6 bytes + null terminator so this
won't be an issue. The server (the only user of these) uses an 8-byte array
and forcibly null-terminates the string, see XkbDDXPrivate().
Everything else treats it as byte-array size 7 anyway so whether it's
null-terminated doesn't matter.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
|
| |
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
|
|
|
|
|
|
|
|
| |
Move the aliases copy to within the (num_key_aliases > 0) block.
Passing info->aliases into this fuction with invalid aliases will
cause log messages but num_key_aliases stays on 0. The key_aliases array
is never allocated and remains NULL. We then loop through the aliases, causing
a null-pointer dereference.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
|
|
|
|
|
| |
There's a (theoretical?) path where we might end up strcpy() buf without ever
writing to it. This happens if the mask is nonzero but specifies a modifier
larger than the one in the xkb_mod_set.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
|
|
|
|
|
|
| |
The parser would enter an infinite loop if an unterminated keysym
literal occurs at EOF.
Found with the afl fuzzer.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
xkb_geometry sections are ignored; previously the had done so by
returning NULL for the section's XkbFile, however some sections of the
code do not expect this. Instead, create an XkbFile for it, it will
never be processes and discarded later.
Caught with the afl fuzzer.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the XKB format, floats and various keywords can only be used in the
xkb_geometry section. xkbcommon removed support xkb_geometry, but still
parses it for backward compatibility. As part of ignoring it, the float
AST node and various keywords were removed, and instead NULL was
returned by their parsing actions. However, the rest of the code does
not handle NULLs, and so when they appear crashes usually ensue.
To fix this, restore the float AST node and the ignored keywords. None
of the evaluating code expects them, so nice error are displayed.
Caught with the afl fuzzer.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The expression evaluator would go into an infinite recursion when
evaluating something like this as a boolean: `!True`. Instead of
recursing to just `True` and negating, it recursed to `!True` itself
again.
Bug inherited from xkbcomp.
Caught with the afl fuzzer.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|