Commit Graph

1717 Commits (73794e1e547704d7ba9242a8f7873e17631faecb)

Author SHA1 Message Date
Ran Benita 927fd8f89a state: remove unneeded NULL check
xkb_filter_new() cannot return NULL.

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-04-27 19:17:53 +03:00
Ran Benita d44c3ab28e 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>
2017-04-27 19:16:04 +03:00
Ran Benita 5d821aed9b 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>
2017-04-11 21:01:41 +03:00
Ran Benita 9d94145808 test/interactive-wayland: mark a local function static
Signed-off-by: Ran Benita <ran234@gmail.com>
2017-04-11 21:01:41 +03:00
Ran Benita 03f4a03e71 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>
2017-04-11 21:01:41 +03:00
Ran Benita 0f43cfa225 test/interactive-wayland: fix uninitialized `ret` in error path
Signed-off-by: Ran Benita <ran234@gmail.com>
2017-04-11 21:01:41 +03:00
Ran Benita 4812adb0b9 Merge pull request #45 from fooishbar/xdg-shell-v6
Wayland: xdg-shell v6 support
2017-04-11 21:01:03 +03:00
Daniel Stone 90bd9fdb01 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>
2017-04-11 15:09:50 +01:00
Daniel Stone ce38f96e95 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>
2017-04-11 15:09:23 +01:00
Ran Benita 877fe59ac3 Bump version to 0.7.1
Signed-off-by: Ran Benita <ran234@gmail.com>
2017-01-18 20:17:46 +02:00
Ran Benita 18d53732f2 Update NEWS
Signed-off-by: Ran Benita <ran234@gmail.com>
2017-01-18 20:16:15 +02:00
Ran Benita 47d6e5a8d9 compose/doc: note that it is safe to pass the result of getenv() as locale
See the NOTES section of getenv(3). Somewhat obscure but it doesn't hurt
to reassure the readers who know about this.

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-01-15 18:32:02 +02:00
Ran Benita 1ec14d0996 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>
2016-12-03 00:22:05 +02:00
Ran Benita 7984a30bbc doc: note that XKB_KEYSYM_CASE_INSENSITIVE does C folding only
and not locale-dependent.

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-12-03 00:02:57 +02:00
Ran Benita b5586a6c42 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>
2016-12-02 23:46:56 +02:00
Ran Benita 327364d277 utils: rename popcount to avoid conflict in NetBSD
Resolves https://github.com/xkbcommon/libxkbcommon/issues/41
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-11-14 17:37:35 +02:00
Ran Benita d596f6e3ff Bump version to 0.7.0
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-11-11 20:02:41 +02:00
Ran Benita e7f73940b5 Update NEWS
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-11-11 20:01:43 +02:00
Ran Benita 0aa704bc75 Merge pull request #31 from bluetech/consumed-modes
Consumed modifiers modes
2016-10-31 13:07:45 +02:00
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