|
|
1.1 root 1: #include <X/mit-copyright.h>
2:
3: /* $Header: XChkMaskEvent.c,v 10.1 86/03/28 11:28:22 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: * matching one of the events in the mask if there is one.
13: * Return whether such an event was found.
14: * Events earlier in the queue are not discarded.
15: */
16:
17: int XCheckMaskEvent (mask, event)
18: int mask; /* Selected event mask. */
19: register XEvent *event; /* XEvent to be filled in. */
20: {
21: register Display *dpy;
22: register _QEvent *prev, *qelt;
23:
24: dpy = _XlibCurrentDisplay;
25: _XFlush (dpy);
26: for (prev = NULL, qelt = dpy->head;
27: qelt && !(qelt->event.type & mask);
28: qelt = (prev = qelt)->next) ;
29: if (qelt) {
30: *event = qelt->event;
31: if (prev) {
32: if ((prev->next = qelt->next) == NULL)
33: dpy->tail = prev;
34: } else {
35: if ((dpy->head = qelt->next) == NULL)
36: dpy->tail = NULL;
37: }
38: qelt->next = _qfree;
39: _qfree = qelt;
40: dpy->qlen--;
41: return 1;
42: } else return 0;
43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.