compositor-x11: properly initialize XKB extension

In order to use XKB capabilities (as we do), the client must issue an
XkbUseExtension request:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Initializing_the_X_Keyboard_Extension

The reason this succeeds currently is that XOpenDisplay from Xlib does
this for us. But it is better not to rely on that, but do it explicitly
in XCB with the rest of the XKB init sequence.

Signed-off-by: Ran Benita <ran234@gmail.com>
Ran Benita 12 years ago committed by Kristian Høgsberg
parent 7b5e3cd9b1
commit 6a39d8790e
  1. 21
      src/compositor-x11.c

@ -190,6 +190,8 @@ x11_compositor_setup_xkb(struct x11_compositor *c)
const xcb_query_extension_reply_t *ext;
xcb_generic_error_t *error;
xcb_void_cookie_t select;
xcb_xkb_use_extension_cookie_t use_ext;
xcb_xkb_use_extension_reply_t *use_ext_reply;
xcb_xkb_per_client_flags_cookie_t pcf;
xcb_xkb_per_client_flags_reply_t *pcf_reply;
xcb_xkb_get_state_cookie_t state;
@ -220,6 +222,25 @@ x11_compositor_setup_xkb(struct x11_compositor *c)
return;
}
use_ext = xcb_xkb_use_extension(c->conn,
XCB_XKB_MAJOR_VERSION,
XCB_XKB_MINOR_VERSION);
use_ext_reply = xcb_xkb_use_extension_reply(c->conn, use_ext, NULL);
if (!use_ext_reply) {
weston_log("couldn't start using XKB extension\n");
return;
}
if (!use_ext_reply->supported) {
weston_log("XKB extension version on the server is too old "
"(want %d.%d, has %d.%d)\n",
XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION,
use_ext_reply->serverMajor, use_ext_reply->serverMinor);
free(use_ext_reply);
return;
}
free(use_ext_reply);
pcf = xcb_xkb_per_client_flags(c->conn,
XCB_XKB_ID_USE_CORE_KBD,
XCB_XKB_PER_CLIENT_FLAG_DETECTABLE_AUTO_REPEAT,

Loading…
Cancel
Save