kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16-keyedit.git/commit/?id=f948dd63b8769bd3805b3ed6c3fa821fa9619ec8
commit f948dd63b8769bd3805b3ed6c3fa821fa9619ec8 Author: Kim Woelders <[email protected]> Date: Sun May 20 19:13:34 2018 +0200 Simplify CommsFindCommsWindow() --- ipc.c | 66 ++++++++++++++++++++++++++++++------------------------------------ 1 file changed, 30 insertions(+), 36 deletions(-) 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) + if (a == None) + return None; + + s = NULL; + XGetWindowProperty(gdk_x11_get_default_xdisplay(), root_win, a, 0, 14, + False, AnyPropertyType, &ar, &format, &num, &after, &s); + if (s) { - 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; - - 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; - } - } + 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; } --
