File:  [Research Unix] / researchv9 / X11 / src / X.V11R1 / lib / X / XChkMaskEv.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:22:00 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

#include "copyright.h"

/* $Header: /var/lib/cvsd/repos/research/researchv9/X11/src/X.V11R1/lib/X/XChkMaskEv.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
 * 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 XCheckMaskEvent (dpy, mask, event)
        register Display *dpy;
	unsigned long 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 &&  !(_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;
}

unix.superglobalmegacorp.com

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