Annotation of researchv9/X11/src/X.V11R1/lib/X/XChkMaskEv.c, revision 1.1

1.1     ! root        1: #include "copyright.h"
        !             2: 
        !             3: /* $Header: XChkMaskEv.c,v 11.11 87/09/08 14:29:58 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: /* 
        !            12:  * Flush output and return the next event in the queue
        !            13:  * matching one of the events in the mask if there is one.
        !            14:  * Return whether such an event was found.
        !            15:  * Events earlier in the queue are not discarded.
        !            16:  */
        !            17: 
        !            18: Bool XCheckMaskEvent (dpy, mask, event)
        !            19:         register Display *dpy;
        !            20:        unsigned long 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 &&  !(_event_to_mask[qelt->event.type] & mask);
        !            31:             qelt = (prev = qelt)->next) ;
        !            32:        if (qelt) {
        !            33:            *event = qelt->event;
        !            34:            if (prev) {
        !            35:                if ((prev->next = qelt->next) == NULL)
        !            36:                    dpy->tail = prev;
        !            37:            } else {
        !            38:                if ((dpy->head = qelt->next) == NULL)
        !            39:                    dpy->tail = NULL;
        !            40:            }
        !            41:            qelt->next = _qfree;
        !            42:            _qfree = qelt;
        !            43:            dpy->qlen--;
        !            44:             ret_value = 1;
        !            45:        } else ret_value = 0;
        !            46: 
        !            47:        UnlockDisplay(dpy);
        !            48:        return ret_value;
        !            49: }

unix.superglobalmegacorp.com

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