|
45496c33
|
2019-10-19T00:37:48
|
|
test: fix printf("%s", NULL) in error path
../test/common.c: In function ‘test_get_path’:
../test/common.c:171:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
171 | fprintf(stderr, "Failed to allocate path (%d chars) for %s\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172 | (int) path_len, path);
| ~~~~~~~~~~~~~~~~~~~~~
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
|
|
ab4b4b7f
|
2019-07-25T10:12:53
|
|
travis: improve configuration and add macOS
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
7407d311
|
2019-07-25T13:49:41
|
|
test/symbols-leak-test: fix sed regex on macOS
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
97f41fe4
|
2019-07-25T13:24:00
|
|
test/symbols-leak-test: make it work with macOS diff
The <() stuff fails with an error:
diff: extra operand `/dev/fd/61'
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
6728ebca
|
2019-07-25T11:59:07
|
|
test/rmlvo-to-keymap: drop basename usage
It wants some libgen.h include which is POSIX only, let's just remove
it as it's hardly important.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
32d178b5
|
2019-07-19T02:56:41
|
|
test/rmlvo-to-keymap.c: fix compilation on Darwin (#101)
program_invocation_short_name isn't portable.
|
|
909cc04d
|
2019-07-02T13:48:32
|
|
interactive-wayland: Port to stable xdg-shell (#100)
xdg_shell v6 was pretty close to the finalised stable version of
xdg-shell. We can now just use the stable version, which is supported
everywhere (Enlightenment, KWin, Mutter, Weston, wlroots).
This requires bumping the wayland-protocols dependency.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
878bc085
|
2018-08-20T16:46:19
|
|
test: allow for absolute paths to be resolved
This makes it possible to check a keymap sitting elsewhere than in the test
directory.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
16c84cdd
|
2018-08-20T15:50:35
|
|
test: drop the rmlvo ability from print-compiled-keymap
This is now handled by the rmlvo-to-keymap tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
d1cb8ad4
|
2018-08-14T11:16:30
|
|
test: add a tool to test-compile all LVO combinations from xkeyboard-config
This test contains of two parts:
- a simple program to convert RMLVO commandline arguments into a keymap (and
print that keymap if requested).
- a python script that runs through rules/evdev.xml, and tries to compile a
keymap for sort-of every layout/variant/option combination. Sort-of, because
we can have multiple options and it really only does one per layout(variant)
combination.
Same thing can be done using xkbcomp, but right now it doesn't take that as
argument, it's hard-coded.
This takes quite a while, installing python-tqdm is recommended to see fancy
progress bars instead of just miles of dumps.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
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>
|
|
afea3dd0
|
2018-01-27T20:42:44
|
|
test/interactive-wayland: replace tabs with spaces
Match the style of all other files.
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>
|
|
29998c25
|
2017-12-12T15:57:58
|
|
test/x11: properly clean up also when skipping test
To make valgrind happy.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
6456835f
|
2017-12-03T13:04:35
|
|
test/data: sync with xkeyboard-config 2.22
Some tweaks to the de(neo) keyseq tests were required. It seems to have
improved.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
14686cd1
|
2017-08-16T20:24:27
|
|
test/interactive-wayland: avoid unused function warning due to configuration
test/interactive-wayland.c:95:1: warning: ‘set_cloexec_or_close’ defined but not used [-Wunused-function]
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fbd86e44
|
2017-08-03T13:38:14
|
|
test/symbols-leak-test.bash: make it easier to read
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4309735d
|
2017-07-31T11:24:28
|
|
build: use top_srcdir consistently
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d44ba481
|
2017-07-29T22:43:08
|
|
build: remove unneeded preprocessor include flags
Better to avoid these unexpected include paths.
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>
|
|
2d964065
|
2017-07-29T23:31:19
|
|
test/x11comp: fix compiler warnings
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4f17fc60
|
2017-05-27T09:15:26
|
|
Fixed a minor bug in error detection in Wayland test
|
|
c9832d43
|
2017-04-28T09:33:25
|
|
test/interactive-x11: handle NULL from xcb_wait_for_event
Can happen in cases like:
- There was an error between the error check and the call.
- The internal poll() fails.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5d821aed
|
2017-04-11T20:19:15
|
|
test/x11comp: be a bit more careful with kill()
We did it correctly but better be safe and appease clang.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9d941458
|
2017-04-11T20:39:10
|
|
test/interactive-wayland: mark a local function static
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
03f4a03e
|
2017-04-11T20:06:01
|
|
test/interactive-wayland: handle unrecognized SHM format
The enum seems large, and we don't handle all of the values in it.
Previously if we got an unrecognized SHM format we would use an
uninitialized `stride`.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
0f43cfa2
|
2017-04-11T20:01:19
|
|
test/interactive-wayland: fix uninitialized `ret` in error path
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
90bd9fdb
|
2017-04-11T15:09:50
|
|
interactive-wayland: Port to xdg-shell v6
Mutter only implements v6 now, and Weston also implements that. Port
interactive-wayland to this so people can keep on using it.
Signed-off-by: Daniel Stone <daniels@collabora.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>
|
|
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>
|
|
914c060a
|
2016-10-22T20:13:11
|
|
test/state: move wrongly-placed assert
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
8978ec39
|
2016-06-09T17:23:55
|
|
test/interactive-wayland: fix control reaches end of non-void function
AFAICS there is nothing that can fail directly in this function, so
change it to void.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
81ee012a
|
2016-06-09T14:52:34
|
|
test/symbols-leak-test: use more portable shebang
Some BSDs don't want to give bash the honor of /bin and put it
elsewhere. So look it up in PATH instead.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
316c7e24
|
2016-05-05T15:43:59
|
|
test/interactive-wayland: don't ignore asprintf return value
Fixes warn_unused_result warning.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fc41d3d6
|
2016-05-05T15:41:13
|
|
test: use termios instead of system() for disabling terminal echo
Takes care of GCC's annoyingly persistent warn_unused_result warnings.
But it's better to avoid system() I suppose.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
48d5b44f
|
2016-04-12T13:19:25
|
|
interactive-wayland: Valgrind-proofing
More meticulously free everything we create, including hooking up the
buffer-release callback so we actually free those when required. Make
sure seats are actually in the display's seat list.
The xkbcommon object-unref functions don't actually require
NULL-checking, so we can elide those.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
7e123a10
|
2016-04-12T12:03:32
|
|
test: Add interactive-wayland
interactive-wayland is very similar to x11/xev, and dumps out as much
state as possible.
It provides no titlebar and a completely random cursor, but such is
life.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
4c24f7fa
|
2016-03-15T20:42:21
|
|
test: assert/ignore some warn_unused_result's
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
37ee8e65
|
2016-03-13T22:56:48
|
|
test/x11comp: fix memory leak
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fa1b4543
|
2016-03-13T20:56:58
|
|
test: add a test that all symbol version file is updated
It is easy to forget to update these files when adding new symbols.
Stolen with slight changes from libinput (commit by Marek Chalupa):
https://cgit.freedesktop.org/wayland/libinput/commit/?id=a9f216ab47ea2f643f20ed741b741a2b5766eba3
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>
|
|
91a19905
|
2015-08-24T13:44:20
|
|
test/x11comp: Fix contention between X11 and Xvfb on Mac OS X
- Abandon use of -displayfd.
- Have x11comp itself look for an unused X11 display number instead.
|
|
74f85d05
|
2015-08-23T23:02:10
|
|
test/x11comp: remove duplicate FOUR_LEVEL_KEYPAD from test keymap
The `test/data/keymaps/host.xkb` file contains a duplicate definition of
this type. On my computer (linux, xkbcomp 1.3.0, xserver 1.17.2), the
test passes as is, but if I remove the duplicate definition, the
roundtrip brings it back and the test fails. I can also reproduce it
without relation to the test, by loading `test/data/keymaps/host.xkb`
(without the duplicate) using
xkbcomp -I $(pwd)/test/data/keymaps/host.xkb $DISPLAY
and downloading it again using
xkbcomp $DISPLAY out.xkb
the duplicate is added. On Mac OS X however, the duplicate is removed
(correctly), so the test fails there.
xkbcommon itself, which was forked from xkbcomp, doesn't have this bug;
in fact, doing
./test/print-compiled-keymap -k keymaps/host.xkb
removes the duplicate if it is present.
This is (probably) a regression in xkbcomp or xserver compared to the
versions used in Mac OS X. Since getting a patch for any of these two is
hopeless from my experience, I did not try to investigate further.
I am not sure why, but if I also add a `PC_SUPER_LEVEL2` type, the
duplicate of `FOUR_LEVEL_KEYPAD` doesn't show up. Hopefully the test
will work on all platforms now.
https://github.com/xkbcommon/libxkbcommon/issues/26
Reported-by: @nuko8
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
bdf68803
|
2015-08-23T22:22:11
|
|
test/x11comp: small simplifications
xkbcomp doesn't need the search-path argument, since we pass an absolute
path. Keep the plain -I which clears the search path just to be sure.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
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>
|
|
74482de6
|
2015-02-03T20:50:52
|
|
test/common: print keycode in decimal not hex
Keycodes are usually written in decimal, so hex is hard to compare.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a0d2b029
|
2014-10-17T01:14:57
|
|
test/keyseq: test 'map[None] = Level2;' scenario
See previous commit for an explanation.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
312182ce
|
2014-10-16T17:55:46
|
|
test/data: add files for model=applealu_ansi layout=us
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c6ee6371
|
2014-10-16T17:48:00
|
|
test/data: sync to xkeyboard-config 2.13
(Run ./test/data/sync.sh).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
c42b8646
|
2014-10-14T11:47:25
|
|
test/compose: test include statement
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3f489730
|
2014-10-14T10:53:38
|
|
test/compose: test modifier syntax
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5cefa5c5
|
2014-01-29T13:46:42
|
|
test/interactive-evdev: add compose support
To try, do e.g.:
sudo ./test/interactive-evdev -l us -v intl -o compose:ralt -d
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
10a7a2bd
|
2013-10-27T20:37:27
|
|
test/compose: add new test
Some results from the benchmark (compilation of en_US.UTF-8/Compose):
$ grep 'model name' /proc/cpuinfo
model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz
model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz
$ uname -a
Linux ran 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14 07:40:19 CEST 2014 x86_64 GNU/Linux
$ ./test/compose bench
compiled 1000 compose tables in 7.776488331s
So according to the above benchmark and valgrind --tool=massif, an
xkb_compose_table adds an overhead of about ~8ms time and ~130KB
resident memory.
For contrast, a plain US keymap adds an overhead of ~3ms time and 90KB
resident memory.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
bc3b4c08
|
2014-10-02T22:03:28
|
|
Move benchmarks from tests to their own files in bench/
The tests only contain tests, and the benchmarks are more visible.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
68962aa1
|
2014-09-21T23:54:34
|
|
keymap-dump: combine modifier_map's with the same modifier
A bit less efficient, but makes for shorter, nicer output.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
24846080
|
2014-09-11T14:08:12
|
|
test/keyseq: add test
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a931740c
|
2014-09-10T13:29:52
|
|
keycodes: fix keymap compilation with no aliases and malloc(0)==NULL
If the keymap doesn't have any key-aliases (which is certainly
possible), the calloc(num_key_aliases, ...) is allowed to return NULL
according to the C standard, but this is not an error.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ba985629
|
2014-09-06T11:29:15
|
|
test: make most tests portable by copying linux/input.h locally
There is really no reason to deny these tests from different platforms
only for a few #defines.
The only linux-only test (or test program, it is not run by make check)
is interactive-evdev, which actually uses evdev.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
e95fb475
|
2014-09-06T11:05:44
|
|
Remove <linux/input.h> include from test/x11comp.c
libxkbcommon 0.4.3 introduces a new test, x11comp, which does not build
on non-Linux OSes because of the unconditional <linux/input.h> include.
This seems not needed even on Linux, so attached there is a simple patch
to remove it.
https://bugs.freedesktop.org/show_bug.cgi?id=83551
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
fc95057c
|
2014-09-01T17:20:40
|
|
test/x11comp: don't hang if Xvfb is not available
If Xvfb is not present, posix_spawn still forks, but the child fails.
In that case, since we left the write fd of the pipe open in the parent,
we just kept waiting on the read() without noticing that the other side
is dead.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
f3597f1b
|
2014-08-18T21:03:06
|
|
test/state: add test_update_mask() test
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
a95c4e83
|
2014-08-18T19:47:10
|
|
test/x11comp: server writes \n to displayfd
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4df720b4
|
2014-08-09T22:14:34
|
|
test/x11-keyseq: new test
It is like test/stringcomp, only instead of using
xkb_keymap_new_from_string(), it uses xkbcomp to upload the keymap to a
dummy Xvfb X server and then xkb_x11_keymap_new_from_device().
If any of these components are not present or fails, the test is shown
as skipped.
The test is messy, fragile, limited and depends on external tools, but I
will improve on that later -- it's better to have a test.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
5058620c
|
2014-07-27T16:36:11
|
|
interactive-evdev: don't use sysexits.h
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
40f109af
|
2014-07-27T14:24:20
|
|
ast-build: make sure InterpDef is freeable
With the following two rules:
InterpretDecl : INTERPRET InterpretMatch OBRACE
VarDeclList
CBRACE SEMI
{ $2->def = $4; $$ = $2; }
;
InterpretMatch : KeySym PLUS Expr
{ $$ = InterpCreate($1, $3); }
| KeySym
{ $$ = InterpCreate($1, NULL); }
;
And the fact that InterpCreate doesn't initialize ->def, if the
VarDeclList fails, the %destructor tries to recursively free the
uninitialized ->def VarDef. So always initialize it.
That was the only problematic code in the parser for %destructor (I'm
pretty sure).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
f5182bbd
|
2014-07-26T22:29:22
|
|
test: add file with a syntax error
We didn't really have any. It also a exposes a memory leak, since the
parser doesn't clean up the AST nodes of the discarded symbols.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
67d884ec
|
2014-06-01T15:24:10
|
|
Remove unnecessary !!(expressions)
_Bool already does that.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
54174409
|
2014-03-27T17:42:20
|
|
state: fix consumed modifier calculation
The current calculation is in short:
entry ? (entry->mask & ~entry->preserve) : 0
This changes it be
type->mask & ~(entry ? entry->preserve : 0)
This is what Xlib does. While less intuitive, it is actually more
correct, if you follow this deduction:
- The key group's type->mask defines which modifiers the key even cares
about. The others are completely irrelevant (and in fact they are
masked out from all sided in the level calculation). Example: NumLock
for an alphabetic key.
- The type->mask, the mods which are not masked out, are *all* relevant
(and in fact in the level calculation they must match *exactly* to the
state). These mods affect which level is chosen for the key, whether
they are active or not.
- Because the type->mask mods are all relevant, they must be considered
as consumed by the calculation *even if they are not active*.
Therefore we use type->mask instead of entry->mask.
The second change is what happens when no entry is found: return 0 or
just take preserve to be 0? Let's consider an example, the basic type
type "ALPHABETIC" {
modifiers = Shift+Lock;
map[Shift] = Level2;
map[Lock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
};
Suppose Shift+Lock is active - it doesn't match any entry, thus it gets
to level 0. The first interpretation would take them both to be
unconsumed, the second (new one) would take them both to be consumed.
This seems much better: Caps is active, and Shift disables it, they both
do something.
This change also fixes a pretty lousy bug (since 0.3.2), where Shift
appears to apparently *not* disable Caps. What actually happens is that
Caps is not consumed (see above) but active, thus the implicit
capitalization in get_one_sym() kicks in and capitalizes it anyway.
Reported-by: Davinder Pal Singh Bhamra
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
3cfa7fda
|
2014-03-21T23:00:37
|
|
state: apply control transformation on utf8/utf32 keysym strings
This is required by the specification:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Control_Modifier
and clients expect this to happen.
https://bugs.freedesktop.org/show_bug.cgi?id=75892
Reported-by: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b973d71e
|
2014-03-21T23:00:17
|
|
state: add xkb_state_key_get_{utf8,utf32}() API functions
These functions generally have the same effect as
xkb_state_key_get_syms() + xkb_keysym_to_utf{8,32}().
So why add them?
- They provide a slightly nicer interface, especially if the string is
the only interest.
- It makes the handling of multiple-keysyms-to-utf8 transparent. For the
designated use-case of multiple-keysyms (unicode combining
characters), this is a must. We also validate the UTF-8, which the
user might not otherwise do.
- We will need to apply some transformation on the resulting string
which depend on the xkb_state. This is not possible with the
xkb_keysym_* functions.
With these functions, the existing xkb_keysym_to_utf{8,32}() are not
expected to be used by a typical user; they are "raw" functions.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2bbaf7c7
|
2014-02-09T13:50:21
|
|
Add utf8.{c,h} for common UTF-8 util functions
We need to validate some UTF-8, so this adds an is_valid_utf8()
function, which is probably pretty slow but should work correctly.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
6adf17bd
|
2014-02-28T15:12:16
|
|
interactive-x11: beef up select_events a bit
- Specify in detail which parts of the events we care about. In theory
the X server should not bother us with things we didn't ask for. In
practice it still does, but oh well.
- Use the _aux version of select_events. This is the correct one to use,
the non-aux version is useless.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4fb7b06b
|
2014-02-21T18:09:00
|
|
state: Add xkb_state_key_get_consumed_mods
This retrieves the mask of consumed modifiers for a given key and state,
which is helpful for toolkits without having them to do it one modifier
at a time, or pass in 0xFFFFFFFF to xkb_state_remove_consumed_mods to
"reverse-engineer" the consumed mods.
|
|
11a9f76b
|
2014-02-15T23:27:23
|
|
keymap-dump: don't print "affect=lock" in PtrLock
It's the same as no flags, so might as well not print it.
(In fact it is slightly harmful, because it actively *clears* the affect
flags, which might have been set in some other manner. But in practice
this cannot happen).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
067c8c25
|
2014-02-10T13:13:26
|
|
test/rmlvo-to-kccgst: use default RMLVO values in translation
The tool's supposed to display exactly the same results as the library
code.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
973b8fd4
|
2014-02-08T16:40:20
|
|
api: deprecate XKB_MAP_COMPILE_PLACEHOLDER, and use KEYMAP instead of MAP
The PLACEHOLDER was not meant to be used, but c++ doesn't like passing 0
to enums, so it was used. For this reason we add all the NO_FLAGS items,
so the PLACEHOLDER shouldn't be used anymore.
Second, XKB_MAP is the prefix we used ages ago, KEYMAP is the expected
prefix here. So deprecate that as well.
The old names may still be used through the xkbcommon-compat.h header,
which is included by default (no need to include directly).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
94e0be0d
|
2014-02-08T00:42:54
|
|
test/state: fix tautological test
test/state.c:376:5: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
623b10f8
|
2014-02-08T00:27:54
|
|
Fix sign-compare warnings
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
623602cb
|
2014-02-07T01:35:56
|
|
test: don't print control characters in interactive tests
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2f93c788
|
2013-07-30T15:06:40
|
|
x11: add a couple of tests
Add two tests:
./test/interactive-x11
which is like test/interactive-evdev, but should behave exactly like your
X keyboard and react to state and keymap changes - in other words, just
like typing in xterm. Press ESC to exit.
./test/x11
which currently should only print out the same keymap as
xkbcomp $DISPLAY out.xkb
(modulo some whitespace and some constructs we do not support.)
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
d63e0ab8
|
2013-07-30T13:38:51
|
|
test: rename test/interactive to interactive-evdev
And share the key-printing functions. In preparation for adding more
interactive-* variants.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
4841ea0c
|
2014-01-11T16:56:20
|
|
test/state: fix some *_{is,are}_active() tests
These functions also return -1 on invalid input. The original tests
didn't check that, but used !tests instead. Since then we've changed
them, but some were missed, and for some we forgot to remove the ! (or
you can say they were extra clever).
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
31430670
|
2014-01-11T16:40:42
|
|
Fix some cppcheck warnings
Someone was nice enough to run this for us:
ftp://ftp.sunet.se/pub/Linux/distributions/Debian/debian/pool/main/libx/libxkbcommon/libxkbcommon_0.3.1.orig.tar.gz
[libxkbcommon-0.3.1/src/keymap.c:86]: (style) The scope of the variable 'j' can be reduced.
[libxkbcommon-0.3.1/src/keymap.c:87]: (style) The scope of the variable 'key' can be reduced.
[libxkbcommon-0.3.1/src/keysym-utf.c:843]: (style) The scope of the variable 'mid' can be reduced.
[libxkbcommon-0.3.1/src/state.c:992]: (style) The scope of the variable 'str' can be reduced.
[libxkbcommon-0.3.1/src/xkbcomp/action.c:467]: (style) The scope of the variable 'absolute' can be reduced.
[libxkbcommon-0.3.1/src/xkbcomp/rules.c:468]: (style) The scope of the variable 'consumed' can be reduced.
[libxkbcommon-0.3.1/src/xkbcomp/rules.c:862]: (style) The scope of the variable 'mlvo' can be reduced.
[libxkbcommon-0.3.1/src/xkbcomp/rules.c:863]: (style) The scope of the variable 'kccgst' can be reduced.
[libxkbcommon-0.3.1/src/xkbcomp/rules.c:865]: (style) The scope of the variable 'match_type' can be reduced.
[libxkbcommon-0.3.1/src/xkbcomp/symbols.c:753]: (style) The scope of the variable 'toAct' can be reduced.
[libxkbcommon-0.3.1/src/xkbcomp/symbols.c:1573]: (style) The scope of the variable 'key' can be reduced.
[libxkbcommon-0.3.1/test/common.c:80]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[libxkbcommon-0.3.1/test/interactive.c:358]: (style) The scope of the variable 'nevs' can be reduced.
[libxkbcommon-0.3.1/test/interactive.c:236]: (style) Checking if unsigned variable 'nsyms' is less than zero.
[libxkbcommon-0.3.1/test/interactive.c:226]: (style) Unused variable: unicode
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
b246edc6
|
2013-12-02T14:16:45
|
|
test/atom: add test for atom table
Mostly a random test.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ba7530fa
|
2013-11-27T13:43:57
|
|
scanner: restore lost DIVIDE token
I don't know how this could have happened. Luckily this token is
completely useless.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
65f9980b
|
2013-10-14T19:05:24
|
|
rules: fix scanning of line-continuation without leading space
We were failing to scan something like\
this correctly.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
f813bdbf
|
2013-10-09T12:23:46
|
|
rulescomp: increase BENCHMARK_ITERATIONS from 1000 to 2500
1000 is a bit too low for statistical significance on this 6 years old
CPU. Since the benchmark is run manually this shouldn't be a problem.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
59fb79e7
|
2013-09-25T10:05:26
|
|
test/state: fix missing xkb_state_unref
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
2a2a8d7d
|
2013-08-13T18:57:43
|
|
state: apply capitalization transformation on keysyms
The xkbproto spec says:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Interpreting_the_Lock_Modifier
If the Lock modifier is not consumed by the symbol lookup process,
routines that determine the symbol and string that correspond to
an event should capitalize the result.
This was not an issue until now, because most xkeyboard-config keymaps
do not utilize this "feature", and specify the keysyms for the Lock
modifier explicitly instead. However, some keymaps do depend on it, e.g.
ch(fr) for eacute and others.
The spec goes on to describe two options for doing this transformation:
locale-sensitive and locale-insensitive. We opt for the latter; it is
less desirable but we don't want *that* headache.
Also, only xkb_state_key_get_one_sym() is changed;
xkb_state_key_get_syms() is left as-is, and always reports the
untransformed keysyms. This is for the following reasons:
- The API doesn't allow it, since we return a const pointer directly to
the keymap keysyms table and we can't transform that.
- The transformation doesn't make sense for multiple-keysyms.
- It can be useful for an application to get the "raw" keysyms if it
wants to (e.g. maybe it wants to do the transformation itself).
Finally, note that xkb_state_mod_index_is_consumed() does *not*
report Lock as consumed even if it was used in the transformation. This
is what Xlib does.
This definitely doesn't fall under the "hard to misuse" API rule but
it's the best we can do.
https://bugs.freedesktop.org/show_bug.cgi?id=67167
Reported-By: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9e92319d
|
2013-08-13T18:55:09
|
|
test/interactive: use xkb_state_key_get_one_sym() when there's only 1
Kind of odd, but get_one_sym() will be getting a different behavior.
Real life users *should* pick one or the other.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
1499eedd
|
2013-08-13T18:52:46
|
|
keysym: add xkb_keysym_to_{lower,upper}
These functions are needed later; they are not API functions. The
capitalization is not locale sensitive.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
9cef902d
|
2013-08-14T11:35:01
|
|
test: make sure keycode 0 works fine
It is a legal keycode but we never tried it actually.
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
7caa1af2
|
2013-08-13T14:45:33
|
|
scanner: don't fail over unknown escape sequence
This is too strict, and causes symbols/cz to fail parsing. Instead, just
emit a warning (not shown by default):
xkbcommon: WARNING: cz:75:19: unknown escape sequence in string literal
https://bugs.freedesktop.org/show_bug.cgi?id=68056
Reported-By: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
e91d2653
|
2013-08-01T23:09:46
|
|
scanner: allow empty key name literals
Some keymaps actually have this, like the quartz.xkb which is tested. We
need to support these.
https://bugs.freedesktop.org/show_bug.cgi?id=67654
Reported-By: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
e731b251
|
2013-08-01T20:24:27
|
|
xkbcomp: handle empty keymaps
We should handle empty xkb_keycode and xkb_symbol sections, since
xkbcomp handles them, and apparently XQuartz uses it. There are also
files for it in xkeyboard-config (rules=base model=empty layout=empty,
which translate to keycodes/empty and symbols/empty).
https://bugs.freedesktop.org/show_bug.cgi?id=67654
Reported-By: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
7f1b7a1c
|
2013-07-25T13:21:33
|
|
test/keyseq: add de(neo) Level{6,7,8} tests
Signed-off-by: Ran Benita <ran234@gmail.com>
|
|
ec9a02a2
|
2013-07-24T10:05:02
|
|
Get rid of the usage of PATH_MAX
PATH_MAX is optional in POSIX, so avoid its unconditional usage
allocating and freeing buffers as needed.
To avoid too many malloc/free in the for loop in FindFileInXkbPath,
a buffer is grown according to the size needed at each iteration.
|