platform/upstream/libxkbcommon.git
6 years agoMerge pull request #65 from heftig/pc-fix2
Ran Benita [Tue, 17 Jul 2018 16:06:12 +0000 (19:06 +0300)]
Merge pull request #65 from heftig/pc-fix2

meson: Fix xkbcommon-x11.pc Requires versioning

6 years agomeson: Fix xkbcommon-x11.pc Requires versioning
Jan Alexander Steffens (heftig) [Tue, 17 Jul 2018 15:21:02 +0000 (17:21 +0200)]
meson: Fix xkbcommon-x11.pc Requires versioning

Old meson expects an array with one dependency per element. Providing a
string containing multiple deps results in only the first dep getting
its whitespace properly applied. As a result, the output was:

    Requires.private: xcb >= 1.10 xcb-xkb>=1.10

And downstream projects failed to find a package named 'xcb-xkb>=1.10'.

Specifying an array of versioned deps results in correct output:

    Requires.private: xcb >= 1.10, xcb-xkb >= 1.10

Fixes #64.

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
6 years agomeson: Fix xkbcommon-x11.pc Requires
Jan Alexander Steffens (heftig) [Mon, 16 Jul 2018 23:15:30 +0000 (01:15 +0200)]
meson: Fix xkbcommon-x11.pc Requires

The meson-generated pkgconfig file was missing Requires and
Requires.private.

[ran: adjust for older Meson versions.]

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agobench: simplify the bench helpers
Ran Benita [Thu, 5 Jul 2018 15:13:14 +0000 (18:13 +0300)]
bench: simplify the bench helpers

Trim the API a bit.

Also, just always use gettimeofday(), which is portable. Hopefully the
system clock doesn't change while a benchmark is running.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agotravis: pin meson to an older version so it works with Python 3.4
Ran Benita [Sat, 23 Jun 2018 20:17:07 +0000 (23:17 +0300)]
travis: pin meson to an older version so it works with Python 3.4

The CI image only has Python 3.4. It's a bit of a hassle to change this,
so let's pin meson to the version before they bumped their requirement
instead.

I suppose it's not that bad in that it will guarantee compatibility with
older meson over time.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agokeysym-utf: reject out-of-range Unicode codepoints in xkb_keysym_to_utf{8,32}
Ran Benita [Sat, 23 Jun 2018 19:00:19 +0000 (22:00 +0300)]
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>
6 years agokeysym-utf: replace the Unicode characters for leftanglebracket and rightanglebracket
Ran Benita [Tue, 27 Feb 2018 18:24:57 +0000 (20:24 +0200)]
keysym-utf: replace the Unicode characters for leftanglebracket and rightanglebracket

Looking at leftanglebracket

- The standard[1] does not specify any Unicode value for it.

- The keysym list keysymdef.h in x11proto[2] says U+27E9 MATHEMATICAL
  RIGHT ANGLE BRACKET in a comment.

- The keysym->unicode list in xkbcommon which comes from [3] has U+2329
  LEFT-POINTING ANGLE BRACKET.

- The keysym->unicode list in Xlib[4] has U+2039 SINGLE LEFT-POINTING
  ANGLE QUOTATION MARK.

[1] https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#Legacy_KEYSYMs
[2] https://cgit.freedesktop.org/xorg/proto/x11proto/tree/keysymdef.h
[3] https://www.cl.cam.ac.uk/%7Emgk25/ucs/keysym2ucs.c
[4] https://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xlibi18n/imKStoUCS.c

The symbols we are using, {LEFT,RIGHT}-POINTING ANGLE BRACKET, are
deprecated according to Unicode[5]:

    These characters are deprecated and are strongly discouraged for
    mathematical use because of their canonical equivalence to CJK
    punctuation.

[5] https://www.unicode.org/charts/PDF/U2300.pdf

Hence, switch to the MATHEMATICAL codepoints which seem to be the best
fit.

Fixes: https://github.com/xkbcommon/libxkbcommon/issues/47
Reported-by: @bytensky
Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agobuild/autotools: remove redundant ACLOCAL_AMFLAGS
Ran Benita [Tue, 27 Feb 2018 10:32:40 +0000 (12:32 +0200)]
build/autotools: remove redundant ACLOCAL_AMFLAGS

Will be deprecated in automake 2.0.

Replaced by AC_CONFIG_MACRO_DIR (already present) which is available
since autoconf 2.63.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agobuild/meson: fix x11 test/demo compilation with non-standard xcb
Ran Benita [Sun, 25 Feb 2018 09:51:05 +0000 (11:51 +0200)]
build/meson: fix x11 test/demo compilation with non-standard xcb

The x11 tests/demos did not depend on xcb and xcb-xkb directly, only
indirectly through link_with: libxkbcommon_x11_internal. So linking
worked, but the xcb and xcb-xkb cflags were *not* included when
compiling them. So when using xcb installed in a non-standard location,
what would happen is:

- Library will link with custom xcb and compile with custom xcb headers.
- Test will link with custom xcb and compile with system xcb headers (if
  exist, otherwise fail).

Fixes: https://github.com/xkbcommon/libxkbcommon/issues/57
Reported-by: @remexre
Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agobuild/meson: fix the -Wl,--version-script configure check
Ran Benita [Wed, 14 Feb 2018 13:07:46 +0000 (15:07 +0200)]
build/meson: fix the -Wl,--version-script configure check

Hopefully this fixes compilation on darwin, which doesn't support
version scripts.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agotest/interactive-wayland: replace tabs with spaces
Ran Benita [Sat, 27 Jan 2018 18:42:44 +0000 (20:42 +0200)]
test/interactive-wayland: replace tabs with spaces

Match the style of all other files.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agodoc: improve the description of the consumed modifier modes
Ran Benita [Fri, 26 Jan 2018 11:09:39 +0000 (13:09 +0200)]
doc: improve the description of the consumed modifier modes

Hopefully it is more understandable now.

https://bugs.freedesktop.org/show_bug.cgi?id=104768

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agoConvert http:// -> https:// where possible
Ran Benita [Thu, 21 Dec 2017 12:18:07 +0000 (14:18 +0200)]
Convert http:// -> https:// where possible

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agox11: check and document the correct range of device IDs
Ran Benita [Mon, 18 Dec 2017 14:41:21 +0000 (16:41 +0200)]
x11: check and document the correct range of device IDs

The actual value is 127, not 255.

https://bugs.freedesktop.org/show_bug.cgi?id=104321

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agoBump version to 0.8.0 xkbcommon-0.8.0
Ran Benita [Fri, 15 Dec 2017 19:41:51 +0000 (21:41 +0200)]
Bump version to 0.8.0

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agoUpdate NEWS
Ran Benita [Fri, 15 Dec 2017 19:40:30 +0000 (21:40 +0200)]
Update NEWS

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agoREADME,PACKAGING: use the new meson unified command format
Ran Benita [Fri, 15 Dec 2017 14:17:45 +0000 (16:17 +0200)]
README,PACKAGING: use the new meson unified command format

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agobuild: disable -Wdocumentation-deprecated-sync
Ran Benita [Thu, 14 Dec 2017 15:12:52 +0000 (17:12 +0200)]
build: disable -Wdocumentation-deprecated-sync

We will never remove the deprecated functions and there is no real
reason to annoy users into stop using them.

If there *will* be a reason, *then* we will add the attribute.

Fixes: https://github.com/xkbcommon/libxkbcommon/issues/56
Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agotravis: ensure all tests are valgrind-clean
Ran Benita [Tue, 12 Dec 2017 12:53:25 +0000 (14:53 +0200)]
travis: ensure all tests are valgrind-clean

The tests will fail if they have any memory leaks or perform invalid
accesses.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agotest/x11: properly clean up also when skipping test
Ran Benita [Tue, 12 Dec 2017 13:57:58 +0000 (15:57 +0200)]
test/x11: properly clean up also when skipping test

To make valgrind happy.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agocompose/parser: be more careful when checking if sequence overrides or duplicates...
Ran Benita [Tue, 12 Dec 2017 13:44:52 +0000 (15:44 +0200)]
compose/parser: be more careful when checking if sequence overrides or duplicates another

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agoxkbcomp/ast-build: fix memory leak when appending multi-keysyms
Ran Benita [Tue, 12 Dec 2017 12:43:24 +0000 (14:43 +0200)]
xkbcomp/ast-build: fix memory leak when appending multi-keysyms

`syms` was not freed.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agokeymap: fix NULL dereference when dumping the default fallback type
Ran Benita [Tue, 12 Dec 2017 12:30:21 +0000 (14:30 +0200)]
keymap: fix NULL dereference when dumping the default fallback type

The default fallback type uses
    type->level_names = NULL
but the keymap-dump code was not checking this case.

Instead of adding more workarounds and possible bugs (e.g. previous
commit), let's just keep the number of level names separately. This has
the additional advantage retains extraneous level name if someone adds
them for some reason.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agoxkbcomp/types: fix types being assigned the wrong number of levels in some circumstances
Ran Benita [Tue, 12 Dec 2017 12:02:17 +0000 (14:02 +0200)]
xkbcomp/types: fix types being assigned the wrong number of levels in some circumstances

The buggy code assigned the number of levels based on the number of
level names in the definition, instead of the actual number of levels!
This would completely break type definitions which do not give names to
levels.

This was not noticed for so long because xkeyboard-config always gives
names to all levels.

This regressed in 61fed8dab9b8e27981f36ffc96666d7376546e30.

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agokeysym: add xkb_keysym_to_{lower,upper} to public API
Ran Benita [Mon, 11 Dec 2017 20:41:55 +0000 (22:41 +0200)]
keysym: add xkb_keysym_to_{lower,upper} to public API

These can be useful in some odd cases.

There is already an implementation (+ tests) for internal use, so all
that's needed is to export them.

If xkbcommon were to provide a way to convert a Unicode codepoint to a
keysym, this could have been implemented externally as follows:

    uint32_t codepoint = xkb_keysym_to_utf32(keysym);
    uint32_t upper_codepoint = my_unicode_library_to_upper(codepoint);
    xkb_keysym_t upper_keysym = theoretical_xkb_keysym_from_utf32(upper_codepoint);

However keysym -> codepoint is not injective so such a function is not
possible strictly speaking.

Signed-off-by: Ran Benita <ran234@gmail.com>
6 years agotest/data: sync with xkeyboard-config 2.22
Ran Benita [Sun, 3 Dec 2017 11:04:35 +0000 (13:04 +0200)]
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>
7 years agoMerge pull request #53 from whitslack/missing-ucs-codes
Ran Benita [Tue, 3 Oct 2017 10:28:32 +0000 (13:28 +0300)]
Merge pull request #53 from whitslack/missing-ucs-codes

keysym-utf: Add missing codes for signifblank and permille keysyms

7 years agokeysym-utf: Add missing codes for signifblank and permille keysyms
Matt Whitlock [Fri, 29 Sep 2017 01:31:28 +0000 (21:31 -0400)]
keysym-utf: Add missing codes for signifblank and permille keysyms

7 years agobuild/meson: require meson >= 0.41.0
Ran Benita [Sun, 10 Sep 2017 06:18:54 +0000 (09:18 +0300)]
build/meson: require meson >= 0.41.0

With previous versions, the compilation fails with linker errors.

Fixes https://github.com/xkbcommon/libxkbcommon/issues/52
Reported-by: @rezso
Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoexpr: paper over a maybe-uninitialized warning
Ran Benita [Fri, 8 Sep 2017 09:16:13 +0000 (12:16 +0300)]
expr: paper over a maybe-uninitialized warning

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agotest/interactive-wayland: avoid unused function warning due to configuration
Ran Benita [Wed, 16 Aug 2017 17:24:27 +0000 (20:24 +0300)]
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>
7 years agobuild: add missing configure function checks for test/interactive-wayland
Ran Benita [Wed, 16 Aug 2017 17:23:54 +0000 (20:23 +0300)]
build: add missing configure function checks for test/interactive-wayland

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoxkbcommon-compose.h: change recommended locale fallback code to treat empty string...
Ran Benita [Sun, 13 Aug 2017 14:55:45 +0000 (17:55 +0300)]
xkbcommon-compose.h: change recommended locale fallback code to treat empty string same as unset

The previous code would cause failures to find the Compose file if one
of the environment variables LC_ALL, LC_CTYPE or LANG are set to the
empty string.

The description of the fallback procedure in loclale(7) talks about
"non-null environment variable"; I interpreted this to mean the
environment variable is unset, but it actually means unset or empty (I
verified this by looking at what glibc and musl do).

A recent bug in systemd https://github.com/systemd/systemd/issues/6407
exposed this issue. It causes these these variables to be set to the
empty string in TTY sessions.

Reported by "doodoo" in https://bbs.archlinux.org/viewtopic.php?id=228658

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoBump version to 0.7.2
Ran Benita [Fri, 4 Aug 2017 13:28:36 +0000 (16:28 +0300)]
Bump version to 0.7.2

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoUpdate NEWS
Ran Benita [Fri, 4 Aug 2017 13:17:27 +0000 (16:17 +0300)]
Update NEWS

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild/autotools: fix doc installation
Ran Benita [Fri, 4 Aug 2017 12:31:06 +0000 (15:31 +0300)]
build/autotools: fix doc installation

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agotest/symbols-leak-test.bash: make it easier to read
Ran Benita [Thu, 3 Aug 2017 10:38:14 +0000 (13:38 +0300)]
test/symbols-leak-test.bash: make it easier to read

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild/autotools: fix symbol versioning configure check
Ran Benita [Wed, 2 Aug 2017 15:28:17 +0000 (18:28 +0300)]
build/autotools: fix symbol versioning configure check

Regressed in 4309735. I thought `$top_srcdir` works in configure too,
apparently not!

See: https://github.com/xkbcommon/libxkbcommon/issues/50#issuecomment-319693694

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild/autotools: make doxygen's input relative
Ran Benita [Wed, 2 Aug 2017 15:26:19 +0000 (18:26 +0300)]
build/autotools: make doxygen's input relative

Was meant to be a part of 41bea9a.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild/autotools: dist the meson build files
Ran Benita [Tue, 1 Aug 2017 20:36:33 +0000 (23:36 +0300)]
build/autotools: dist the meson build files

So that it's possible to build with meson from autotools-generated
tarballs.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild/autotools: install documentation under html/
Ran Benita [Tue, 1 Aug 2017 20:32:57 +0000 (23:32 +0300)]
build/autotools: install documentation under html/

To be consistent with the meson build; also makes more sense as doxygen
can generate more than html (though we currently are not doing that).

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: make doxygen run from the source tree
Ran Benita [Tue, 1 Aug 2017 19:19:48 +0000 (22:19 +0300)]
build: make doxygen run from the source tree

I couldn't find any other way to make this work!

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoMerge pull request #49 from bluetech/meson
Ran Benita [Mon, 31 Jul 2017 17:57:31 +0000 (20:57 +0300)]
Merge pull request #49 from bluetech/meson

build: add meson build system

7 years agobuild: add meson build system
Ran Benita [Tue, 25 Jul 2017 18:57:42 +0000 (21:57 +0300)]
build: add meson build system

Meson is easier to maintain, much faster, encourages better practices,
and is not built on a pile of shell scripts.

The autotools build system is kept intact for now, in order to ease the
migration. The intention is to remove it sooner rather than later, if
all goes well.

Run `meson build && mesonconf build` to see the configuration options
for the new system. Conversion should be straightforward. Environment
variables like CFLAGS work the same.

If meson is used, xorg-util-macros is not required.

In terms of functionality the two systems have about the same
capabilities. Here are some differences I noticed:

- Meson uses `-g` by default, autotools uses `-g -O2`.

- In autotools the default behavior is to install both static and shared
  versions of the libraries. In meson the user must choose exactly one
  (using -Ddefault_library=static/shared).

  It is possible to workaround if needed (install twice...), but
  hopefully meson will add the option in the future.

- Autotools has builtin ctags/cscope targets, meson doesn't.

  Easy to run the tools directly.

- Meson has builtin benchmarks target. Handy.

- Meson has builtin support for sanitizers/clang-analyzer/lto/pgo/
  coverage etc. Also handy.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: remove Android.mk
Ran Benita [Wed, 26 Jul 2017 09:40:09 +0000 (12:40 +0300)]
build: remove Android.mk

I don't think it will work with meson, and I also don't think anyone is
using it.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: remove -uninstalled pkg-config files
Ran Benita [Wed, 26 Jul 2017 09:27:53 +0000 (12:27 +0300)]
build: remove -uninstalled pkg-config files

Meson doesn't support them directly, and I don't think anyone is using
them.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agotravis: do the build out-of-tree
Ran Benita [Mon, 31 Jul 2017 15:22:54 +0000 (18:22 +0300)]
travis: do the build out-of-tree

To catch problems like the previous commit.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: fix out-of-tree build
Ran Benita [Mon, 31 Jul 2017 15:16:37 +0000 (18:16 +0300)]
build: fix out-of-tree build

The change in d44ba48 removed -I$(top_builddir)/src/xkbcomp, but this is
needed in order to find the generated parser.h file which is put in the
build dir.

I also added -I$(top_builddir)/src in order to match the meson behavior.

Fixes https://github.com/xkbcommon/libxkbcommon/issues/50

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: use top_srcdir consistently
Ran Benita [Mon, 31 Jul 2017 08:24:28 +0000 (11:24 +0300)]
build: use top_srcdir consistently

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: change doxygen target to be properly dependency-based
Ran Benita [Fri, 28 Jul 2017 15:19:40 +0000 (18:19 +0300)]
build: change doxygen target to be properly dependency-based

This hackery (thanks libinput) is clearer and more precise than the
previous hackery.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: move custom targets to scripts/ and remove from makefile
Ran Benita [Sat, 29 Jul 2017 11:37:23 +0000 (14:37 +0300)]
build: move custom targets to scripts/ and remove from makefile

These scripts generate source code that is committed to git and hence do
not really belong in the build system. A maintainer runs them as needed.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: rewrite the update-keysyms sed script in python
Ran Benita [Sat, 29 Jul 2017 10:54:02 +0000 (13:54 +0300)]
build: rewrite the update-keysyms sed script in python

A bit more manageable this way, and the other part of the target is
already using python.

The output is the same, except I removed the reference to Makefile.am.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: remove unneeded preprocessor include flags
Ran Benita [Sat, 29 Jul 2017 19:43:08 +0000 (22:43 +0300)]
build: remove unneeded preprocessor include flags

Better to avoid these unexpected include paths.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agobuild: explain why we don't AC_DEFINE a couple of constants
Ran Benita [Sat, 29 Jul 2017 19:41:26 +0000 (22:41 +0300)]
build: explain why we don't AC_DEFINE a couple of constants

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agox11/keymap,test/interactive-evdev: fix a couple of clang-analyzer warnings
Ran Benita [Mon, 31 Jul 2017 07:18:54 +0000 (10:18 +0300)]
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>
7 years agotest/x11comp: fix compiler warnings
Ran Benita [Sat, 29 Jul 2017 20:31:19 +0000 (23:31 +0300)]
test/x11comp: fix compiler warnings

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoMerge pull request #48 from namandixit/patch-1
Ran Benita [Sat, 27 May 2017 09:23:27 +0000 (12:23 +0300)]
Merge pull request #48 from namandixit/patch-1

Fixed a minor bug in error detection in Wayland test

7 years agoFixed a minor bug in error detection in Wayland test
Naman Dixit [Sat, 27 May 2017 09:15:26 +0000 (09:15 +0000)]
Fixed a minor bug in error detection in Wayland test

7 years agoMerge pull request #46 from jwrdegoede/master
Ran Benita [Fri, 12 May 2017 11:48:47 +0000 (14:48 +0300)]
Merge pull request #46 from jwrdegoede/master

Sync Keysyms with recent xproto additions

7 years agoSync Keysyms with recent xproto additions
Hans de Goede [Wed, 10 May 2017 12:46:03 +0000 (14:46 +0200)]
Sync Keysyms with recent xproto additions

xproto recently has been extended with 4 new keysyms:
XF86XK_Keyboard
XF86XK_WWAN
XF86XK_RFKill
XF86XK_AudioPreset

This commit is the result of running "make update-keysyms" on a system
with the updated xproto installed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7 years agodoc/compat: correct the XKB protocol version from 1.1 to 1.0
Ran Benita [Sat, 29 Apr 2017 12:26:38 +0000 (15:26 +0300)]
doc/compat: correct the XKB protocol version from 1.1 to 1.0

There is no XKB 1.1!

Thanks to Oded Arbel for catching this.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agotest/interactive-x11: handle NULL from xcb_wait_for_event
Ran Benita [Fri, 28 Apr 2017 06:33:25 +0000 (09:33 +0300)]
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>
7 years agostate: cure boolean blindness in the filter functions' result
Ran Benita [Thu, 27 Apr 2017 17:06:21 +0000 (20:06 +0300)]
state: cure boolean blindness in the filter functions' result

Makes it a little easier to understand the filters.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agostate: remove unneeded NULL check
Ran Benita [Thu, 27 Apr 2017 16:17:53 +0000 (19:17 +0300)]
state: remove unneeded NULL check

xkb_filter_new() cannot return NULL.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agostate: reorder new() functions before the set() functions in the code
Ran Benita [Thu, 27 Apr 2017 16:14:56 +0000 (19:14 +0300)]
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>
7 years agotest/x11comp: be a bit more careful with kill()
Ran Benita [Tue, 11 Apr 2017 17:19:15 +0000 (20:19 +0300)]
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>
7 years agotest/interactive-wayland: mark a local function static
Ran Benita [Tue, 11 Apr 2017 17:39:10 +0000 (20:39 +0300)]
test/interactive-wayland: mark a local function static

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agotest/interactive-wayland: handle unrecognized SHM format
Ran Benita [Tue, 11 Apr 2017 17:06:01 +0000 (20:06 +0300)]
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>
7 years agotest/interactive-wayland: fix uninitialized `ret` in error path
Ran Benita [Tue, 11 Apr 2017 17:01:19 +0000 (20:01 +0300)]
test/interactive-wayland: fix uninitialized `ret` in error path

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoMerge pull request #45 from fooishbar/xdg-shell-v6
Ran Benita [Tue, 11 Apr 2017 18:01:03 +0000 (21:01 +0300)]
Merge pull request #45 from fooishbar/xdg-shell-v6

Wayland: xdg-shell v6 support

7 years agointeractive-wayland: Port to xdg-shell v6
Daniel Stone [Tue, 11 Apr 2017 14:09:50 +0000 (15:09 +0100)]
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>
7 years agoAdd explicit fallthrough case statements
Daniel Stone [Tue, 11 Apr 2017 14:09:23 +0000 (15:09 +0100)]
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>
7 years agoBump version to 0.7.1 xkbcommon-0.7.1
Ran Benita [Wed, 18 Jan 2017 18:17:46 +0000 (20:17 +0200)]
Bump version to 0.7.1

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoUpdate NEWS
Ran Benita [Wed, 18 Jan 2017 18:16:15 +0000 (20:16 +0200)]
Update NEWS

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agocompose/doc: note that it is safe to pass the result of getenv() as locale
Ran Benita [Sun, 15 Jan 2017 16:27:22 +0000 (18:27 +0200)]
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>
7 years agocompose: remove the keysym_from_name cache
Ran Benita [Fri, 2 Dec 2016 20:46:53 +0000 (22:46 +0200)]
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>
7 years agodoc: note that XKB_KEYSYM_CASE_INSENSITIVE does C folding only
Ran Benita [Fri, 2 Dec 2016 21:55:19 +0000 (23:55 +0200)]
doc: note that XKB_KEYSYM_CASE_INSENSITIVE does C folding only

and not locale-dependent.

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agokeysym: fix locale dependence in xkb_keysym_from_name()
Ran Benita [Fri, 2 Dec 2016 20:15:19 +0000 (22:15 +0200)]
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>
7 years agoutils: rename popcount to avoid conflict in NetBSD
Ran Benita [Mon, 14 Nov 2016 15:37:35 +0000 (17:37 +0200)]
utils: rename popcount to avoid conflict in NetBSD

Resolves https://github.com/xkbcommon/libxkbcommon/issues/41
Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoBump version to 0.7.0 xkbcommon-0.7.0
Ran Benita [Fri, 11 Nov 2016 18:02:41 +0000 (20:02 +0200)]
Bump version to 0.7.0

Signed-off-by: Ran Benita <ran234@gmail.com>
7 years agoUpdate NEWS
Ran Benita [Fri, 11 Nov 2016 18:00:26 +0000 (20:00 +0200)]
Update NEWS

Signed-off-by: Ran Benita <ran234@gmail.com>
8 years agoMerge pull request #31 from bluetech/consumed-modes
Ran Benita [Mon, 31 Oct 2016 11:07:45 +0000 (13:07 +0200)]
Merge pull request #31 from bluetech/consumed-modes

Consumed modifiers modes

8 years agostate: add GTK consumed modifiers mode
Ran Benita [Sat, 27 Feb 2016 20:31:16 +0000 (22:31 +0200)]
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>
8 years agostate: allow different modes for calculating consumed modifiers
Ran Benita [Sat, 27 Feb 2016 17:06:14 +0000 (19:06 +0200)]
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>
8 years agoutils: add popcount function
Ran Benita [Sat, 27 Feb 2016 20:29:57 +0000 (22:29 +0200)]
utils: add popcount function

Signed-off-by: Ran Benita <ran234@gmail.com>
8 years agotest/state: move wrongly-placed assert
Ran Benita [Sat, 22 Oct 2016 17:13:11 +0000 (20:13 +0300)]
test/state: move wrongly-placed assert

Signed-off-by: Ran Benita <ran234@gmail.com>
8 years agobench: fix compilation on hurd
Ran Benita [Mon, 19 Sep 2016 07:09:12 +0000 (10:09 +0300)]
bench: fix compilation on hurd

Patch by Samuel Thibault.

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

Signed-off-by: Ran Benita <ran234@gmail.com>
8 years agobench/compose: tabs -> spaces
Ran Benita [Fri, 16 Sep 2016 06:36:27 +0000 (09:36 +0300)]
bench/compose: tabs -> spaces

Signed-off-by: Ran Benita <ran234@gmail.com>
8 years agoREADME: Add basic build directions
Bryce Harrington [Thu, 15 Sep 2016 21:31:55 +0000 (14:31 -0700)]
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>
8 years agoREADME: Bug *reports* are welcome
Bryce Harrington [Thu, 15 Sep 2016 21:31:54 +0000 (14:31 -0700)]
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>
8 years agobench: Check for errors opening Compose file
Bryce Harrington [Thu, 15 Sep 2016 21:12:38 +0000 (14:12 -0700)]
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>
8 years agodoc/compat: (! MODIFIER) syntax is parsed but ignored
Ran Benita [Thu, 1 Sep 2016 18:17:43 +0000 (21:17 +0300)]
doc/compat: (! MODIFIER) syntax is parsed but ignored

Signed-off-by: Ran Benita <ran234@gmail.com>
8 years agodoc/compat.md: xkbcomp ignores multiple-keysyms these days
Ran Benita [Thu, 1 Sep 2016 18:13:49 +0000 (21:13 +0300)]
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>
8 years agodoc: Also mention the wayland test client in the quick guide
Bryce Harrington [Thu, 16 Jun 2016 00:36:18 +0000 (17:36 -0700)]
doc: Also mention the wayland test client in the quick guide

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agodoc: Declare keymap for wayland example
Bryce Harrington [Thu, 16 Jun 2016 00:36:17 +0000 (17:36 -0700)]
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>
8 years agodoc: Fix ctx type in example
Bryce Harrington [Thu, 16 Jun 2016 00:36:16 +0000 (17:36 -0700)]
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>
8 years agoPACKAGING: Update for interactive-wayland
Daniel Stone [Tue, 12 Apr 2016 12:47:26 +0000 (13:47 +0100)]
PACKAGING: Update for interactive-wayland

Signed-off-by: Daniel Stone <daniels@collabora.com>
8 years agotest/interactive-wayland: fix control reaches end of non-void function
Ran Benita [Thu, 9 Jun 2016 14:23:55 +0000 (17:23 +0300)]
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>
8 years agokeymap-dump: use consistent order set/latch/lock (style)
Ran Benita [Thu, 9 Jun 2016 13:32:05 +0000 (16:32 +0300)]
keymap-dump: use consistent order set/latch/lock (style)

Signed-off-by: Ran Benita <ran234@gmail.com>
8 years agosrc/state: match_mod_masks can return bool instead of int
Ran Benita [Thu, 9 Jun 2016 12:30:21 +0000 (15:30 +0300)]
src/state: match_mod_masks can return bool instead of int

Signed-off-by: Ran Benita <ran234@gmail.com>