home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume18 / xrotfont / part01 / events.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-14  |  1.0 KB  |  59 lines

  1. /* ***************************************************************************
  2.  
  3.    events.c -  event handling routine
  4.  
  5.    Functions:  proc_event()
  6.  
  7.    Date:       8/5/92
  8.  
  9.    Copyright   (c) 1992 Alan Richardson
  10.  
  11.    ************************************************************************ */
  12.  
  13.  
  14. #include "all.h"
  15.  
  16. void proc_event();
  17.  
  18. /* event handling routine */
  19. void proc_event()
  20. {
  21.  XEvent ev;
  22.  int expflag=0;
  23.  
  24.  /* loop through any queued events ... */
  25.  while (XPending(dpy)!=0)
  26.  {
  27.  XNextEvent(dpy,&ev);
  28.  
  29.  switch(ev.type)
  30.  {
  31.   /* expose event means redraw the screen ... */
  32.   case Expose:
  33.      /* we try to prevent multiple consecutive redraws ... */
  34.      if (!expflag++) XClearWindow(dpy, gowin); 
  35.      break;
  36.  
  37.   /* a key was pressed ... */
  38.   case KeyPress:
  39.      { char buf[128];
  40.        char *blank="   ";
  41.        KeySym ks;
  42.        XComposeStatus status;
  43.  
  44.        strcpy(buf, blank);
  45.        XLookupString(&ev, buf, 128, &ks, &status);
  46.         
  47.        if (buf[0]=='q') exit();
  48.      }
  49.      break;
  50.  
  51.   default:
  52.      break;  
  53.  }
  54.  
  55.  }
  56. }
  57.  
  58.  
  59.