1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XWindowEvent.c,v 10.4 86/02/01 15:41:46 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: #include "XlibInternal.h"
   7: 
   8: extern _QEvent *_qfree;
   9: 
  10: /*
  11:  * Flush output and (wait for and) return the next event in the queue
  12:  * for the given window matching one of the events in the mask.
  13:  * Events earlier in the queue are not discarded.
  14:  */
  15: 
  16: XWindowEvent (w, mask, event)
  17:     Window w;       /* Selected window. */
  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.window != w ||
  28:               !(qelt->event.type & mask));
  29:          qelt = (prev = qelt)->next) ;
  30:     if (qelt) {
  31:         *event = qelt->event;
  32:         if (prev) {
  33:         if ((prev->next = qelt->next) == NULL)
  34:             dpy->tail = prev;
  35:         } else {
  36:         if ((dpy->head = qelt->next) == NULL)
  37:             dpy->tail = NULL;
  38:         }
  39:         qelt->next = _qfree;
  40:         _qfree = qelt;
  41:         dpy->qlen--;
  42:         return;
  43:     }
  44:     while (1) {
  45:         _XRead (dpy, event, sizeof(XEvent));
  46:         if (event->type == X_Error)
  47:         _XError(dpy, (XErrorEvent *)event);
  48:         else if ((event->window == w) && (event->type & mask))
  49:         return;
  50:         else
  51:         _XEnq(dpy, event);
  52:     }
  53: }

Defined functions

Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 803
Valid CSS Valid XHTML 1.0 Strict