1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XPending.c,v 10.4 86/02/01 15:37:51 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: #include "XlibInternal.h"
   7: 
   8: /* Read in any pending events and return the number of queued events. */
   9: 
  10: int XPending ()
  11: {
  12:     register int len;
  13:     int pend;
  14:     char buf[BUFSIZE];
  15:     register XRep *rep;
  16:     register Display *dpy = _XlibCurrentDisplay;
  17: 
  18:     _XFlush (dpy);
  19:     if (ioctl(dpy->fd, FIONREAD, &pend) < 0)
  20:         _XIOError(dpy);
  21:     if ((len = pend) < sizeof(XRep))
  22:         return(dpy->qlen);
  23:     else if (len > BUFSIZE)
  24:         len = BUFSIZE;
  25:     len /= sizeof(XRep);
  26:     pend = len * sizeof(XRep);
  27:     _XRead (dpy, buf, pend);
  28:     for (rep = (XRep *) buf; len > 0; rep++, len--) {
  29:         if (rep->code == X_Error)
  30:         _XError(dpy, (XErrorEvent *)rep);
  31:         else   /* must be an event packet */
  32:         _XEnq(dpy, (XEvent *) rep);
  33:     }
  34:     return(dpy->qlen);
  35: }
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 957
Valid CSS Valid XHTML 1.0 Strict