home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / DoOneEvent.3 < prev    next >
Encoding:
Text File  |  1995-07-26  |  11.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4.      TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333))))             TTTTkkkk (((( ))))              TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           Tk_DoOneEvent, Tk_MainLoop, Tk_HandleEvent - wait for events
  12.           and invoke event handlers
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           ####iiiinnnncccclllluuuuddddeeee <<<<ttttkkkk....hhhh>>>>
  16.  
  17.           int
  18.           TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt(_f_l_a_g_s)                                          |
  19.  
  20.           TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp()
  21.  
  22.           TTTTkkkk____HHHHaaaannnnddddlllleeeeEEEEvvvveeeennnntttt(_e_v_e_n_t_P_t_r)
  23.  
  24.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  25.           int      _f_l_a_g_s       (in)      This  parameter  is  normally  |
  26.                                          zero.   It  may  be  an OR-ed  |
  27.                                          combination  of  any  of  the  |
  28.                                          following      flag     bits:  |
  29.                                          TK_X_EVENTS,  TK_FILE_EVENTS,  |
  30.                                          TK_TIMER_EVENTS,  |
  31.                                          TK_IDLE_EVENTS,  |
  32.                                          TK_ALL_EVENTS,             or  |
  33.                                          TK_DONT_WAIT.
  34.  
  35.           XEvent   *_e_v_e_n_t_P_t_r   (in)      Pointer   to   X   event   to
  36.                                          dispatch      to     relevant
  37.                                          handler(s).
  38.      _________________________________________________________________
  39.  
  40.  
  41.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  42.           These three  procedures  are  responsible  for  waiting  for
  43.           events  and  dispatching  to event handlers created with the
  44.           procedures   TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEEvvvveeeennnnttttHHHHaaaannnnddddlllleeeerrrr,    TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr,
  45.           TTTTkkkk____CCCCrrrreeeeaaaatttteeeeTTTTiiiimmmmeeeerrrrHHHHaaaannnnddddlllleeeerrrr,  and TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee.  TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt is
  46.           the key procedure.  It waits for a single event of any  sort
  47.           to  occur,  invokes  the handler(s) for that event, and then
  48.           returns.  TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt first checks for X events and  file-
  49.           related   events;   if  one  is  found  then  it  calls  the
  50.           handler(s) for the event and returns.  If there are no X  or
  51.           file  events  pending,  then  TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt checks to see if
  52.           timer callbacks  are  ready;   if  so,  it  makes  a  single
  53.           callback  and  returns.   If  no  timer callbacks are ready,
  54.           TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt checks for TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee  callbacks;   if  any
  55.           are  found, it invokes all of them and returns.  Finally, if
  56.           events or work have been found found,  TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt  sleeps
  57.           until  a  timer, file, or X event occurs;  then it processes
  58.           the first  event  found  (in  the  order  given  above)  and
  59.           returns.   The normal return value is 1 to signify that some
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/23/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333))))             TTTTkkkk (((( ))))              TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333))))
  71.  
  72.  
  73.  
  74.           event or callback was processed.
  75.  
  76.           If the _f_l_a_g_s argument to TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt is non-zero  then  it  |
  77.           restricts  the  kinds  of  events  that will be processed by  |
  78.           TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt.  _F_l_a_g_s may be an OR-ed combination of any  of  |
  79.           the following bits:                                           |
  80.  
  81.           TTTTKKKK____XXXX____EEEEVVVVEEEENNNNTTTTSSSS -                                                      ||
  82.                                   Process X events.                     |
  83.  
  84.           TTTTKKKK____FFFFIIIILLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS -                                                   ||
  85.                                   Process file events.                  |
  86.  
  87.           TTTTKKKK____TTTTIIIIMMMMEEEERRRR____EEEEVVVVEEEENNNNTTTTSSSS -                                                  ||
  88.                                   Process timer events.                 |
  89.  
  90.           TTTTKKKK____IIIIDDDDLLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS -                                                   ||
  91.                                   Process TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee callbacks.      |
  92.  
  93.           TTTTKKKK____AAAALLLLLLLL____EEEEVVVVEEEENNNNTTTTSSSS -                                                    ||
  94.                                   Process   all   kinds   of   events:  |
  95.                                   equivalent to OR-ing together all of  |
  96.                                   the  above  flags or specifying none  |
  97.                                   of them.                              |
  98.  
  99.           TTTTKKKK____DDDDOOOONNNNTTTT____WWWWAAAAIIIITTTT -                                                     ||
  100.                                   Don't  sleep:   process  only events  |
  101.                                   that are ready at the  time  of  the  |
  102.                                   call.                                 |
  103.  
  104.           If   any   of   the   flags   TTTTKKKK____XXXX____EEEEVVVVEEEENNNNTTTTSSSS,   TTTTKKKK____FFFFIIIILLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS,  |
  105.           TTTTKKKK____TTTTIIIIMMMMEEEERRRR____EEEEVVVVEEEENNNNTTTTSSSS,  or  TTTTKKKK____IIIIDDDDLLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS  is  set, then the only  |
  106.           events that will be considered are those for which flags are  |
  107.           set.  Setting none of these flags is equivalent to the value  |
  108.           TTTTKKKK____AAAALLLLLLLL____EEEEVVVVEEEENNNNTTTTSSSS, which causes all event types to be processed.  |
  109.  
  110.           The TTTTKKKK____DDDDOOOONNNNTTTT____WWWWAAAAIIIITTTT flag causes TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee not  to  put  the  |
  111.           process  to sleep:  it will check for events but if none are  |
  112.           found then it returns immediately with a return value  of  0  |
  113.           to  indicate that no work was done.  TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt will also  |
  114.           return 0 without doing anything if _f_l_a_g_s  is  TTTTKKKK____IIIIDDDDLLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS  |
  115.           and there are no TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee callbacks pending.
  116.  
  117.           TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp is a procedure  that  loops  repeatedly  calling
  118.           TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt.    It   returns   only   when  there  are  no
  119.           applications left in this  process  (i.e.  no  main  windows
  120.           exist  anymore).   Most X applications will call TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp
  121.           after initialization;  the main execution of the application
  122.           will consist entirely of callbacks invoked by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt.
  123.  
  124.           TTTTkkkk____HHHHaaaannnnddddlllleeeeEEEEvvvveeeennnntttt  is  a  lower-level  procedure   invoked   by
  125.           TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt.   It  makes  callbacks  to any event handlers
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/23/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333))))             TTTTkkkk (((( ))))              TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333))))
  137.  
  138.  
  139.  
  140.           (created  by  calls  to  TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEEvvvveeeennnnttttHHHHaaaannnnddddlllleeeerrrr)  that  match
  141.           _e_v_e_n_t_P_t_r  and  then returns.  In some cases it may be useful
  142.           for an application  to  read  events  directly  from  X  and
  143.           dispatch  them  by  calling  TTTTkkkk____HHHHaaaannnnddddlllleeeeEEEEvvvveeeennnntttt,  without  going
  144.           through the additional mechanism provided by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt.
  145.  
  146.           These procedures may be invoked recursively.   For  example,
  147.           it  is  possible  to invoke TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt recursively from a
  148.           handler called by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt.  This sort of operation  is
  149.           useful in some modal situations, such as when a notifier has
  150.           been popped up and an application wishes  to  wait  for  the
  151.           user to click a button in the notifier before doing anything
  152.           else.
  153.  
  154.  
  155.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  156.           callback, event, handler, idle, timer
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 7/23/95)
  196.  
  197.  
  198.  
  199.