X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=obt%2Fdisplay.c;h=8b06cbfcf6cac47d213fe5a7ec33f12e6fbd1359;hb=4e6c0086a657399d989f2e4849f7b397d7d4efbc;hp=f34fc574056915dc5151d4ea538ac12b7d4ddf48;hpb=6799c67c07e99c440f549802f60d9f16995ab711;p=chaz%2Fopenbox diff --git a/obt/display.c b/obt/display.c index f34fc574..8b06cbfc 100644 --- a/obt/display.c +++ b/obt/display.c @@ -20,6 +20,7 @@ #include "obt/prop.h" #include "obt/internal.h" #include "obt/keyboard.h" +#include "obt/xqueue.h" #ifdef HAVE_STRING_H # include @@ -31,6 +32,10 @@ # include #endif +/* from xqueue.c */ +extern void xqueue_init(void); +extern void xqueue_destroy(void); + Display* obt_display = NULL; gboolean obt_display_error_occured = FALSE; @@ -58,8 +63,8 @@ gboolean obt_display_open(const char *display_name) n = display_name ? g_strdup(display_name) : NULL; obt_display = d = XOpenDisplay(n); if (d) { - gint junk; - (void)junk; + gint junk, major, minor; + (void)junk, (void)major, (void)minor; if (fcntl(ConnectionNumber(d), F_SETFD, 1) == -1) g_message("Failed to set display as close-on-exec"); @@ -67,12 +72,14 @@ gboolean obt_display_open(const char *display_name) /* read what extensions are present */ #ifdef XKB + major = XkbMajorVersion; + minor = XkbMinorVersion; obt_display_extension_xkb = XkbQueryExtension(d, &junk, &obt_display_extension_xkb_basep, &junk, - NULL, NULL); + &major, &minor); 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 #ifdef SHAPE @@ -114,13 +121,19 @@ gboolean obt_display_open(const char *display_name) } g_free(n); + if (obt_display) + xqueue_init(); + return obt_display != NULL; } void obt_display_close(void) { obt_keyboard_shutdown(); - if (obt_display) XCloseDisplay(obt_display); + if (obt_display) { + xqueue_destroy(); + XCloseDisplay(obt_display); + } } static gint xerror_handler(Display *d, XErrorEvent *e)