1XtAppNextEvent(3)                XT FUNCTIONS                XtAppNextEvent(3)
2
3
4

NAME

6       XtAppNextEvent, XtAppPending, XtAppPeekEvent, XtAppProcessEvent, Xt‐
7       DispatchEvent, XtAppMainLoop - query and process events and input
8

SYNTAX

10       #include <X11/Intrinsic.h>
11
12       void XtAppNextEvent(XtAppContext app_context, XEvent *event_return);
13
14       Boolean XtAppPeekEvent(XtAppContext app_context, XEvent *event_return);
15
16       XtInputMask XtAppPending(XtAppContext app_context);
17
18       void XtAppProcessEvent(XtAppContext app_context, XtInputMask mask);
19
20       Boolean XtDispatchEvent(XEvent *event);
21
22       void XtAppMainLoop(XtAppContext app_context);
23

ARGUMENTS

25       app_context
26                 Specifies the application context that identifies the appli‐
27                 cation.
28
29       event     Specifies a pointer to the event structure that is to be dis‐
30                 patched to the appropriate event handler.
31
32       event_return
33                 Returns the event information to the specified event struc‐
34                 ture.
35
36       mask      Specifies what types of events to process.  The mask is the
37                 bitwise inclusive OR of any combination of XtIMXEvent, XtIM‐
38                 Timer, XtIMAlternateInput, and XtIMSignal.  As a convenience,
39                 the X Toolkit defines the symbolic name XtIMAll to be the
40                 bitwise inclusive OR of all event types.
41

DESCRIPTION

43       If the X event queue is empty, XtAppNextEvent flushes the X output buf‐
44       fers of each Display in the application context and waits for an event
45       while looking at the other input sources, timeout timeout values, and
46       signal handlers and calling any callback procedures triggered by them.
47       This wait time can be used for background processing (see Section 7.8).
48
49       If there is an event in the queue, XtAppPeekEvent fills in the event
50       and returns a nonzero value.  If no X input is on the queue, XtAppPeek‐
51       Event flushes the output buffer and blocks until input is available
52       (possibly calling some timeout callbacks in the process).  If the input
53       is an event, XtAppPeekEvent fills in the event and returns a nonzero
54       value.  Otherwise, the input is for an alternate input source, and
55       XtAppPeekEvent returns zero.
56
57       The XtAppPending function returns a nonzero value if there are events
58       pending from the X server, timer pending, or other input sources pend‐
59       ing.  The value returned is a bit mask that is the OR of XtIMXEvent,
60       XtIMTimer, XtIMAlternateInput, and XtIMSignal (see XtAppProcessEvent).
61       If there are no events pending, XtAppPending flushes the output buffer
62       and returns zero.
63
64       The XtAppProcessEvent function processes one timer, alternate input,
65       signal source, or X event.  If there is nothing of the appropriate type
66       to process, XtAppProcessEvent blocks until there is.  If there is more
67       than one type of thing available to process, it is undefined which will
68       get processed.  Usually, this procedure is not called by client appli‐
69       cations (see XtAppMainLoop).  XtAppProcessEvent processes timer events
70       by calling any appropriate timer callbacks, alternate input by calling
71       any appropriate alternate input callbacks, signal source by calling any
72       appropriate signal callbacks, and X events by calling XtDispatchEvent.
73
74       When an X event is received, it is passed to XtDispatchEvent, which
75       calls the appropriate event handlers and passes them the widget, the
76       event, and client-specific data registered with each procedure.  If
77       there are no handlers for that event registered, the event is ignored
78       and the dispatcher simply returns.  The order in which the handlers are
79       called is undefined.
80
81       The XtDispatchEvent function sends those events to the event handler
82       functions that have been previously registered with the dispatch rou‐
83       tine.  XtDispatchEvent returns True if it dispatched the event to some
84       handler and False if it found no handler to dispatch the event to.  The
85       most common use of XtDispatchEvent is to dispatch events acquired with
86       the XtAppNextEvent procedure.  However, it also can be used to dispatch
87       user-constructed events.  XtDispatchEvent also is responsible for im‐
88       plementing the grab semantics for XtAddGrab.
89
90       The XtAppMainLoop function processes events using XtAppProcessEvent,
91       varying the mask parameter and using XtAppPending to ensure that it has
92       a chance to handle events of all types, i.e., X events, timer events,
93       input events and signal sources.  This constitutes the main loop of X
94       Toolkit applications, and, as such, it does not return unless XtAppSe‐
95       tExitFlag is called.  Applications are expected to exit in response to
96       some user action.  There is nothing special about XtAppMainLoop; it is
97       simply an loop that processes events until XtAppGetExitFlag() returns
98       true.
99
100       Applications can provide their own version of this loop, which tests
101       some global termination flag or tests that the number of top-level wid‐
102       gets is larger than zero before circling back for the next event.
103

SEE ALSO

105       X Toolkit Intrinsics - C Language Interface
106       Xlib - C Language X Interface
107
108
109
110X Version 11                      libXt 1.2.1                XtAppNextEvent(3)
Impressum