Simplify CommsFindCommsWindow()

master
Kim Woelders 5 years ago
parent 5afadfffe7
commit f948dd63b8
  1. 66
      ipc.c

66
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;
}

Loading…
Cancel
Save