Commit Graph

1223 Commits (14382a62ab1430223490516cb84b181456999dc7)

Author SHA1 Message Date
Ran Benita d1eae42ac5 text: some style changes
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 4e8dcca86d text: clean up and fix the *MaskText functions
The snprintf trick that LedStateText and ControlMaskText do cannot work,
because you can't use the buffer as an argument to write to itself!
(posix at least has 'restrict' there). So those two actually never
worked for more than one value (i.e. with a +).

Fix that, and do the same cleanup to ModMaskText. Now we have 3
functions which look exactly the same, oh well.

Also increase the context text buffer size, you never know.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita 540feef3bb More spelling errors
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita a0fc9066ef test/rmlvo-to-kccgst: free memory before exit
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:04 +00:00
Ran Benita b36d5b23d2 parser: also skip 'section' ELEMENT
It's for geometry only.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 35657c660a ast-build: remove malloc_or_die
This should be fixed properly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita a7b9c73d28 keycodes: fix spelling in error message
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 958b27284f Remove list.h
We don't use it anymore and it's easy to add back if needed.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 2b352c11dd Makefile.am: don't create INSTALL and ChangeLog
It may be xorg standard but it's completely useless and clutter the
directory.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 98ccbf9aff keymap-dump: move writing 'key {}' in symbols to its own function
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 4a59c84e43 keymap-dump: remove some ugly empty lines
xkbcomp prints them too, but that's just annoying. Also xkb_keycodes
doesn't have it already.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita e95dac76f2 keymap-dump: don't indent after xkb_keymap {
xkbcomp doesn't indent there, so it's easier to diff.
Also saves some horizontal space which is sorely needed when looking at
these files (especially the xkb_symbols).

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita 9842b7a58a keymap-dump: style cleanups
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita d1f7100bcf ast: add error handling to XkbFileFromComponents
And try to not repeat ourselves.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:03 +00:00
Ran Benita a46e4cc163 Fix dead assignments
"Value stored to 'stmt' is never read"
"Value stored to 'grp_to_use' is never read"

And change 'grp' to 'group' if we're here.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita c7aef16649 keysym: print unicode keysyms uppercase and 0-padded
Use the same format as XKeysymToString.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita dd81d5e0c0 Change some log functions to take ctx instead of keymap
They don't need the keymap, only the context.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita a4904ee1b7 keycodes: some minor style
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 60bb639bbe action: s/hndlrType/handler_type
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita fab28da39f compat: make it clear which 'dflt' is meant
Also s/dflt/default.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita b5c1b1d221 symbols: make it clear which 'dflt' is meant
A bit easier at a glance. Also, vowels are cool, so just say 'default'.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita fc56b5134f ast: constify argument
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 164cec6636 symbols: fix bad 'merge' assignment
Bug introduced in 2a5b0c9dc1, was causing
some keys to be merged incorrectly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 8cee749000 Change 'indicator' to 'led' everywhere possible
The code currently uses the two names interchangeably.
Settle on 'led', because it is shorter, more recognizable, and what we
use in our API (though of course the parser still uses 'indicator').

In camel case we make it 'Led'.
We change 'xkb_indicator_map' to just 'xkb_led' and the variables of
this type are 'led'. This mimics 'xkb_key' and 'key'.
IndicatorNameInfo and LEDInfo are changed to 'LedNameInfo' and
'LedInfo', and the variables are 'ledi' (like 'keyi' etc.). This is
instead of 'ii' and 'im'.

This might make a few places a bit confusing, but less than before I
think. It's also shorter.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 10c351f516 test/interactive: change variable name for 'xkb' to 'keymap'
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:02 +00:00
Ran Benita 089c3a1811 state: fix unbound virtual modifier bug
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>
2013-03-18 22:20:01 +00:00
Ran Benita 0ad8bf573f test/interactive: also print the level
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:01 +00:00
Ran Benita bc7b2ff2fb test/keyseq: re-add de(neo) level5 test
See:
https://bugs.freedesktop.org/show_bug.cgi?id=50935
This works now after syncing with recent xkeyboard-config.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-03-18 22:20:01 +00:00
Ran Benita 4058110676 Sync test data from xkeyboard-config
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>
2013-03-18 22:20:01 +00:00
Ran Benita 3d731eba5c configure.ac: add xkbcommon.com url to AC_INIT
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.]
2012-12-13 14:02:12 +00:00
Daniel Stone bb620df7aa Parser: Initialise geometry elements for VarDecl
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>
2012-12-06 15:04:15 +11:00
Ran Benita f159846943 state: rename state->cur to state->components
'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>
2012-11-11 16:14:30 +02:00
Ran Benita 7372c9f181 state: don't keep the previous state components in xkb_state
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>
2012-11-11 16:09:05 +02:00
Ran Benita 60bd92021b keymap: wrap the layout parameter if it is out of range for the key
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>
2012-11-11 00:32:16 +02:00
Daniel Stone 324d4dbd99 Only distribute .tar.xz archives
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>
2012-11-09 14:26:49 +11:00
Ran Benita 577612258a Don't use trailing enum comma in public headers
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>
2012-11-07 18:59:41 +02:00
Ran Benita d87035adac test/keysym: '\e' is non-standard
test/keysym.c:139:43: warning: non-ISO-standard escape sequence, '\e'
Didn't warn about it before..

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-11-07 18:59:41 +02:00
Ran Benita eea0eaebfa doc: clarify that keysym_to_utf8 returns size including '\0'
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-11-06 23:01:44 +02:00
Ran Benita d9317d5f32 keysym-utf: mark keysymtab array as static
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-11-05 21:50:38 +02:00
Ran Benita 7891c9170b keysym-utf: also translate special keysyms like Tab and Return
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>
2012-11-05 21:34:59 +02:00
Ran Benita fb201645b2 Add some explanations on consumed modifiers
This should hopefully clarify this somewhat subtle point to the
uninitiated users.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-11-04 16:14:47 +02:00
Ran Benita 998c957a3c action: don't allow private actions with a known type
Some obscure bug having to do with Private actions; see the comments.
This was prompted by:
https://bugs.freedesktop.org/show_bug.cgi?id=56491

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-30 18:25:08 +02:00
Damien Lespiau 860fb171a9 build: Require xorg macros 1.16
For XORG_TESTSET_CFLAG and XORG_MEMORY_CHECK_FLAGS.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Cc: Daniel Stone <daniel@fooishbar.org>
2012-10-30 15:08:14 +02:00
Damien Lespiau 2f7385d0e0 build: Make autoreconf honour ACLOCAL_FLAGS
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>
2012-10-30 15:08:14 +02:00
Ran Benita 94155878ec test/keyseq: add test for setting depressed group
Tests the SetGroup action is working properly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-29 20:20:51 +02:00
Ran Benita 7261f404d2 state, context: allow passing NULL to *_unref()
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>
2012-10-29 01:20:04 +02:00
Ran Benita a51ee70419 state: don't use xkb_keymap_num_layouts internally
Clearer and more greppable this way.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-26 16:34:39 +02:00
Ran Benita b935d3610f doc: fix wrong comment
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-26 16:16:18 +02:00
Ran Benita ee6f3f2809 state: don't use xkb_state_serialize_* internally
The code in these cases is clearer when done directly.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-26 16:12:28 +02:00
Ran Benita 92360016fe Makefile.am: move test.h to libtest_la_SOURCES
Rather than EXTRA_DIST, where it doesn't belong.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-10-26 15:09:57 +02:00