Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xtappmainloop(3) [hpux man page]

XtAppMainLoop() 														   XtAppMainLoop()

Name
  XtAppMainLoop - continuously process events.

Synopsis
  void XtAppMainLoop(app_context)
	 XtAppContext app_context;

Inputs
  app_context
	    Specifies the application context that identifies the application.

Returns
  XtAppMainLoop() enters an infinite loop and never returns.

Description
  XtAppMainLoop()  enters  an  infinite  loop  which  calls  XtAppNextEvent() to wait for an events on all displays in app_context and XtDis-
  patchEvent() to dispatch that event to the appropriate code.

Usage
  Most applications will call XtAppNextEvent() as the last line of their main() procedure.  Some applications may provide their own  versions
  of  this  loop, however.  A custom event loop might test an application-dependent global flag or other termination condition before looping
  back and calling XtAppNextEvent().  If the number of top-level widgets drops to zero, the application may be able to exit safely, for exam-
  ple.

  Applications that use multiple application contexts or that use internal event loops will have to build their own event loop.

Background
  XtAppNextEvent()  looks  for	X  events in the input queue, and also handles timer events (see XtAppAddTimeOut()) and events from alternate
  input sources (see XtAppAddInput()).	If none of these events are pending and a work	procedure  (see  XtAppAddWorkProc())  is  registered,
  XtAppNextEvent()  invokes  that  work procedure to do background processing, otherwise it blocks waiting for an event.  Note that XtAppNex-
  tEvent() dispatches timer and input events directly, but returns any X events that occur.   Within  XtAppMainLoop(),	these  X  events  are
  always passed to XtDispatchEvent().

  XtDispatchEvent()  dispatches an event to the appropriate event handlers (see XtAddEventHandler()).  Note that the translation manager reg-
  isters an event handler, and that events that are dispatched to the translation manager will be further  dispatched  through	the  transla-
  tions-to-actions mechanism.

Example
  XtAppMainLoop() is implemented as follows:

     void XtAppMainLoop(app)
	     XtAppContext app;
     {
	 XEvent event;

	 for (;;) {
	     XtAppNextEvent(app, &event);
	     XtDispatchEvent(&event);
	 }
     }

See Also
  XtAddEventHandler(1), XtAppAddInput(1), XtAppAddTimeOut(1), XtAppAddWorkProc(1), XtAppNextEvent(1), XtAppProcessEvent(1), XtDis-
  patchEvent(1).

Xt - Event Handling														   XtAppMainLoop()

Check Out this Related Man Page

XtAppProcessEvent()													       XtAppProcessEvent()

Name
  XtAppProcessEvent - get and process one input event of a specified type.

Synopsis
  void XtAppProcessEvent(app_context, mask)
	 XtAppContext app_context;
	 XtInputMask mask;

Inputs
  app_context
	    Specifies the application context for which to process events.

  mask	    Specifies what types of events to process.

Description
  XtAppProcessEvent()  processes  one X event, alternate input source event or timer event in app_context.  The mask argument specifies which
  types of events are to be processed; it is the bitwise inclusive OR ( ) of any of the values XtIMXEvent, XtIMTimer, or  XtIMAlternateInput,
  or the value XtIMAll which specifies all three event types.

  If  there  is  no  event  or	input  of  the	appropriate type to process, if there is a background work procedure registered (see XtAppAd-
  dWorkProc()) XtAppProcessEvent() calls that procedure and checks again for input from all specified  sources.   If  there  are  no  pending
  events and no work procedures registered, XtAppProcessEvent() blocks until an event of one of the specified types occurs.

  If  X  events  are specified in mask, and no events are immediately available, XtAppProcessEvent() flushes the output buffer of each of the
  Displays in app_context.  If there is more than one of the requested types of input available, it is undefined which will be processed.

  XtAppProcessEvent() handles timer and alternate input events by calling the callback procedures registered for those events  (see  XtAppAd-
  dTimeOut()  and XtAppAddInput()).  It handles X events by passing them to XtDispatchEvent().	XtDispatchEvent() handles an event by passing
  it to the appropriate event handlers (see XtAddEventHandler()) or to the Translation Manager (which is itself an event handler).

Usage
  Programs rarely need this much control over the event dispatching mechanism.	Most programs use XtAppMainLoop().

Structures
  The XtInputMask type and its possible values are defined as follows:

     typedef unsigned long    XtInputMask;

     #define XtIMXEvent 	     1
     #define XtIMTimer		     2
     #define XtIMAlternateInput      4
     #define XtIMAll (XtIMXEvent   XtIMTimer   XtIMAlternateInput)

See Also
  XtAppAddInput(1), XtAppAddTimeOut(1), XtAppAddWorkProc(1), XtAppMainLoop(1), XtAppNextEvent(1), XtAppPeekEvent(1), XtAppPending(1), XtDis-
  patchEvent(1).

Xt - Event Handling													       XtAppProcessEvent()
Man Page