Enable detectable autorepeat (#550)

Imagine the following snippet is run:

    keygrabber.run(function(mod, key, event)
      gears.debug.dump{mod, key, event}
    end)

The above starts a keygrabber and prints the events that are received.
Currently, when a key is pressed and held down, this prints a series of press
and release, because that's what the X11 server sends us.

This commit enables detectable autorepeat. This means that the X11 server only
sends us a series of press events for autorepeat and a single release when the
key really is released.

Testing this is a bit hard, because detectable autorepeat does not seem to work
with Xephyr. Instead, a "real" Xorg instance is needed.

We do not check the response to the PerClientFlags request, because it doesn't
really tell us anything useful. If the server does not support detectable
autorepeat, we could print a warning, but so what? As I just said, this does not
work in Xephyr and yet Xephyr announced to support this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-11-07 12:45:04 +01:00
parent e279d68670
commit 6f2424e901
1 changed files with 11 additions and 0 deletions

11
xkb.c
View File

@ -275,6 +275,17 @@ xkb_init(void)
XCB_XKB_MAP_PART_VIRTUAL_MODS | XCB_XKB_MAP_PART_VIRTUAL_MODS |
XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP; XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP;
/* Enable detectable auto-repeat, but ignore failures */
xcb_discard_reply(globalconf.connection,
xcb_xkb_per_client_flags(globalconf.connection,
XCB_XKB_ID_USE_CORE_KBD,
XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT,
XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT,
0,
0,
0)
.sequence);
xcb_xkb_select_events(globalconf.connection, xcb_xkb_select_events(globalconf.connection,
XCB_XKB_ID_USE_CORE_KBD, XCB_XKB_ID_USE_CORE_KBD,
map, map,