compositor-x11: verify that detectable repeat was really set
authorRan Benita <ran234@gmail.com>
Wed, 31 Oct 2012 18:14:58 +0000 (20:14 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 1 Nov 2012 15:14:04 +0000 (11:14 -0400)
Since the XKB says that support for detectable repeat is in fact
optional:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Querying_and_Changing_Per_Client_Flags
we might as well be good citizens and check that it was really set. With
the X server this would never happen, though.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/compositor-x11.c

index 001dec4..c575f25 100644 (file)
@@ -249,9 +249,11 @@ x11_compositor_setup_xkb(struct x11_compositor *c)
                                       0,
                                       0);
        pcf_reply = xcb_xkb_per_client_flags_reply(c->conn, pcf, NULL);
-       if (!pcf_reply) {
+       if (!pcf_reply ||
+           !(pcf_reply->value & XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT)) {
                weston_log("failed to set XKB per-client flags, not using "
                           "detectable repeat\n");
+               free(pcf_reply);
                return;
        }
        free(pcf_reply);