Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtAddEventHandler(1)

XtAddRawEventHandler(1)

XtRemoveEventHandler(1)

XtRemoveRawEventHandler(1)

Name

XtEventHandler — prototype event handler procedure. 

Synopsis

typedef void (∗XtEventHandler)(Widget, XtPointer, XEvent ∗, Boolean ∗);

    Widget w;
    XtPointer client_data;
    XEvent ∗event;
    Boolean ∗continue_to_dispatch

Arguments

wSpecifies the widget for which to handle events. 

client_data
Specifies the client-specific information registered with the event handler, which is usually NULL if the event handler is registered by the widget itself. 

eventSpecifies the triggering event for this handler. 

continue_to_dispatch
Specifies whether to call the remaining event handlers that are registered for the current event.

Description

Event handlers are of type XtEventHandler.  A widget registers an event handler by calling XtAddEventHandler, specifying as the handler argument a pointer to a procedure of this type. 

After receiving an event and before calling any event handlers, the Boolean pointed to by continue_to_dispatch is initialized to True.  When an event handler is called, it may decide that further processing of the event is not desirable and may store False in this Boolean, in which case any handlers remaining to be called for the event will be ignored. 

The circumstances under which the Intrinsics may add event handlers to a widget are currently implementation-dependent.  Clients must therefore be aware that storing False into the continue_to_dispatch argument can lead to portability problems. 

Most widgets need not use event handlers explicitly.  Instead they use the Xt Translation Manager to accept events and invoke procedures based on the interpretation of multiple events. 

Examples

The example below shows the code from xterm that registers an event handler for FocusIn and FocusOut events, and a gutted version of the event handler itself. 

extern void HandleFocusChange();
 static void VTInitialize (request, new)
XtermWidget request, new;
{
  .
  .
  .
     XtAddEventHandler(topLevel, /∗ widget ∗/
            FocusChangeMask,    /∗ event mask ∗/
            FALSE,              /∗ non-maskable events ∗/
            HandleFocusChange,  /∗ event handler ∗/
            (Opaque)NULL);      /∗ client_data ∗/
   .
  .
  .
}
 /∗ARGSUSED∗/
void HandleFocusChange(w, unused, event)
Widget w;
register XFocusChangeEvent ∗event;
caddr_t unused;                 /∗ client_data ∗/
{
          if(event->type == FocusIn)
/∗ process FocusIn ∗/
   .
   .
   .
          else {
/∗ process FocusOut ∗/
   .
   .
   .
          }
}

See Also

XtAddEventHandler(1), XtAddRawEventHandler(1), XtRemoveEventHandler(1), XtRemoveRawEventHandler(1). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026