Recent xkeyboard-config introduced the following line in symbols/level3:
vmods = LevelThree,
However, the XKM format which xkbcomp produces for the X server can't
handle explicit virtual modifiers such as this:
https://bugs.freedesktop.org/show_bug.cgi?id=4927
So by doing the following, for example:
setxkbmap -layout de (or another 3-level layouts)
xkbcomp $DISPLAY out.xkb
xkbcomp out.xkb $DISPLAY
The modifier is lost and can't be used for switching to Level3 (see the
included test).
We, however, are affected worse by this bug when we load the out.xkb
keymap. First, the FOUR_LEVEL_ALPHABETIC key type has these entries:
map[None] = Level1;
map[Shift] = Level2;
map[Lock] = Level2;
map[LevelThree] = Level3;
[...]
Now, because the LevelThree virtual modifier is not bound to anything,
the effective mask of the "map[LevelThree]" entry is just 0. So when
the modifier state is empty (initial state), this entry is chosen, and
we get Level3, instead of failing to match any entry and getting the
default Level1.
The difference in behavior from the xserver stems from this commit:
acdad6058d
Which removed the entry->active field. Without bugs, this would be
correct; however, it seems in this case we should just follow the
server's behavior.
The server sets the entry->active field like so in XKBMisc.c:
/* entry is active if vmods are bound */
entry->active = (mask != 0);
The xkblib spec explains this field, but does not specify how to
initialize it. This commit does the same as above but more directly.
Signed-off-by: Ran Benita <ran234@gmail.com>
Sync the files again from xkeyboard-config 2.8, since there have been
some changes we should test against.
Also added a script test/data/sync.sh if we want to do it again in the
future.
Signed-off-by: Ran Benita <ran234@gmail.com>
Why not.
Also forgot to update the xorg-utils error message when bumping the
requirement.
Signed-off-by: Ran Benita <ran234@gmail.com>
[daniels: Changed to xkbcommon.org.]
We were using uninitialised memory whilst parsing geometry, leaving
random contents as the return for shape/overlay/etc sections. Somehow
this actually worked everywhere but under Java.
https://bugs.freedesktop.org/show_bug.cgi?id=57913
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
'cur' doesn't make sense anymore. 'components' is a bit long for this,
but not too bad, and nothing better comes to mind.
Signed-off-by: Ran Benita <ran234@gmail.com>
There is really no need to keep this in the struct, we can just allocate
it on the stack when we need to.
Don't know why I did it this way.
Signed-off-by: Ran Benita <ran234@gmail.com>
The functions num_levels_for_key() and get_syms_by_level() have a
'layout' parameter. Currently it is expected that this value is always
legal for the key, as determined by num_layouts_for_key(). However,
there are legitimate use cases for passing an out-of-range layout there,
most probably passing the effective layout, and expecting to get the
keysyms/levels for just this layout. So we wrap it just as we do in the
xkb_state_* functions.
This is also useful for stuff like this:
http://developer.gnome.org/gdk/stable/gdk-Keyboard-Handling.html#gdk-keymap-lookup-key
If this behavior is not desired, the user has the option to check
against num_layouts_for_key herself.
https://bugs.freedesktop.org/show_bug.cgi?id=56866
Reported-by: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
We definitely don't need .gz anymore, and .bz2 seems on its way out.
Mirror what Wayland does, and move to .xz exclusively.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Pretty annoying, but C89 doesn't support that (officially), and it might
cause warning with -pedantic, etc. (though you need -Wsystem-headers to
see them usually). Removing them is not a big deal.
Signed-off-by: Ran Benita <ran234@gmail.com>
The keysym2ucs.c file apparently leaves out some keysyms, which libX11
deals with separately (like in _XkbHandleSpecialSym()).
The problematic keysyms are the keypad ones (for which we already added
some support) and keysyms which use 0xff** instead of 0x00** < 0x20.
This code should fix them properly, as much as I could gather from
libX11 and http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c and other
sources (which are not aware of locale).
https://bugs.freedesktop.org/show_bug.cgi?id=56780
Reported-by: Gatis Paeglis <gatis.paeglis@digia.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
When running autoreconf, it's possible to give flags to the underlying
aclocal by declaring a ACLOCAL_AMFLAGS variable in the top level
Makefile.am.
Putting ${ACLOCAL_FLAGS} there allows the user to set an environment
variable up before running autogen.sh and pull in the right directories
to look for m4 macros, say an up-to-date version of the xorg-util macros.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Cc: Daniel Stone <daniel@fooishbar.org>
For error handling code, it's nice to be able to pass NULL to these
function without worrying about segfaults ensuing. free() sets the
precedent here.
Also document this fact.
Signed-off-by: Ran Benita <ran234@gmail.com>
The configure test shouldn't touch CFLAGS, because they come last on the
command line and allow to users to override settings if needed.
Signed-off-by: Ran Benita <ran234@gmail.com>
We still use pkg-config to get the xkb_base variable from
xkeyboard-config, but we removed all of the other PKG_ macro calls. This
still works now, because XORG_DEFAULT_OPTIONS runs it somehow. But we
shouldn't rely on it.
Signed-off-by: Ran Benita <ran234@gmail.com>
This runs a bunch of random keys against xkb_state_update_key() and
xkb_state_key_get_one_sym(), in a fairly unintelligent way.
It might be nice to check when modifying this code path, or changing it,
to see things haven't slowed down considerably. However, given the
numbers this benchmark gives, it is pretty clear that we are not going
to be the bottleneck for anything. So this can more-or-less be ignored.
Incidentally, this also turned out to be a poor man's fuzzer, because it
turned up the fix in the previous commit. Maybe we should consider
beefing it up with an actual 'break stuff' intention and running it as
part of 'make check'.
Signed-off-by: Ran Benita <ran234@gmail.com>
The current code assumes that action->type always falls in the range of
the xkb_action_type enum. But keymaps can also have Private actions,
which are allowed to set their own type number.
So with a default xkeyboard-config keymap, keycode 86 at level 4, which
triggers such an action, causes us to crash.
Fix it by always checking the bounds.
Signed-off-by: Ran Benita <ran234@gmail.com>
These are 'special intrest' function, like the logging functions, so
it's nice to have them in their own logical group.
Signed-off-by: Ran Benita <ran234@gmail.com>
This is the more appropriate for a specific key (also considering the
num_layouts() is a bit of a made-up value).
Signed-off-by: Ran Benita <ran234@gmail.com>
--force copies and installs all the autotools support files, rather than
making symlinks, which can sometimes break things when upgrading your
system autotools. This is what xserver does.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
We add a return value to the xkb_state_update_key and
xkb_state_update_mask, which reports to the caller which of the state
components have changed as a result.
This restores the XKB functionality of the XkbStateNotify and
XkbIndicatorsStateNotify events. See:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Events
It is quite useful in some situations. For example, it allows an
application to avoid doing some work if nothing of relevance in the
state has changed. Say, a keyboard layout applet. Also useful for
debugging.
The deltas themselves are not provided, because I can't see a use case.
If needed, it should be possible to add some API for that.
In xkbcommon, keymaps are immutable, so all of the other *Notify events
from XKB are irrelevant.
Signed-off-by: Ran Benita <ran234@gmail.com>
This holds all of the state component fields in the state in one struct.
We will later want to keep the previous state components after updates,
so this will allow us to do it without duplicating the fields.
Signed-off-by: Ran Benita <ran234@gmail.com>
Note first:
This commits breaks the ABI somewhat. If an application is run against
this commit without recompiling against the updated header, these break:
- xkb_state_layout_*_is_active always retuns false.
- xkb_state_serialize_mods always returns 0.
So it might break layout switching in some applications. However,
xkbcommon-compat.h provides the necessary fixes, so recompiling should
work (though updating the application is even better).
Split the enum to its individual components, which enables us to refer
to them individually. We will use that later for reporting which
components of the state have changed after update.
Signed-off-by: Ran Benita <ran234@gmail.com>
And make them use context_get_buffer() instead of using a static char
array.
This was the last non-thread-safe piece we had, as far as I can tell.
Signed-off-by: Ran Benita <ran234@gmail.com>
First we split the LEVEL_ONE_ONLY bit off of the 'match' field, which
allows us to turn enum xkb_match_operation to a simple enum and remove
the need for MATCH_OP_MASK.
Next we rename 'act' to 'action', because we've settled on that
everywhere else.
Finally, SIMatchText is changed to not handle illegal values - it
shouldn't get any. This removes one usage of the GetBuffer hack.
Signed-off-by: Ran Benita <ran234@gmail.com>