|
|
1.1 root 1: #include <X/mit-copyright.h>
2:
3: /* $Header: XChkWinEvent.c,v 10.1 86/03/28 11:28:48 jg Rel $ */
4: /* Copyright Massachusetts Institute of Technology 1985 */
5:
6: #include "XlibInternal.h"
7:
8: extern _QEvent *_qfree;
9:
10: /*
11: * Flush output and return the next event in the queue
12: * for the given window matching one of the events in the mask if there
13: * is one. Return whether such an event was found.
14: * Events earlier in the queue are not discarded.
15: */
16:
17: int XCheckWindowEvent (w, mask, event)
18: Window w; /* Selected window. */
19: int mask; /* Selected event mask. */
20: register XEvent *event; /* XEvent to be filled in. */
21: {
22: register Display *dpy;
23: register _QEvent *prev, *qelt;
24:
25: dpy = _XlibCurrentDisplay;
26: _XFlush (dpy);
27: for (prev = NULL, qelt = dpy->head;
28: qelt && (qelt->event.window != w ||
29: !(qelt->event.type & mask));
30: qelt = (prev = qelt)->next) ;
31: if (qelt) {
32: *event = qelt->event;
33: if (prev) {
34: if ((prev->next = qelt->next) == NULL)
35: dpy->tail = prev;
36: } else {
37: if ((dpy->head = qelt->next) == NULL)
38: dpy->tail = NULL;
39: }
40: qelt->next = _qfree;
41: _qfree = qelt;
42: dpy->qlen--;
43: return 1;
44: } else return 0;
45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.