]> Dogcows Code - chaz/openbox/blobdiff - obt/display.c
don't free the XIC if it wasn't created. this appears to cause a crash
[chaz/openbox] / obt / display.c
index f34fc574056915dc5151d4ea538ac12b7d4ddf48..8b06cbfcf6cac47d213fe5a7ec33f12e6fbd1359 100644 (file)
@@ -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 <string.h>
 #  include <unistd.h>
 #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)
This page took 0.02282 seconds and 4 git commands to generate.