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

1.1       root        1: #include "copyright.h"
                      2: 
                      3: /* $Header: XPeekEvent.c,v 11.11 87/09/11 08:05:29 toddb Exp $ */
                      4: /* Copyright    Massachusetts Institute of Technology    1986  */
                      5: 
                      6: #define NEED_EVENTS
                      7: #include "Xlibint.h"
                      8: 
                      9: extern _XQEvent *_qfree;
                     10: 
                     11: /* 
                     12:  * Flush output and (wait for and) return the next event in the queue,
                     13:  * BUT do not remove it from the queue.
                     14:  */
                     15: 
                     16: XPeekEvent (dpy, event)
                     17:        register Display *dpy;
                     18:        register XEvent *event;
                     19: {
                     20:        register _XQEvent *qelt;
                     21:        xEvent ev;
                     22: 
                     23:        LockDisplay(dpy);
                     24:        _XFlush (dpy);
                     25:        if (qelt = (_XQEvent *)dpy->head) {
                     26:            *event = qelt->event;
                     27:            UnlockDisplay(dpy);
                     28:            return;
                     29:            }
                     30: 
                     31:        while (1) {
                     32:            _XRead (dpy, (char *)&ev, (long) sizeof(xEvent));
                     33:            if (ev.u.u.type == X_Error)
                     34:                _XError (dpy, (xError *) event);
                     35:            else {  /* it's an event packet */
                     36:                _XEnq (dpy, &ev);
                     37:                *event = dpy->head->event;
                     38:                UnlockDisplay(dpy);
                     39:                return;
                     40:                }
                     41:        }
                     42: }
                     43: 

unix.superglobalmegacorp.com

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