Annotation of researchv9/X11/src/X.V11R1/lib/X/XChkWinEv.c, revision 1.1.1.1

1.1       root        1: #include "copyright.h"
                      2: 
                      3: /* $Header: XChkWinEv.c,v 11.9 87/09/08 14:30:29 newman Exp $ */
                      4: /* Copyright    Massachusetts Institute of Technology    1985, 1987    */
                      5: #define NEED_EVENTS
                      6: #include "Xlibint.h"
                      7: 
                      8: extern _XQEvent *_qfree;
                      9: extern long _event_to_mask[];
                     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: Bool XCheckWindowEvent (dpy, w, mask, event)
                     18:         register Display *dpy;
                     19:        Window w;               /* Selected window. */
                     20:        int mask;               /* Selected event mask. */
                     21:        register XEvent *event; /* XEvent to be filled in. */
                     22: {
                     23:        register _XQEvent *prev, *qelt;
                     24:        int ret_value;
                     25: 
                     26:        (void) XPending(dpy);
                     27:         LockDisplay(dpy);
                     28:        _XFlush (dpy);
                     29:        for (prev = NULL, qelt = dpy->head;
                     30:             qelt && (qelt->event.xany.window != w ||
                     31:                      !(_event_to_mask[qelt->event.type] & mask));
                     32:             qelt = (prev = qelt)->next) ;
                     33:        if (qelt) {
                     34:            *event = qelt->event;
                     35:            if (prev) {
                     36:                if ((prev->next = qelt->next) == NULL)
                     37:                    dpy->tail = prev;
                     38:            } else {
                     39:                if ((dpy->head = qelt->next) == NULL)
                     40:                    dpy->tail = NULL;
                     41:            }
                     42:            qelt->next = _qfree;
                     43:            _qfree = qelt;
                     44:            dpy->qlen--;
                     45:            ret_value = 1;
                     46:        } else ret_value = 0;
                     47: 
                     48:        UnlockDisplay(dpy);
                     49:        return ret_value;
                     50: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.