check the xkb version before using it

This commit is contained in:
Dana Jansens 2010-02-11 10:58:16 -05:00
parent 580e2167f8
commit 8add92416d

View file

@ -58,8 +58,8 @@ gboolean obt_display_open(const char *display_name)
n = display_name ? g_strdup(display_name) : NULL; n = display_name ? g_strdup(display_name) : NULL;
obt_display = d = XOpenDisplay(n); obt_display = d = XOpenDisplay(n);
if (d) { if (d) {
gint junk; gint junk, major, minor;
(void)junk; (void)junk, (void)major, (void)minor;
if (fcntl(ConnectionNumber(d), F_SETFD, 1) == -1) if (fcntl(ConnectionNumber(d), F_SETFD, 1) == -1)
g_message("Failed to set display as close-on-exec"); g_message("Failed to set display as close-on-exec");
@ -67,12 +67,14 @@ gboolean obt_display_open(const char *display_name)
/* read what extensions are present */ /* read what extensions are present */
#ifdef XKB #ifdef XKB
major = XkbMajorVersion;
minor = XkbMinorVersion;
obt_display_extension_xkb = obt_display_extension_xkb =
XkbQueryExtension(d, &junk, XkbQueryExtension(d, &junk,
&obt_display_extension_xkb_basep, &junk, &obt_display_extension_xkb_basep, &junk,
NULL, NULL); &major, &minor);
if (!obt_display_extension_xkb) if (!obt_display_extension_xkb)
g_message("XKB extension is not present on the server"); g_message("XKB extension is not present on the server or too old");
#endif #endif
#ifdef SHAPE #ifdef SHAPE