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       void XtAppNextEvent(XtAppContext app_context, XEvent *event_return);
11
12       Boolean XtAppPeekEvent(XtAppContext app_context, XEvent *event_return);
13
14       XtInputMask XtAppPending(XtAppContext app_context);
15
16       void XtAppProcessEvent(XtAppContext app_context, XtInputMask mask);
17
18       Boolean XtDispatchEvent(XEvent *event);
19
20       void XtAppMainLoop(XtAppContext app_context);
21

ARGUMENTS

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

DESCRIPTION

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

SEE ALSO

103       X Toolkit Intrinsics - C Language Interface
104       Xlib - C Language X Interface
105
106
107
108X Version 11                      libXt 1.1.5                XtAppNextEvent(3)
Impressum