Commit Graph

1748 Commits (789bd05c3587972b4f3c8f06a9714271606ee0bc)

Author SHA1 Message Date
Ran Benita babc9e0c30 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>
2016-10-31 12:52:28 +02:00
Ran Benita a0a41332cc 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>
2016-10-31 12:52:26 +02:00
Ran Benita 9061171957 utils: add popcount function
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-10-22 20:13:46 +03:00
Ran Benita 914c060a1d test/state: move wrongly-placed assert
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-10-22 20:13:11 +03:00
Ran Benita fe81dcbd2f bench: fix compilation on hurd
Patch by Samuel Thibault.

https://github.com/xkbcommon/libxkbcommon/issues/39

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-19 10:09:12 +03:00
Ran Benita 853b7502f4 bench/compose: tabs -> spaces
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-16 09:36:27 +03:00
Bryce Harrington af2c83b664 README: Add basic build directions
In particular, highlight the use of configure flags to control locating
X11 keyboard stuff when building for Wayland.

Of particular note, if the locale root is not specified, then xkbcommon
will look for them under $prefix (i.e. /usr/local/share/X11/locale).
But unless the user has specifically installed them there, it is better
to look in the standard system location, /usr/share/X11/locale.

Otherwise, xkbcommon will error when it can't find them, e.g.:

  xkbcommon: ERROR: ~/.XCompose:4:9: failed to expand %L to the locale Compose file
  xkbcommon: ERROR: ~/.XCompose:4:12: unterminated string literal

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-16 09:24:09 +03:00
Bryce Harrington e92e0b88c6 README: Bug *reports* are welcome
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-16 09:24:04 +03:00
Bryce Harrington ea9a5bcfd7 bench: Check for errors opening Compose file
Otherwise it can segfault e.g. running ./compose inside the bench
directory.

Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-16 09:23:43 +03:00
Ran Benita 599fd9ba39 doc/compat: (! MODIFIER) syntax is parsed but ignored
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-01 21:23:23 +03:00
Ran Benita c29afcc346 doc/compat.md: xkbcomp ignores multiple-keysyms these days
https://cgit.freedesktop.org/xorg/app/xkbcomp/commit/?id=e119cbec7e750ffc4d4bd08b577db2c697035a30

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-01 21:23:12 +03:00
Bryce Harrington d58fc90a29 doc: Also mention the wayland test client in the quick guide
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-21 11:35:21 +10:00
Bryce Harrington 094c8dc59b doc: Declare keymap for wayland example
keymap was defined in the X11 example, but also define it in the wayland
example just to make it a bit more standalone

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-21 11:35:21 +10:00
Bryce Harrington 832e32dc6c doc: Fix ctx type in example
xkb_context_new() returns a xkb_context pointer, so change the variable
definition to be consistent.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-21 11:35:21 +10:00
Daniel Stone 07be44abdb PACKAGING: Update for interactive-wayland
Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-06-21 11:35:21 +10:00
Ran Benita 8978ec39ed 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>
2016-06-09 17:23:55 +03:00
Ran Benita 0dd610fbcb keymap-dump: use consistent order set/latch/lock (style)
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-06-09 16:32:32 +03:00
Ran Benita c8e6996ff9 src/state: match_mod_masks can return bool instead of int
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-06-09 15:30:21 +03:00
Ran Benita 81ee012af0 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>
2016-06-09 15:00:43 +03:00
Ran Benita 316c7e2479 test/interactive-wayland: don't ignore asprintf return value
Fixes warn_unused_result warning.

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-05-05 15:43:59 +03:00
Ran Benita fc41d3d605 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>
2016-05-05 15:41:13 +03:00
Ran Benita 0da70c8d3c gitignore: ignore generated wayland protocol stubs
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-04-19 12:40:41 +03:00
Daniel Stone 48d5b44fd0 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>
2016-04-12 13:19:25 +01:00
Daniel Stone 7e123a10b6 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>
2016-04-12 12:15:04 +01:00
Daniel Stone 03f5d36b44 Bump version to 0.6.1
Our most minor release yet.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-04-08 10:38:57 +01:00
Daniel Stone bea54b1f7d Add LICENSE to distributed files
Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-03-31 16:43:58 +01:00
Ran Benita b91584a8f3 doc: update reference to compat symbol to its new name
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-26 01:56:03 +03:00
Ran Benita 3fee46a218 Bump version to 0.6.0
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-16 10:20:49 +02:00
Ran Benita 4c24f7faa8 test: assert/ignore some warn_unused_result's
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-15 20:45:05 +02:00
Ran Benita 02628607e0 Merge pull request #33 from bluetech/travis-enable-x11
travis: remove --disable-x11
2016-03-15 20:38:16 +02:00
Ran Benita ba3e6ce7f2 travis: remove --disable-x11
Looks like the CI machines can use Ubuntu 14.04, which has libxcb 1.10,
which is new enough. Lets see if it works.

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-15 20:16:29 +02:00
Ran Benita 02e8b26ca0 Merge pull request #32 from fooishbar/master
doc: Fix Doxygen include for srcdir != builddir
2016-03-15 19:53:45 +02:00
Daniel Stone b04344ff63 travis: Enable documentation build
Make sure Doxygen is installed before we build.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-03-15 11:34:01 +00:00
Daniel Stone a2974d5f8a doc: Fix Doxygen include for srcdir != builddir
Instead of giving Doxygen a series of absolute paths to the source
files and a relative path to the output directory, run it from the
source directory with purely relative paths to the source files, and
give it an absolute path to the build directory.

This fixes the parsing of README.md with a separate build directory,
since the relative includes for doc/quick-guide.md and doc/compat.md
don't resolve otherwise. Doxygen's INCLUDE_PATH turns out not to fix
this either, since that's just a set of paths to open and parse, rather
than an analogue to cpp's -I.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-03-15 11:21:29 +00:00
Ran Benita d627549c61 Update NEWS
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-13 23:38:40 +02:00
Ran Benita 919b97a837 NEWS: add some spacing
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-13 23:33:18 +02:00
Ran Benita 914e84e018 build: don't run test/x11comp in make check for now
For some reason, the dumped keymap started repeating the two key types
FOUR_LEVEL_PLUS_LOCK and FOUR_LEVEL_KEYPAD. I need to investigate, but
let's disable it for now until I do (the problem would likely not be in
the xkbcommon - at most in the test itself).

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-13 23:17:23 +02:00
Ran Benita 37ee8e652b test/x11comp: fix memory leak
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-13 23:17:23 +02:00
Ran Benita fa1b454328 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>
2016-03-13 23:17:23 +02:00
Ran Benita 1c6d21b45f Add symbol versions forgotten in 0ce17ef3ea
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-13 23:17:21 +02:00
Ran Benita 712b39ac7d build: make it easier to add non-built (e.g. script) tests
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-13 21:33:03 +02:00
Ran Benita 763e2b7e53 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>
2016-03-13 20:24:44 +02:00
Ran Benita 39082082f6 keymap: share LevelsSameSyms()
The function is generic enough.

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-02-28 00:33:19 +02:00
Ran Benita c8a2564588 state: factor out get_entry_for_mods()
Will be useful later.

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-02-28 00:09:30 +02:00
Ran Benita 9f5139b5ea 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>
2016-02-28 00:09:19 +02:00
Ran Benita c991a7df56 build: fix distcheck
File was renamed in 4266402.

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-01-20 23:30:51 +02:00
Ran Benita e8f04f222a doc: add environment variables index
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-01-20 23:17:42 +02:00
Ran Benita 4aa50c9d88 doc: some notes about key names and aliases
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-01-20 23:17:42 +02:00
Mike Blumenkrantz 0ce17ef3ea 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>
2016-01-20 23:17:10 +02:00
Ran Benita 7f3bb16729 doc/keymap-format-text-v1: add title and intro
Signed-off-by: Ran Benita <ran234@gmail.com>
2015-11-23 00:07:15 +02:00