|
|
researchv9-SUN3(old)
#include "copyright.h"
/* $Header: /var/lib/cvsd/repos/research/researchv9/X11/src/X.V11R1/lib/X/XChkWinEv.c,v 1.1.1.1 2018/04/24 17:22:00 root Exp $ */
/* Copyright Massachusetts Institute of Technology 1985, 1987 */
#define NEED_EVENTS
#include "Xlibint.h"
extern _XQEvent *_qfree;
extern long _event_to_mask[];
/*
* Flush output and return the next event in the queue
* for the given window matching one of the events in the mask if there
* is one. Return whether such an event was found.
* Events earlier in the queue are not discarded.
*/
Bool XCheckWindowEvent (dpy, w, mask, event)
register Display *dpy;
Window w; /* Selected window. */
int mask; /* Selected event mask. */
register XEvent *event; /* XEvent to be filled in. */
{
register _XQEvent *prev, *qelt;
int ret_value;
(void) XPending(dpy);
LockDisplay(dpy);
_XFlush (dpy);
for (prev = NULL, qelt = dpy->head;
qelt && (qelt->event.xany.window != w ||
!(_event_to_mask[qelt->event.type] & mask));
qelt = (prev = qelt)->next) ;
if (qelt) {
*event = qelt->event;
if (prev) {
if ((prev->next = qelt->next) == NULL)
dpy->tail = prev;
} else {
if ((dpy->head = qelt->next) == NULL)
dpy->tail = NULL;
}
qelt->next = _qfree;
_qfree = qelt;
dpy->qlen--;
ret_value = 1;
} else ret_value = 0;
UnlockDisplay(dpy);
return ret_value;
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.