|
400cc849
|
2019-11-12T20: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-12T19:16:08
|
|
ast-build: get rid of unhelpful macro
Straightforward code is better here.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
4849bc19
|
2019-11-09T22:07:15
|
|
atom: a string is greater than its prefix
Bug accidentally introduced in 9a92b46.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
c79c8033
|
2019-11-09T21:25:01
|
|
atom: combine atom_intern() and atom_lookup()
Use an "add" bool parameter instead. This simplifies the code a bit.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
adbd9c6f
|
2019-11-09T13:47:16
|
|
atom: correct iteration count in hash function
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>
|
|
9ebf97d7
|
2019-11-09T13:12:02
|
|
atom: describe how this odd data structure works
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
ccab349c
|
2019-11-09T12:43:04
|
|
atom: use a better hash function
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>
|
|
9a92b464
|
2019-11-09T11:49:25
|
|
atom: style changes
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
1fe1b653
|
2019-11-09T11:39:17
|
|
atom: remove handling of garbage input
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
a5f95c2b
|
2019-11-09T11:33:45
|
|
atom: use explicit size for fingerprint
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
8ea4a001
|
2019-11-09T00:20:45
|
|
atom: replace an avoidable strlen
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
6f8bb5ee
|
2019-11-09T00:05:59
|
|
atom: remove redundant field
The field is redundant.
Due to alignment, this will only save memory on 32bit architectures.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
2af474e8
|
2019-11-02T13:31:44
|
|
parser: get rid of "stealing" atoms
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>
|
|
e23f1061
|
2019-10-25T14:36:16
|
|
Use XDG_CONFIG_HOME as first XKB search path
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>
|
|
4b378398
|
2019-10-20T19:06:19
|
|
context: Don't fail to create the context if HOME isn't available
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>
|
|
076047b2
|
2019-10-16T10:32:19
|
|
keymap-dump: use consistent capitalization for "Group<N>"
It's used capitalized everywhere except a couple places.
Signed-off-by: Ran Benita <ran@unusedvar.com>
|
|
a6ed0304
|
2019-10-16T10:27:12
|
|
keymap-dump: fix invalid names used for levels above 8
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
|
|
3a91788d
|
2019-10-03T17:27:00
|
|
context: move ~/.xkb to before XKB_CONFIG_ROOT in the default include path
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>
|
|
9d58bbd4
|
2019-06-04T14:01:02
|
|
Use bitwise test instead of popcount to check if one bit is set
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>
|
|
75d1110c
|
2019-03-23T23:29:29
|
|
symbols: add a comment to suppress warning from code analyzers
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
|
9b85d96d
|
2019-01-22T08:31:43
|
|
Sync Keysyms with recent xproto additions
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>
|
|
31f1f355
|
2018-09-30T16:04:29
|
|
Fix off-by-one error in index check in xkb_file_type_to_string
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>
|
|
c9a499c9
|
2018-08-24T09:14:14
|
|
darray: fix unprotected macro argument
Reported-by: @msmeissn
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a9ace75f
|
2018-08-18T14:28:15
|
|
x11: fix undefined behavior when copying the coordinates of ptr movements 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>
|
|
bb4909d2
|
2017-10-30T11:21:55
|
|
Fail expression lookup on invalid atoms
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>
|
|
5440aaa5
|
2017-06-26T21:52:27
|
|
Fix signed vs. unsigned confusion in name sanitisation
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>
|
|
4fcbc470
|
2017-06-26T21:49:49
|
|
darray: Don't call memcpy() on NULL
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>
|
|
ae7856db
|
2017-06-26T21:38:52
|
|
text: NULL-terminate SI mask names
The list should have a NULL sentry. Add one.
testcase: 'interpret KP_Delete+AnyOfOrNaneo(ll)'
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
38e1766b
|
2017-06-26T17:21:45
|
|
xkbcomp: Don't falsely promise from ExprResolveLhs
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>
|
|
4e2ee9c3
|
2017-06-26T17:18:16
|
|
xkbcomp: Don't explode on invalid virtual modifiers
testcase: 'virtualModifiers=LevelThreC'
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
96df3106
|
2017-06-26T17:12:29
|
|
xkbcomp: Don't crash on no-op modmask expressions
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>
|
|
a8ea7a1d
|
2017-06-26T16:45:16
|
|
parser: Don't set more maps when we don't have any
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>
|
|
c8168297
|
2018-08-01T18:47:24
|
|
action: make a note that we may not null-terminate private strings
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>
|
|
c1e5ac16
|
2018-07-30T14:11:46
|
|
xkbcomp: fix pointer value for FreeStmt
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
badb428e
|
2018-07-23T11:48:35
|
|
keycodes: don't try to copy zero key aliases
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>
|
|
9045b035
|
2018-07-23T11:17:17
|
|
text: init the target buffer to zero
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>
|
|
842e4351
|
2018-03-12T09:43:55
|
|
compose: fix infinite loop in parser on some inputs
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>
|
|
917636b1
|
2018-03-11T17:07:06
|
|
xkbcomp: fix crash when parsing an xkb_geometry section
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>
|
|
e3cacae7
|
2018-03-10T23:32:12
|
|
xkbcomp: fix crashes in the parser when geometry tokens appear
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>
|
|
1f9d1248
|
2018-03-10T23:10:47
|
|
xkbcomp: fix stack overflow when evaluating boolean negation
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>
|
|
5cee660f
|
2018-06-23T22:00:19
|
|
keysym-utf: reject out-of-range Unicode codepoints in xkb_keysym_to_utf{8,32}
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>
|
|
b63196e9
|
2018-02-27T20:24:57
|
|
keysym-utf: replace the Unicode characters for leftanglebracket and 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>
|
|
767fa86d
|
2017-12-21T14:18:07
|
|
Convert http:// -> https:// where possible
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4fccdee3
|
2017-12-18T16:41:21
|
|
x11: check and document the correct range of device IDs
The actual value is 127, not 255.
https://bugs.freedesktop.org/show_bug.cgi?id=104321
Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
47f45194
|
2017-12-12T15:44:52
|
|
compose/parser: be more careful when checking if sequence overrides or duplicates another
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2963e29f
|
2017-12-12T14:43:24
|
|
xkbcomp/ast-build: fix memory leak when appending multi-keysyms
`syms` was not freed.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
26453b84
|
2017-12-12T14:30:21
|
|
keymap: fix NULL dereference when dumping the default fallback type
The default fallback type uses
type->level_names = NULL
but the keymap-dump code was not checking this case.
Instead of adding more workarounds and possible bugs (e.g. previous
commit), let's just keep the number of level names separately. This has
the additional advantage retains extraneous level name if someone adds
them for some reason.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9f85d6b7
|
2017-12-12T14:02:17
|
|
xkbcomp/types: fix types being assigned the wrong number of levels in some circumstances
The buggy code assigned the number of levels based on the number of
level names in the definition, instead of the actual number of levels!
This would completely break type definitions which do not give names to
levels.
This was not noticed for so long because xkeyboard-config always gives
names to all levels.
This regressed in 61fed8dab9b8e27981f36ffc96666d7376546e30.
Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
18d6aebe
|
2017-12-11T22:41:55
|
|
keysym: add xkb_keysym_to_{lower,upper} to public API
These can be useful in some odd cases.
There is already an implementation (+ tests) for internal use, so all
that's needed is to export them.
If xkbcommon were to provide a way to convert a Unicode codepoint to a
keysym, this could have been implemented externally as follows:
uint32_t codepoint = xkb_keysym_to_utf32(keysym);
uint32_t upper_codepoint = my_unicode_library_to_upper(codepoint);
xkb_keysym_t upper_keysym = theoretical_xkb_keysym_from_utf32(upper_codepoint);
However keysym -> codepoint is not injective so such a function is not
possible strictly speaking.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0db1d313
|
2017-09-28T21:31:28
|
|
keysym-utf: Add missing codes for signifblank and permille keysyms
|
|
41f10188
|
2017-09-08T12:16:13
|
|
expr: paper over a maybe-uninitialized warning
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
993f4837
|
2017-07-31T18:16:37
|
|
build: fix out-of-tree build
The change in d44ba48 removed -I$(top_builddir)/src/xkbcomp, but this is
needed in order to find the generated parser.h file which is put in the
build dir.
I also added -I$(top_builddir)/src in order to match the meson behavior.
Fixes https://github.com/xkbcommon/libxkbcommon/issues/50
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
daebdb5e
|
2017-07-31T10:18:54
|
|
x11/keymap,test/interactive-evdev: fix a couple of clang-analyzer warnings
From my analysis these values cannot be null, but the analyzer cannot
see this. So assert it.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
939d0909
|
2017-05-10T14:46:03
|
|
Sync Keysyms with recent xproto additions
xproto recently has been extended with 4 new keysyms:
XF86XK_Keyboard
XF86XK_WWAN
XF86XK_RFKill
XF86XK_AudioPreset
This commit is the result of running "make update-keysyms" on a system
with the updated xproto installed.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
6b57344c
|
2017-04-27T20:06:21
|
|
state: cure boolean blindness in the filter functions' result
Makes it a little easier to understand the filters.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
927fd8f8
|
2017-04-27T19:17:53
|
|
state: remove unneeded NULL check
xkb_filter_new() cannot return NULL.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d44c3ab2
|
2017-04-27T19:14:56
|
|
state: reorder new() functions before the set() functions in the code
So that they may be read more naturally in chronological order.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ce38f96e
|
2017-04-11T15:09:23
|
|
Add explicit fallthrough case statements
When we fall through to another label in a case, add an explicit comment
noting so, to quiet GCC 7's warnings.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
1ec14d09
|
2016-12-02T22:46:53
|
|
compose: remove the keysym_from_name cache
The hit rate is high, but either the cache is slow or the function is
not fast enough -- the cache no longer holds its weight, leading only to
very modest improvements. If it's the former, it can definitely be
improved, the code is very dumb (though it worked just as well as any
other I tried back then). But instead, let's just kill it.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b5586a6c
|
2016-12-02T22:15:19
|
|
keysym: fix locale dependence in xkb_keysym_from_name()
We currently use strcasecmp, which is locale-dependent. In particular,
one well-known surprise even if restricted just ASCII input is found in
the tr_TR (Turkish) locale, see e.g.
https://msdn.microsoft.com/en-us/library/ms973919.aspx#stringsinnet20_topic5
We have known to avoid locale-dependent functions before, but in this
case, we forgot.
Fix it by implementing our own simple ASCII-only strcasecmp/strncasecmp.
Might have been possible to use strcasecmp_l() with the C locale, but
went the easy route.
Side advantage is that even this non-optimized version is faster than
the optimized libc one (__strcasecmp_l_sse42) since it doesn't need to
do the locale stuff. xkb_keysym_from_name(), which uses strcasecmp
heavily, becomes faster, and so for example Compose file parsing, which
uses xkb_keysym_from_name() heavily, becomes ~20% faster.
Resolves https://github.com/xkbcommon/libxkbcommon/issues/42
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
327364d2
|
2016-11-14T17:37:35
|
|
utils: rename popcount to avoid conflict in NetBSD
Resolves https://github.com/xkbcommon/libxkbcommon/issues/41
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
babc9e0c
|
2016-02-27T22:31:16
|
|
state: add GTK consumed modifiers mode
This is more or less what is implemented here:
https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkkeys-x11.c?h=3.19.10#n1131
The implementation here is more technically correct but should provide
the same results.
Try it out with ./test/interactive-evdev -g (modifiers prefixed with "-"
are consumed).
https://bugzilla.gnome.org/show_bug.cgi?id=754110
https://github.com/xkbcommon/libxkbcommon/issues/17
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a0a41332
|
2016-02-27T19:06:14
|
|
state: allow different modes for calculating consumed modifiers
The current functions dealing with consumed modifiers use the
traditional XKB definition of consumed modifiers (see description in the
added documentation). However, for several users of the library (e.g.
GTK) this definition is unsuitable or too eager. This is exacerbated by
some less-than-ideal xkeyboard-config type definitions (CTRL+ALT seems
to cause most grief...).
So, because we
- want to enable alternative interpretations, but
- don't want to expose too much internal details, and
- want to keep things simple for all library users,
we add a high-level "mode" parameter which selects the desired
interpretation. New ones can be added as long as they make some sense.
All of the old consumed-modifiers functions keep using the traditional
("XKB") mode. I mark xkb_state_mod_mask_remove_consumed() and as
deprecated without adding a *2 variant because I don't it is very useful
(or used) in practice.
Alternative modes are added in subsequent commits (this commit only adds
a mode for the existing behavior).
https://github.com/xkbcommon/libxkbcommon/issues/17
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
90611719
|
2016-02-27T22:29:57
|
|
utils: add popcount function
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0dd610fb
|
2016-06-09T16:32:05
|
|
keymap-dump: use consistent order set/latch/lock (style)
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c8e6996f
|
2016-06-09T15:30:21
|
|
src/state: match_mod_masks can return bool instead of int
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
763e2b7e
|
2016-03-13T20:24:44
|
|
src/utils: check if fileno() failed in map_file
fileno() can fail, if called on e.g. fmemopen() FILEs which are not
backed by a file descriptor. This functions uses mmap to map the entire
file to memory, so using such FILEs will not work.
(There is actually no change of behavior here, since the following fstat
would have already failed with EBADF. But lets make it clear.)
Another possibility is to fall back to the !HAVE_MMAP case; but it
sounds like a better idea to leave it to the programmer to use the
new_from_string/new_from_buffer functions instead, instead of doing
double allocation behind their back.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
39082082
|
2016-02-28T00:33:19
|
|
keymap: share LevelsSameSyms()
The function is generic enough.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c8a25645
|
2016-02-28T00:02:05
|
|
state: factor out get_entry_for_mods()
Will be useful later.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9f5139b5
|
2016-02-27T19:43:07
|
|
state: factor out entry_is_active() check
Makes the code slightly cleaner and I plan to use the function in
another place.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0ce17ef3
|
2016-01-20T11:40:43
|
|
keymap: add xkb_keymap_key_by_name(), xkb_keymap_key_get_name(), tests
xkb_keymap_key_by_name() allows finding a keycode from a given keyname and
is useful for generating keyboard events to use in regression tests
during CI
xkb_keymap_key_get_name() is the inverse of xkb_keymap_key_by_name()
Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
[ran: some stylistic tweaks + another test case]
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2cca0289
|
2015-11-19T00:44:27
|
|
src/utils: change map_file to not take const string argument
map_file() uses PROT_READ, so const seems fitting; however unmap_file
calls munmap/free, which do not take const, so an UNCONSTIFY is needed.
To avoid the UNCONSTIFY hack, which is likely undefined behavior or some
such, just remove the const.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c7e2e6d7
|
2015-10-26T21:57:39
|
|
keymap: fix outdated comment
See 725ae134d434bab6c999121d55dbc3582c4acb65.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
13d23259
|
2015-09-07T14:45:09
|
|
state: reduce scope of fake action
Also rename to "dummy" as I think it is a nicer name.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
7ea129fb
|
2015-07-17T20:59:52
|
|
Add XKB_CONFIG_ROOT environment
The XKB_CONFIG_ROOT environment allows overrding the build time
DFLT_XKB_CONFIG_ROOT path.
|
|
8e1fed6c
|
2015-03-24T16:40:29
|
|
compose: correctly parse modifier syntax
As described in:
http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=ddf3b09bb262d01b56fbaade421ac85b0e60a69f
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
91620179
|
2014-10-23T21:03:13
|
|
keycodes: use correct printf format
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c03834a1
|
2014-10-23T21:00:20
|
|
Reduce variable scopes
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5e3615b2
|
2014-10-18T20:04:57
|
|
ast-build: remove log message about allocation failure
We don't do so anywhere else, so until we have something comprehensive,
let's not so here.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4a660d7f
|
2014-10-18T19:47:19
|
|
xkbcomp: remove file->topName
It is useless.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
96a29ede
|
2014-10-18T19:22:56
|
|
xkbcomp/keymap: remove useless free()
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
f774f819
|
2014-10-18T13:23:53
|
|
Replace some strncmp's with memcmp
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a4cc119b
|
2014-10-18T12:36:40
|
|
compose/parser: save len in keysym_from_name cache
This reduces a lot of strcmp's, and allows to use a faster memcmp.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
30e7445d
|
2014-10-17T00:41:05
|
|
state: correctly infer inactive type entries
The current test is incorrect, since 'map[None]' is entirely valid. In
most cases this doesn't cause any problems, since the default fallback
is Level1, and it's almost always 'map[None] = Level1' anyway. But in
one case in xkeyboard-config it isn't, in types/numpad(mac):
type "KEYPAD" {
modifiers = None;
map[None] = Level2;
level_name[Level2] = "Number";
};
So before checking if no modifiers were mapped, make sure there *were*
any modifiers at all.
https://bugs.freedesktop.org/show_bug.cgi?id=85092
Reported-by: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a4c667ad
|
2014-10-17T00:13:48
|
|
symbols: don't warn about conflicting syms if they are the same
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2e5530ad
|
2014-10-16T18:51:51
|
|
parser: bring back warning about includes of files with no default
Using the same format as xkbcomp.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c6e63fd7
|
2014-10-14T11:28:17
|
|
compose/parser: fix parsing of multiple modifiers
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d1c5dd14
|
2014-10-13T18:19:16
|
|
compose/parser: parse (! mods) properly
We don't actually do anything with them. But if someone uses them we can
at least not choke.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3c0c3afa
|
2014-10-13T15:47:13
|
|
compose/parser: resolve keysyms in parser instead of scanner
It will become context-sensitive.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0b99c63c
|
2014-10-13T15:05:48
|
|
compose/parser: use parameter as intended
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
8bba4b34
|
2014-10-13T00:16:59
|
|
compose/parser: one more skip_to_eol()
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a3116f97
|
2014-10-13T18:51:12
|
|
compose/parser: fix segfault when including
The keysym cache for the new scanner was not initialized.
To avoid such errors also in the future, require passing the priv
argument in scanner_init(), instead of initializing it separately.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
65c355aa
|
2014-10-13T14:28:27
|
|
COPYING: add copyright notice from libX11:modules/im/ximcp/imLcPrs.c
We have used some portions of it, so add the notice.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
8a0acf2c
|
2014-10-07T23:42:08
|
|
scanner-utils: optimize one-line comments
Compose files have a lot of those.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
edc98b54
|
2014-09-12T18:44:30
|
|
compose: add xkbcommon-compose - implementation
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
29a1a780
|
2014-09-12T18:40:18
|
|
scanner-utils: add priv member
For when a user of the scanner wants to pass something along with it.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
e8b11232
|
2014-09-12T00:31:40
|
|
darray: add darray_shrink()
If we have a big array which can be finalized, on average we can give
back 1/4 of its size, which the allocator might be able to use.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b3f23965
|
2014-02-06T01:48:32
|
|
keysym: add function to test if a keysym is for a modifier
Needed for compose.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
94a8e01c
|
2014-02-03T14:55:37
|
|
scanner-utils: add helper for appending an entire string
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
8eb024d5
|
2013-10-27T20:17:29
|
|
scanner-utils: add helper for hex string escape
Like the already existing oct.
Signed-off-by: Ran Benita <ran234@gmail.com>
|