[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libxkbcommon: Changes to 'debian-unstable'



 .autom4te.cfg                        |    3 
 .gitignore                           |    1 
 Makefile.am                          |   76 
 NEWS                                 |   86 
 README                               |   47 
 configure.ac                         |   45 
 debian/changelog                     |    9 
 debian/control                       |   49 
 debian/libxkbcommon-x11-0.install    |    3 
 debian/libxkbcommon-x11-0.symbols    |    6 
 debian/libxkbcommon-x11-dev.install  |    5 
 doc/Doxyfile.in                      |  142 
 makekeys.py                          |   44 
 src/atom.c                           |  137 
 src/atom.h                           |    7 
 src/context-priv.c                   |  171 
 src/context.c                        |  179 
 src/context.h                        |   62 
 src/keymap-priv.c                    |  121 
 src/keymap.c                         |   83 
 src/keymap.h                         |   25 
 src/keysym-utf.c                     |   13 
 src/keysym.c                         |   56 
 src/keysym.h                         |    6 
 src/ks_tables.h                      |11765 +++++++++++++++++++++--------------
 src/state.c                          |   20 
 src/text.c                           |    8 
 src/utils.h                          |   75 
 src/x11/keymap.c                     | 1146 +++
 src/x11/state.c                      |   71 
 src/x11/util.c                       |  215 
 src/x11/x11-priv.h                   |   44 
 src/xkbcomp/action.c                 |   91 
 src/xkbcomp/ast-build.c              |  318 
 src/xkbcomp/ast-build.h              |   58 
 src/xkbcomp/ast.h                    |  124 
 src/xkbcomp/compat.c                 |   61 
 src/xkbcomp/expr.c                   |  170 
 src/xkbcomp/include.c                |    2 
 src/xkbcomp/keycodes.c               |   29 
 src/xkbcomp/keymap-dump.c            |   19 
 src/xkbcomp/keymap.c                 |   30 
 src/xkbcomp/keywords.c               |    2 
 src/xkbcomp/keywords.gperf           |    2 
 src/xkbcomp/parser-priv.h            |    7 
 src/xkbcomp/parser.y                 |  191 
 src/xkbcomp/rules.c                  |  123 
 src/xkbcomp/scanner-utils.h          |   11 
 src/xkbcomp/scanner.c                |   68 
 src/xkbcomp/symbols.c                |  122 
 src/xkbcomp/types.c                  |   13 
 src/xkbcomp/xkbcomp-priv.h           |    3 
 test/.gitignore                      |    5 
 test/atom.c                          |  181 
 test/common.c                        |  113 
 test/context.c                       |    9 
 test/data/keycodes/empty             |    4 
 test/data/keycodes/evdev-xkbcommon   |    1 
 test/data/keymaps/divide-by-zero.xkb |    6 
 test/data/keymaps/quartz.xkb         | 1139 +++
 test/data/rules/base                 |   13 
 test/data/rules/evdev                |   15 
 test/data/rules/groups               |    5 
 test/data/symbols/altwin             |    8 
 test/data/symbols/ch                 |  225 
 test/data/symbols/compose            |   35 
 test/data/symbols/cz                 |  184 
 test/data/symbols/de                 |   78 
 test/data/symbols/empty              |    4 
 test/data/symbols/inet               |    2 
 test/data/symbols/level3             |    4 
 test/data/symbols/level5             |    4 
 test/data/symbols/ru                 |   21 
 test/data/symbols/us                 |   61 
 test/data/sync.sh                    |    4 
 test/filecomp.c                      |    1 
 test/interactive-evdev.c             |  114 
 test/interactive-x11.c               |  367 +
 test/keyseq.c                        |   55 
 test/keysym.c                        |   13 
 test/rulescomp.c                     |   10 
 test/state.c                         |  114 
 test/stringcomp.c                    |    7 
 test/test.h                          |    9 
 test/x11.c                           |   78 
 xkbcommon-x11-uninstalled.pc.in      |   10 
 xkbcommon-x11.pc.in                  |   12 
 xkbcommon/xkbcommon-keysyms.h        |    8 
 xkbcommon/xkbcommon-names.h          |    1 
 xkbcommon/xkbcommon-x11.h            |  166 
 xkbcommon/xkbcommon.h                |  147 
 91 files changed, 13293 insertions(+), 6104 deletions(-)

New commits:
commit 0cfabaf1c0627ec246576039eccb7ee80315757b
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 18:34:51 2014 +0100

    note new binary packages in d/changelog

diff --git a/debian/changelog b/debian/changelog
index 88072a9..51527c4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,11 @@
 libxkbcommon (0.4.0-1) unstable; urgency=low
 
-  * New upstream release.
+  * New upstream release. This introduces the new binary packages
+    libxkbcommon-x11-{0,dev} (Closes: #737391)
   * Canonicalize Vcs-*
   * Bump standards-version to 3.9.5 (no changes necessary)
 
- -- Michael Stapelberg <stapelberg@debian.org>  Sun, 09 Feb 2014 17:52:40 +0100
+ -- Michael Stapelberg <stapelberg@debian.org>  Sun, 09 Feb 2014 18:34:46 +0100
 
 libxkbcommon (0.3.1-2) unstable; urgency=low
 

commit 3435c0c324e60e670fd73bd372ecbee97ed4ee6d
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 18:33:53 2014 +0100

    bump standards-version to 3.9.5 (no changes necessary)

diff --git a/debian/changelog b/debian/changelog
index 2b7f500..88072a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ libxkbcommon (0.4.0-1) unstable; urgency=low
 
   * New upstream release.
   * Canonicalize Vcs-*
+  * Bump standards-version to 3.9.5 (no changes necessary)
 
  -- Michael Stapelberg <stapelberg@debian.org>  Sun, 09 Feb 2014 17:52:40 +0100
 
diff --git a/debian/control b/debian/control
index 51e6d43..3a3b613 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Build-Depends:
  x11proto-core-dev,
  x11proto-kb-dev (>= 1.0.5),
  xkb-data,
-Standards-Version: 3.9.4
+Standards-Version: 3.9.5
 Homepage: http://www.xkbcommon.org/
 Vcs-Git: git://anonscm.debian.org/pkg-xorg/lib/libxkbcommon
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-xorg/lib/libxkbcommon.git

commit 27e5c58989f7cafa531c47e7dca0681b5e602a0b
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 18:28:26 2014 +0100

    add libxkbcommon-x11-0.symbols

diff --git a/debian/libxkbcommon-x11-0.symbols b/debian/libxkbcommon-x11-0.symbols
new file mode 100644
index 0000000..1ff2fff
--- /dev/null
+++ b/debian/libxkbcommon-x11-0.symbols
@@ -0,0 +1,6 @@
+libxkbcommon-x11.so.0 libxkbcommon-x11-0 #MINVER#
+* Build-Depends-Package: libxkbcommon-x11-dev
+ xkb_x11_get_core_keyboard_device_id@Base 0.4.0
+ xkb_x11_keymap_new_from_device@Base 0.4.0
+ xkb_x11_setup_xkb_extension@Base 0.4.0
+ xkb_x11_state_new_from_device@Base 0.4.0

commit 96a3d76da0a58a14eb67185105db4b520467327f
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 18:24:54 2014 +0100

    canonicalize Vcs-*

diff --git a/debian/changelog b/debian/changelog
index fb73b23..2b7f500 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 libxkbcommon (0.4.0-1) unstable; urgency=low
 
   * New upstream release.
+  * Canonicalize Vcs-*
 
  -- Michael Stapelberg <stapelberg@debian.org>  Sun, 09 Feb 2014 17:52:40 +0100
 
diff --git a/debian/control b/debian/control
index b526576..51e6d43 100644
--- a/debian/control
+++ b/debian/control
@@ -17,8 +17,8 @@ Build-Depends:
  xkb-data,
 Standards-Version: 3.9.4
 Homepage: http://www.xkbcommon.org/
-Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxkbcommon
-Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxkbcommon.git
+Vcs-Git: git://anonscm.debian.org/pkg-xorg/lib/libxkbcommon
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-xorg/lib/libxkbcommon.git
 
 Package: libxkbcommon0
 Section: libs

commit 2556e31f58cf0d5785a967e98f19ab46345e141a
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 18:13:22 2014 +0100

    add libxkbcommon-x11-{0,dev} to d/control, add .install files

diff --git a/debian/control b/debian/control
index 3ba5a56..b526576 100644
--- a/debian/control
+++ b/debian/control
@@ -63,3 +63,43 @@ Description: library interface to the XKB compiler - development files
  .
  This module can be found at
  git://anongit.freedesktop.org/git/xorg/lib/libxkbcommon
+
+Package: libxkbcommon-x11-0
+Section: libs
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends}
+Description: library to create keymaps with the XKB X11 protocol
+ This package provides an add-on library called xkbcommon-x11, to support
+ creating keymaps with the XKB X11 protocol, by querying the X server directly.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libxkbcommon
+
+Package: libxkbcommon-x11-dev
+Section: libdevel
+Architecture: any
+Priority: extra
+Pre-Depends: ${misc:Pre-Depends}
+Depends:
+ libxkbcommon-x11-0 (= ${binary:Version}),
+ ${shlibs:Depends},
+ ${misc:Depends}
+Description: library to create keymaps with the XKB X11 protocol - development files
+ This package provides an add-on library called xkbcommon-x11, to support
+ creating keymaps with the XKB X11 protocol, by querying the X server directly.
+ .
+ This package contains the development headers for the library found in
+ libxkbcommon-x11-0. Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libxkbcommon
diff --git a/debian/libxkbcommon-x11-0.install b/debian/libxkbcommon-x11-0.install
new file mode 100644
index 0000000..3b4f7aa
--- /dev/null
+++ b/debian/libxkbcommon-x11-0.install
@@ -0,0 +1,3 @@
+# Use no wildcards to ensure we spot any update:
+usr/lib/*/libxkbcommon-x11.so.0
+usr/lib/*/libxkbcommon-x11.so.0.0.0
diff --git a/debian/libxkbcommon-x11-dev.install b/debian/libxkbcommon-x11-dev.install
new file mode 100644
index 0000000..7fcba56
--- /dev/null
+++ b/debian/libxkbcommon-x11-dev.install
@@ -0,0 +1,5 @@
+# Use no wildcards to ensure we spot any update:
+usr/include/xkbcommon/xkbcommon-x11.h
+usr/lib/*/libxkbcommon-x11.a
+usr/lib/*/libxkbcommon-x11.so
+usr/lib/*/pkgconfig/xkbcommon-x11.pc

commit 91f35d31a68db6331f2e9bfd49f36127f35fcccc
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 18:06:08 2014 +0100

    add myself to uploaders to make this not an NMU

diff --git a/debian/control b/debian/control
index 84f54e5..3ba5a56 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: libxkbcommon
 Section: x11
 Priority: optional
 Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
-Uploaders: Cyril Brulebois <kibi@debian.org>
+Uploaders: Cyril Brulebois <kibi@debian.org>, Michael Stapelberg <stapelberg@debian.org>
 Build-Depends:
  debhelper (>= 9),
  dh-autoreconf,

commit 4c6f6332846795e72433b2f9f336ea222f4be502
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 18:01:15 2014 +0100

    build-depend on libxcb-xkb-dev (>= 1.10) for building libxkbcommon-x11

diff --git a/debian/control b/debian/control
index ef6c2ff..84f54e5 100644
--- a/debian/control
+++ b/debian/control
@@ -11,6 +11,7 @@ Build-Depends:
  bison,
  flex,
  libx11-dev,
+ libxcb-xkb-dev (>= 1.10),
  x11proto-core-dev,
  x11proto-kb-dev (>= 1.0.5),
  xkb-data,

commit 12d6740dbbf86c6e983eaa17c4ce5db8facb2efc
Author: Michael Stapelberg <stapelberg@debian.org>
Date:   Sun Feb 9 17:53:25 2014 +0100

    update changelog for 0.4.0-1

diff --git a/debian/changelog b/debian/changelog
index 19f4fa2..fb73b23 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libxkbcommon (0.4.0-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Michael Stapelberg <stapelberg@debian.org>  Sun, 09 Feb 2014 17:52:40 +0100
+
 libxkbcommon (0.3.1-2) unstable; urgency=low
 
   * Cherry-pick ec9a02 from upstream, fixes FTBFS on hurd. Closes: #717723.

commit be16858c927b0d3023dd20fc35fa0919711a72c7
Author: Ran Benita <ran234@gmail.com>
Date:   Sun Feb 2 12:13:26 2014 +0200

    Bump version to 0.4.0
    
    Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/configure.ac b/configure.ac
index 2466021..ff03b76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
 
 # Initialize Autoconf
 AC_PREREQ([2.62])
-AC_INIT([libxkbcommon], [0.3.2],
+AC_INIT([libxkbcommon], [0.4.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon],
         [libxkbcommon], [http://xkbcommon.org])
 AC_CONFIG_SRCDIR([Makefile.am])

commit a15b4a55350173292b39748ed859299ba2761f1f
Author: Ran Benita <ran234@gmail.com>
Date:   Sun Feb 2 12:08:43 2014 +0200

    Update README
    
    - Remove outdated information about API/ABI stability. If we ever break
      API or ABI, we'll do a major release. But currently everything is
      stable.
    
    - Remove outdated warnings about internal symbols. You simply cannot
      access them...
    
    - Briefly mention xkbcommon-x11 existence.
    
    - Update git and bug URLs.
    
    - Add myself as maintainer :)
    
    Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/README b/README
index fa8e94c..6b99c46 100644
--- a/README
+++ b/README
@@ -25,27 +25,17 @@ API
 
 While xkbcommon's API is somewhat derived from the classic XKB API as found
 in <X11/extensions/XKB.h> and friends, it has been substantially reworked to
-expose fewer internal details to clients.  The only supported API is available
-in <xkbcommon/xkbcommon.h>.  Any definition not in this header (including
-accessing internal structures through the old macros previously available)
-should be regarded as an implementation detail and is liable to change at any
-time.
+expose fewer internal details to clients.  The supported API is available
+in the <xkbcommon/xkbcommon-*.h> files. Additional support is provided for
+X11 (XCB) clients, in the xkbcommon-x11 library, <xkbcommon/xkbcommon-x11.h>.
 
-During its early development, xkbcommon does not promise API or ABI stability.
-Regardless, we will attempt to not break ABI during a minor release series,
-so applications written against 0.1.0 should be completely compatible with
-0.1.3, but not necessarily with 0.2.0.  However, new symbols may be introduced
-in any release.  Thus, anyone packaging xkbcommon should make sure any package
-depending on it depends on a release greater than or equal to the version it
-was built against (or earlier, if it doesn't use any newly-introduced
-symbols), but less than the next major release.
-
-xkbcommon 1.x will offer full API and ABI stability for its lifetime, with a
-soname of libxkbcommon.so.1.  Any ABI breaks will wait until xkbcommon 2.0,
-which will be libxkbcommon.so.2.
-
-The xkbcomp command-line tool has also been removed, although this will
-likely reappear in a later release.
+The xkbcommon API and ABI are stable. We will attempt to not break ABI during
+a minor release series, so applications written against 0.1.0 should be
+completely compatible with 0.5.3, but not necessarily with 1.0.0.  However, new
+symbols may be introduced in any release.  Thus, anyone packaging xkbcommon
+should make sure any package depending on it depends on a release greater than
+or equal to the version it was built against (or earlier, if it doesn't use
+any newly-introduced symbols), but less than the next major release.
 
 
 Relation to X11
@@ -101,19 +91,24 @@ Development
 An extremely rudimentary homepage can be found at:
     http://xkbcommon.org
 
-xkbcommon is maintained in git at freedesktop.org:
-    git://anongit.freedesktop.org/git/libxkbcommon
+xkbcommon is maintained in git at github.com:
+    https://github.com/xkbcommon/libxkbcommon
 
 Patches are always welcome, and may be sent to either xorg-devel@lists.x.org,
-or wayland-devel@lists.freedesktop.org.  Bugs are tracked in Bugzilla at:
-    http://bugs.freedesktop.org
+or wayland-devel@lists.freedesktop.org.
+
+Bugs are tracked in Bugzilla at:
+    https://bugs.freedesktop.org/describecomponents.cgi?product=libxkbcommon
+Or in github at:
+    https://github.com/xkbcommon/libxkbcommon/issues
 
-The maintainer is Daniel Stone, who can be reached at:
+The maintainers are Daniel Stone and Ran Benita, who can be reached at:
     <daniel@fooishbar.org>
+    <ran234@gmail.com>
 
 
 Credits
 =======
 
 Many thanks are due to Dan Nicholson for his heroic work in getting xkbcommon
-off the ground initially, as well as to Ran Benita for subsequent development.
+off the ground initially.

commit 87e0e47462f54545ee97ada8d156f1f16cc51bd0
Author: Ran Benita <ran234@gmail.com>
Date:   Sun Feb 2 12:05:35 2014 +0200

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

diff --git a/NEWS b/NEWS
index 93aae00..450b753 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,32 @@
-libxkbcommon 0.3.2
+libxkbcommon 0.4.0
 ==================
 
-- Added XKB_KEY_XF86AudioMicMute keysym, to match xproto 7.0.24.
+- Add a new add-on library, xkbcommon-x11, to support creating keymaps
+  with the XKB X11 protocol, by querying the X server directly.
+  See the xkbcommon/xkbcommon-x11.h header file for more details.
+  This library requires libxcb-xkb >= 1.10, and is enabled by default.
+  It can be disabled with the --disable-x11 configure switch.
+  Distributions are encouraged to split the necessary files for this
+  library (libxkbcommon-x11.so, xkbcommon-x11.pc, xkbcommon/xkbcommon-x11.h)
+  to a separate package, such that the main package does not depend on
+  X11 libraries.
+
+- Fix the keysym <-> name lookup table to not require huge amounts of
+  relocations.
+
+- Fix a bug in the keysym <-> name lookup, whereby lookup might fail in
+  some rare cases.
+
+- Reduce memory usage during keymap compilation.
+
+- New API:
+  New keysyms from xproto 7.0.25 (German T3 layout keysyms).
+  XKB_MOD_NAME_NUM for the usual NumLock modifier.
+  xkb_x11_* types and functions, XKB_X11_* constants.
+
+
+libxkbcommon 0.3.2
+==================
 
 - Log messages from the library now look like "xkbcommon: ERROR" by
   default, instead of xkbcomp-like "Error:   ".
@@ -14,6 +39,7 @@ libxkbcommon 0.3.2
 - Support byacc for generating the parser, in addition to Bison.
 
 - New API:
+  XKB_KEY_XF86AudioMicMute keysym from xproto 7.0.24.
   XKB_KEYSYM_NO_FLAGS
   XKB_CONTEXT_NO_FLAGS
   XKB_MAP_COMPILE_NO_FLAGS

commit 70717c5686f0f916bb9a23cbdfc79c8ff1f727da
Author: Ran Benita <ran234@gmail.com>
Date:   Sun Feb 2 11:13:28 2014 +0200

    build: add configure summary
    
    Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/configure.ac b/configure.ac
index 9f5afa0..2466021 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,3 +163,22 @@ AC_CONFIG_FILES([
     doc/Doxyfile
 ])
 AC_OUTPUT
+
+AC_MSG_RESULT([
+        $PACKAGE_NAME $VERSION
+
+        libxkbcommon:            yes
+        libxkbcommon-x11:        ${enable_x11}
+        documentation:           ${build_docs}
+
+        default XKB rules:       ${DEFAULT_XKB_RULES}
+        default XKB model:       ${DEFAULT_XKB_MODEL}
+        default XKB layout:      ${DEFAULT_XKB_LAYOUT}
+        default XKB variant:     ${DEFAULT_XKB_VARIANT}
+        default XKB options:     ${DEFAULT_XKB_OPTIONS}
+
+        prefix:                  ${prefix}
+        includedir:              ${includedir}
+        lib dir:                 ${libdir}
+        XKB config root:         ${XKBCONFIGROOT}
+])

commit 2f93c78894ba180cc5ba602bf1b03961173db7b8
Author: Ran Benita <ran234@gmail.com>
Date:   Tue Jul 30 15:06:40 2013 +0300

    x11: add a couple of tests
    
    Add two tests:
    
        ./test/interactive-x11
    which is like test/interactive-evdev, but should behave exactly like your
    X keyboard and react to state and keymap changes - in other words, just
    like typing in xterm. Press ESC to exit.
    
        ./test/x11
    which currently should only print out the same keymap as
        xkbcomp $DISPLAY out.xkb
    (modulo some whitespace and some constructs we do not support.)
    
    Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/Makefile.am b/Makefile.am
index 5fc982b..c4d3352 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -201,6 +201,21 @@ check_PROGRAMS += \
 
 endif BUILD_LINUX_TESTS
 
+if ENABLE_X11
+TESTS += \
+	test/x11
+TESTS_X11_LDADD = $(TESTS_LDADD) $(XCB_XKB_LIBS) libxkbcommon-x11.la
+TESTS_X11_CFLAGS = $(XCB_XKB_CFLAGS)
+
+test_x11_LDADD = $(TESTS_X11_LDADD)
+test_x11_CFLAGS = $(TESTS_X11_CFLAGS)
+test_interactive_x11_LDADD = $(TESTS_X11_LDADD)
+test_interactive_x11_CFLAGS = $(TESTS_X11_CFLAGS)
+
+check_PROGRAMS += \
+	test/interactive-x11
+endif ENABLE_X11
+
 EXTRA_DIST += \
 	test/data
 
diff --git a/test/.gitignore b/test/.gitignore
index eacfcc7..e4b7758 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -15,3 +15,5 @@ rmlvo-to-kccgst
 print-compiled-keymap
 bench-key-proc
 atom
+x11
+interactive-x11
diff --git a/test/interactive-x11.c b/test/interactive-x11.c
new file mode 100644
index 0000000..843b4d2
--- /dev/null
+++ b/test/interactive-x11.c
@@ -0,0 +1,367 @@
+/*
+ * Copyright © 2013 Ran Benita <ran234@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <locale.h>
+
+#include "xkbcommon/xkbcommon-x11.h"
+#include "test.h"
+
+#include <xcb/xkb.h>
+
+/*
+ * Note: This program only handles the core keyboard device for now.
+ * It should be straigtforward to change struct keyboard to a list of
+ * keyboards with device IDs, as in test/interactive-evdev.c. This would
+ * require:
+ *
+ * - Initially listing the keyboard devices.
+ * - Listening to device changes.
+ * - Matching events to their devices.
+ *
+ * XKB itself knows about xinput1 devices, and most requests and events are
+ * device-specific.
+ *
+ * In order to list the devices and react to changes, you need xinput1/2.
+ * You also need xinput for the key press/release event, since the core
+ * protocol key press event does not carry a device ID to match on.
+ */
+
+struct keyboard {
+    xcb_connection_t *conn;
+    uint8_t first_xkb_event;
+    struct xkb_context *ctx;
+
+    struct xkb_keymap *keymap;
+    struct xkb_state *state;
+    int32_t device_id;
+};
+
+static bool terminate;
+
+static int
+select_xkb_events_for_device(xcb_connection_t *conn, int32_t device_id)
+{
+    static const xcb_xkb_map_part_t required_map_parts =
+        (XCB_XKB_MAP_PART_KEY_TYPES |
+         XCB_XKB_MAP_PART_KEY_SYMS |
+         XCB_XKB_MAP_PART_MODIFIER_MAP |
+         XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS |
+         XCB_XKB_MAP_PART_KEY_ACTIONS |
+         XCB_XKB_MAP_PART_VIRTUAL_MODS |
+         XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP);
+
+    static const xcb_xkb_event_type_t required_events =
+        (XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY |
+         XCB_XKB_EVENT_TYPE_MAP_NOTIFY |
+         XCB_XKB_EVENT_TYPE_STATE_NOTIFY);
+
+    xcb_void_cookie_t cookie =
+        xcb_xkb_select_events_checked(conn,
+                                      device_id,
+                                      required_events,
+                                      0,
+                                      required_events,
+                                      required_map_parts,
+                                      required_map_parts,
+                                      0);
+
+    xcb_generic_error_t *error = xcb_request_check(conn, cookie);
+    if (error) {
+        free(error);
+        return -1;
+    }
+
+    return 0;
+}
+
+static int
+update_keymap(struct keyboard *kbd)
+{
+    struct xkb_keymap *new_keymap;
+    struct xkb_state *new_state;
+
+    new_keymap = xkb_x11_keymap_new_from_device(kbd->ctx, kbd->conn,
+                                                kbd->device_id, 0);
+    if (!new_keymap)
+        goto err_out;
+
+    new_state = xkb_x11_state_new_from_device(new_keymap, kbd->conn,
+                                              kbd->device_id);
+    if (!new_state)
+        goto err_keymap;
+
+    if (kbd->keymap)
+        printf("Keymap updated!\n");
+
+    xkb_state_unref(kbd->state);
+    xkb_keymap_unref(kbd->keymap);
+    kbd->keymap = new_keymap;
+    kbd->state = new_state;
+    return 0;
+
+err_keymap:
+    xkb_keymap_unref(new_keymap);
+err_out:
+    return -1;
+}
+
+static int
+init_kbd(struct keyboard *kbd, xcb_connection_t *conn, uint8_t first_xkb_event,
+         int32_t device_id, struct xkb_context *ctx)
+{
+    int ret;
+
+    kbd->conn = conn;
+    kbd->first_xkb_event = first_xkb_event;
+    kbd->ctx = ctx;
+    kbd->keymap = NULL;
+    kbd->state = NULL;
+    kbd->device_id = device_id;
+
+    ret = update_keymap(kbd);
+    if (ret)
+        goto err_out;
+
+    ret = select_xkb_events_for_device(conn, device_id);
+    if (ret)
+        goto err_state;
+
+    return 0;
+
+err_state:
+    xkb_state_unref(kbd->state);
+    xkb_keymap_unref(kbd->keymap);
+err_out:
+    return -1;
+}
+
+static void
+deinit_kbd(struct keyboard *kbd)
+{
+    xkb_state_unref(kbd->state);
+    xkb_keymap_unref(kbd->keymap);
+}
+
+static void
+process_xkb_event(xcb_generic_event_t *gevent, struct keyboard *kbd)
+{
+    union xkb_event {
+        struct {
+            uint8_t response_type;
+            uint8_t xkbType;
+            uint16_t sequence;
+            xcb_timestamp_t time;
+            uint8_t deviceID;
+        } any;
+        xcb_xkb_new_keyboard_notify_event_t new_keyboard_notify;
+        xcb_xkb_map_notify_event_t map_notify;
+        xcb_xkb_state_notify_event_t state_notify;
+    } *event = (union xkb_event *) gevent;
+
+    if (event->any.deviceID != kbd->device_id)
+        return;
+
+    /*
+     * XkbNewKkdNotify and XkbMapNotify together capture all sorts of keymap
+     * updates (e.g. xmodmap, xkbcomp, setxkbmap), with minimal redundent
+     * recompilations.
+     */
+    switch (event->any.xkbType) {
+    case XCB_XKB_NEW_KEYBOARD_NOTIFY:
+        if (event->new_keyboard_notify.changed & XCB_XKB_NKN_DETAIL_KEYCODES)
+            update_keymap(kbd);
+        break;
+
+    case XCB_XKB_MAP_NOTIFY:
+        update_keymap(kbd);
+        break;
+
+    case XCB_XKB_STATE_NOTIFY:
+        xkb_state_update_mask(kbd->state,
+                              event->state_notify.baseMods,
+                              event->state_notify.latchedMods,
+                              event->state_notify.lockedMods,
+                              event->state_notify.baseGroup,
+                              event->state_notify.latchedGroup,
+                              event->state_notify.lockedGroup);
+        break;
+    }
+}
+
+static void
+process_event(xcb_generic_event_t *gevent, struct keyboard *kbd)
+{
+    switch (gevent->response_type) {
+    case XCB_KEY_PRESS: {
+        xcb_key_press_event_t *event = (xcb_key_press_event_t *) gevent;
+        xkb_keycode_t keycode = event->detail;
+
+        test_print_keycode_state(kbd->state, keycode);
+
+        /* Exit on ESC. */
+        if (keycode == 9)
+            terminate = true;
+        break;
+    }
+    default:
+        if (gevent->response_type == kbd->first_xkb_event)
+            process_xkb_event(gevent, kbd);
+        break;
+    }
+}
+
+static int
+loop(xcb_connection_t *conn, struct keyboard *kbd)
+{
+    while (!terminate) {
+        xcb_generic_event_t *event;
+
+        switch (xcb_connection_has_error(conn)) {
+        case 0:
+            break;
+        case XCB_CONN_ERROR:
+            fprintf(stderr,
+                    "Closed connection to X server: connection error\n");
+            return -1;
+        case XCB_CONN_CLOSED_EXT_NOTSUPPORTED:
+            fprintf(stderr,
+                    "Closed connection to X server: extension not supported\n");
+            return -1;
+        default:
+            fprintf(stderr,
+                    "Closed connection to X server: error code %d\n",
+                    xcb_connection_has_error(conn));
+            return -1;
+        }
+
+        event = xcb_wait_for_event(conn);
+        process_event(event, kbd);
+        free(event);
+    }
+
+    return 0;
+}
+
+static int
+create_capture_window(xcb_connection_t *conn)
+{
+    xcb_generic_error_t *error;
+    xcb_void_cookie_t cookie;
+    xcb_screen_t *screen =
+        xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
+    xcb_window_t window = xcb_generate_id(conn);
+    uint32_t values[2] = {
+        screen->white_pixel,
+        XCB_EVENT_MASK_KEY_PRESS,
+    };
+
+    cookie = xcb_create_window_checked(conn, XCB_COPY_FROM_PARENT,
+                                       window, screen->root,
+                                       10, 10, 100, 100, 1,
+                                       XCB_WINDOW_CLASS_INPUT_OUTPUT,
+                                       screen->root_visual,
+                                       XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK,
+                                       values);
+    if ((error = xcb_request_check(conn, cookie)) != NULL) {
+        free(error);
+        return -1;
+    }
+
+    cookie = xcb_map_window_checked(conn, window);
+    if ((error = xcb_request_check(conn, cookie)) != NULL) {
+        free(error);
+        return -1;
+    }
+
+    return 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+    int ret;
+    xcb_connection_t *conn;
+    uint8_t first_xkb_event;
+    int32_t core_kbd_device_id;
+    struct xkb_context *ctx;
+    struct keyboard core_kbd;
+
+    setlocale(LC_ALL, "");
+
+    conn = xcb_connect(NULL, NULL);
+    if (!conn || xcb_connection_has_error(conn)) {
+        fprintf(stderr, "Couldn't connect to X server: error code %d\n",
+                conn ? xcb_connection_has_error(conn) : -1);
+        ret = -1;
+        goto err_out;
+    }
+
+    ret = xkb_x11_setup_xkb_extension(conn,
+                                      XKB_X11_MIN_MAJOR_XKB_VERSION,
+                                      XKB_X11_MIN_MINOR_XKB_VERSION,
+                                      XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS,
+                                      NULL, NULL, &first_xkb_event, NULL);
+    if (!ret) {
+        fprintf(stderr, "Couldn't setup XKB extension\n");
+        goto err_conn;
+    }
+
+    ctx = test_get_context(0);
+    if (!ctx) {
+        ret = -1;
+        fprintf(stderr, "Couldn't create xkb context\n");
+        goto err_conn;
+    }
+
+    core_kbd_device_id = xkb_x11_get_core_keyboard_device_id(conn);
+    if (core_kbd_device_id == -1) {
+        ret = -1;
+        fprintf(stderr, "Couldn't find core keyboard device\n");
+        goto err_ctx;
+    }
+
+    ret = init_kbd(&core_kbd, conn, first_xkb_event, core_kbd_device_id, ctx);
+    if (ret) {
+        fprintf(stderr, "Couldn't initialize core keyboard device\n");
+        goto err_ctx;
+    }
+
+    ret = create_capture_window(conn);
+    if (ret) {
+        fprintf(stderr, "Couldn't create a capture window\n");
+        goto err_core_kbd;
+    }
+
+    system("stty -echo");
+    ret = loop(conn, &core_kbd);
+    system("stty echo");
+
+err_core_kbd:
+    deinit_kbd(&core_kbd);
+err_ctx:
+    xkb_context_unref(ctx);
+err_conn:
+    xcb_disconnect(conn);
+err_out:
+    exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+}
diff --git a/test/test.h b/test/test.h
index ec0b16d..d0104ce 100644
--- a/test/test.h
+++ b/test/test.h
@@ -30,6 +30,9 @@
 #include "xkbcommon/xkbcommon.h"
 #include "utils.h"
 
+/* Automake test exit code to signify SKIP (à la PASS, FAIL, etc). */
+#define SKIP_TEST 77
+
 /* The offset between KEY_* numbering, and keycodes in the XKB evdev
  * dataset. */
 #define EVDEV_OFFSET 8
diff --git a/test/x11.c b/test/x11.c
new file mode 100644
index 0000000..f16dded
--- /dev/null
+++ b/test/x11.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright © 2013 Ran Benita <ran234@gmail.com>
+ *


Reply to: