comms: Some trivial changes
This commit is contained in:
parent
9561cc6cdc
commit
a85954ad53
23
api/comms.c
23
api/comms.c
|
@ -138,10 +138,16 @@ CommsSend(const char *buf, unsigned int len)
|
||||||
static Bool
|
static Bool
|
||||||
ev_check(Display *d __UNUSED__, XEvent *ev, XPointer p __UNUSED__)
|
ev_check(Display *d __UNUSED__, XEvent *ev, XPointer p __UNUSED__)
|
||||||
{
|
{
|
||||||
if (((ev->type == ClientMessage) && (ev->xclient.window == my_win)) ||
|
if (ev->type == ClientMessage)
|
||||||
((ev->type == DestroyNotify) &&
|
{
|
||||||
(ev->xdestroywindow.window == comms_win)))
|
if (ev->xclient.window == my_win)
|
||||||
return True;
|
return True;
|
||||||
|
}
|
||||||
|
else if (ev->type == DestroyNotify)
|
||||||
|
{
|
||||||
|
if (ev->xdestroywindow.window == comms_win)
|
||||||
|
return True;
|
||||||
|
}
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,13 +157,20 @@ CommsWaitForMessage(void)
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
|
|
||||||
while ((!msg) && (comms_win))
|
for (;;)
|
||||||
{
|
{
|
||||||
XIfEvent(disp, &ev, ev_check, NULL);
|
XIfEvent(disp, &ev, ev_check, NULL);
|
||||||
if (ev.type == DestroyNotify)
|
if (ev.type == DestroyNotify)
|
||||||
|
{
|
||||||
comms_win = 0;
|
comms_win = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
msg = CommsHandleClientMessage(&ev);
|
msg = CommsHandleClientMessage(&ev);
|
||||||
|
if (msg)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue