X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=obt%2Fdisplay.c;h=8b06cbfcf6cac47d213fe5a7ec33f12e6fbd1359;hb=c1d21a1a6d88189ab3c5569b2b776d846bb6c11a;hp=6993addb1d449c65d3c11cd66a4a0cf01f315ebe;hpb=6c8acc079a9cbb40245e5df4b50b3f8b9c17cf83;p=chaz%2Fopenbox diff --git a/obt/display.c b/obt/display.c index 6993addb..8b06cbfc 100644 --- a/obt/display.c +++ b/obt/display.c @@ -18,6 +18,9 @@ #include "obt/display.h" #include "obt/prop.h" +#include "obt/internal.h" +#include "obt/keyboard.h" +#include "obt/xqueue.h" #ifdef HAVE_STRING_H # include @@ -29,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; @@ -56,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"); @@ -65,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 @@ -108,15 +117,23 @@ gboolean obt_display_open(const char *display_name) #endif obt_prop_startup(); + obt_keyboard_reload(); } g_free(n); + if (obt_display) + xqueue_init(); + return obt_display != NULL; } -void obt_display_close() +void obt_display_close(void) { - if (obt_display) XCloseDisplay(obt_display); + obt_keyboard_shutdown(); + if (obt_display) { + xqueue_destroy(); + XCloseDisplay(obt_display); + } } static gint xerror_handler(Display *d, XErrorEvent *e) @@ -127,11 +144,11 @@ static gint xerror_handler(Display *d, XErrorEvent *e) XGetErrorText(d, e->error_code, errtxt, 127); if (!xerror_ignore) { if (e->error_code == BadWindow) - /*g_message(_("X Error: %s\n"), errtxt)*/; + /*g_debug(_("X Error: %s\n"), errtxt)*/; else g_error("X Error: %s", errtxt); } else - g_message("XError code %d '%s'", e->error_code, errtxt); + g_debug("Ignoring XError code %d '%s'", e->error_code, errtxt); #else (void)d; (void)e; #endif