home *** CD-ROM | disk | FTP | other *** search
Wrap
TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333)))) TTTTkkkk (((( )))) TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333)))) _________________________________________________________________ NNNNAAAAMMMMEEEE Tk_DoOneEvent, Tk_MainLoop, Tk_HandleEvent - wait for events and invoke event handlers SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<ttttkkkk....hhhh>>>> int TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt(_f_l_a_g_s) | TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp() TTTTkkkk____HHHHaaaannnnddddlllleeeeEEEEvvvveeeennnntttt(_e_v_e_n_t_P_t_r) AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS int _f_l_a_g_s (in) This parameter is normally | zero. It may be an OR-ed | combination of any of the | following flag bits: | TK_X_EVENTS, TK_FILE_EVENTS, | TK_TIMER_EVENTS, | TK_IDLE_EVENTS, | TK_ALL_EVENTS, or | TK_DONT_WAIT. XEvent *_e_v_e_n_t_P_t_r (in) Pointer to X event to dispatch to relevant handler(s). _________________________________________________________________ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN These three procedures are responsible for waiting for events and dispatching to event handlers created with the procedures TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEEvvvveeeennnnttttHHHHaaaannnnddddlllleeeerrrr, TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr, TTTTkkkk____CCCCrrrreeeeaaaatttteeeeTTTTiiiimmmmeeeerrrrHHHHaaaannnnddddlllleeeerrrr, and TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee. TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt is the key procedure. It waits for a single event of any sort to occur, invokes the handler(s) for that event, and then returns. TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt first checks for X events and file- related events; if one is found then it calls the handler(s) for the event and returns. If there are no X or file events pending, then TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt checks to see if timer callbacks are ready; if so, it makes a single callback and returns. If no timer callbacks are ready, TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt checks for TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee callbacks; if any are found, it invokes all of them and returns. Finally, if events or work have been found found, TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt sleeps until a timer, file, or X event occurs; then it processes the first event found (in the order given above) and returns. The normal return value is 1 to signify that some Page 1 (printed 7/23/95) TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333)))) TTTTkkkk (((( )))) TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333)))) event or callback was processed. If the _f_l_a_g_s argument to TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt is non-zero then it | restricts the kinds of events that will be processed by | TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt. _F_l_a_g_s may be an OR-ed combination of any of | the following bits: | TTTTKKKK____XXXX____EEEEVVVVEEEENNNNTTTTSSSS - || Process X events. | TTTTKKKK____FFFFIIIILLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS - || Process file events. | TTTTKKKK____TTTTIIIIMMMMEEEERRRR____EEEEVVVVEEEENNNNTTTTSSSS - || Process timer events. | TTTTKKKK____IIIIDDDDLLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS - || Process TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee callbacks. | TTTTKKKK____AAAALLLLLLLL____EEEEVVVVEEEENNNNTTTTSSSS - || Process all kinds of events: | equivalent to OR-ing together all of | the above flags or specifying none | of them. | TTTTKKKK____DDDDOOOONNNNTTTT____WWWWAAAAIIIITTTT - || Don't sleep: process only events | that are ready at the time of the | call. | If any of the flags TTTTKKKK____XXXX____EEEEVVVVEEEENNNNTTTTSSSS, TTTTKKKK____FFFFIIIILLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS, | TTTTKKKK____TTTTIIIIMMMMEEEERRRR____EEEEVVVVEEEENNNNTTTTSSSS, or TTTTKKKK____IIIIDDDDLLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS is set, then the only | events that will be considered are those for which flags are | set. Setting none of these flags is equivalent to the value | TTTTKKKK____AAAALLLLLLLL____EEEEVVVVEEEENNNNTTTTSSSS, which causes all event types to be processed. | The TTTTKKKK____DDDDOOOONNNNTTTT____WWWWAAAAIIIITTTT flag causes TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee not to put the | process to sleep: it will check for events but if none are | found then it returns immediately with a return value of 0 | to indicate that no work was done. TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt will also | return 0 without doing anything if _f_l_a_g_s is TTTTKKKK____IIIIDDDDLLLLEEEE____EEEEVVVVEEEENNNNTTTTSSSS | and there are no TTTTkkkk____DDDDooooWWWWhhhheeeennnnIIIIddddlllleeee callbacks pending. TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp is a procedure that loops repeatedly calling TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt. It returns only when there are no applications left in this process (i.e. no main windows exist anymore). Most X applications will call TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp after initialization; the main execution of the application will consist entirely of callbacks invoked by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt. TTTTkkkk____HHHHaaaannnnddddlllleeeeEEEEvvvveeeennnntttt is a lower-level procedure invoked by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt. It makes callbacks to any event handlers Page 2 (printed 7/23/95) TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333)))) TTTTkkkk (((( )))) TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt((((3333)))) (created by calls to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEEvvvveeeennnnttttHHHHaaaannnnddddlllleeeerrrr) that match _e_v_e_n_t_P_t_r and then returns. In some cases it may be useful for an application to read events directly from X and dispatch them by calling TTTTkkkk____HHHHaaaannnnddddlllleeeeEEEEvvvveeeennnntttt, without going through the additional mechanism provided by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt. These procedures may be invoked recursively. For example, it is possible to invoke TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt recursively from a handler called by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt. This sort of operation is useful in some modal situations, such as when a notifier has been popped up and an application wishes to wait for the user to click a button in the notifier before doing anything else. KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS callback, event, handler, idle, timer Page 3 (printed 7/23/95)