home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / Libraries / Icon / c / ClickWait < prev    next >
Encoding:
Text File  |  1994-05-29  |  1008 b   |  37 lines

  1. #include "Wimp.h"
  2. #include "WimpSWIs.h"
  3. #include "Time.h"
  4. #include "Event.h"
  5.  
  6.  
  7. extern void Icon_ClickWait(int waittime)
  8. {
  9.   static int      waitingonclick = FALSE;
  10.   int             time;
  11.   event_pollblock event;
  12.   event_pollmask  mask;
  13.  
  14.   if (waitingonclick)        /* Don't allow re-entrant call on this function */
  15.     return;
  16.  
  17.   waitingonclick = TRUE;
  18.   time = Time_Monotonic() + waittime;
  19.  
  20.   do
  21.   {
  22.     mask.value = 0;                           /* enable null polls */
  23.     Wimp_PollIdle(mask, &event, time);        /* Wait until time up or event */
  24.  
  25.     if (event.type != event_CLICK && event.type != event_NULL)
  26.       Event_Process(&event);                           /* Process this event */
  27.  
  28.   } while (event.type == event_CLICK || event.type == event_REDRAW);
  29.  
  30.   /*  Wait until not a button click event, and also ignore redraws as a
  31.    *  termination condition, as redraw is very likely (indenting a button)
  32.    *  on the first poll after the click which called us!
  33.    */
  34.  
  35.   waitingonclick = FALSE;
  36. }
  37.