diff --git a/ipc.c b/ipc.c index d524d65..a1e91b6 100644 --- a/ipc.c +++ b/ipc.c @@ -45,7 +45,6 @@ static gchar *CommsGet(Client ** c, XEvent * ev); static Client *MakeClient(Window win); static void ListFreeClient(void *ptr); static gchar in_init = 0; -static gint gdk_error_warnings; gint CommsInit(void (*msg_receive_func) (gchar * msg)) @@ -236,48 +235,43 @@ CommsFindCommsWindow(void) Atom a, ar; unsigned long num, after; int format; - Window win = 0; + Window win = None; Window rt; int dint; unsigned int duint; a = gdk_x11_get_xatom_by_name("ENLIGHTENMENT_COMMS"); - if (a != None) - { - s = NULL; - XGetWindowProperty(gdk_x11_get_default_xdisplay(), root_win, a, 0, 14, - False, AnyPropertyType, &ar, &format, &num, &after, - &s); - if (s) - { - sscanf((char *)s, "%*s %x", (unsigned int *)&win); - XFree(s); - } - if (win) - { - gint p; + if (a == None) + return None; - p = gdk_error_warnings; - gdk_error_warnings = 0; - if (!XGetGeometry - (gdk_x11_get_default_xdisplay(), win, &rt, &dint, &dint, - &duint, &duint, &duint, &duint)) - win = 0; - gdk_flush(); - gdk_error_warnings = p; - s = NULL; - if (win) - { - XGetWindowProperty(gdk_x11_get_default_xdisplay(), win, a, 0, - 14, False, AnyPropertyType, &ar, &format, - &num, &after, &s); - if (s) - XFree(s); - else - win = 0; - } - } + s = NULL; + XGetWindowProperty(gdk_x11_get_default_xdisplay(), root_win, a, 0, 14, + False, AnyPropertyType, &ar, &format, &num, &after, &s); + if (s) + { + sscanf((char *)s, "%*s %x", (unsigned int *)&win); + XFree(s); } + + if (win == None) + return None; + + if (!XGetGeometry + (gdk_x11_get_default_xdisplay(), win, &rt, &dint, &dint, + &duint, &duint, &duint, &duint)) + return None; + + gdk_flush(); + + s = NULL; + XGetWindowProperty(gdk_x11_get_default_xdisplay(), win, a, 0, + 14, False, AnyPropertyType, &ar, &format, + &num, &after, &s); + if (!s) + return None; + + XFree(s); + return win; }