Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ EventHand(3X) — DeltaWindows 1.3.3 Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

 

NAME

XtEventHandler − interface definition for event handler procedure. 

SYNOPSIS

typedef void (∗XtEventHandler)(Widget, XtPointer, XEvent ∗, Boolean ∗);
    Widget w;
    XtPointer client_data;
    XEvent ∗event;
    Boolean ∗continue_to_dispatch_return

Inputs

wSpecifies the widget for which the handler was registered. 

client_data
Specifies data registered with this event handler.

eventSpecifies the event that triggered this call. 

Outputs

continue_to_dispatch_return
Returns a Boolean indicating whether to call the remaining event handlers that are registered for the current event.

DESCRIPTION

An XtEventHandler is registered with XtAddEventHandler(), XtAddRawEventHandler(), XtInsertEventHandler(), or XtInsertRawEventHandler().  It is called when one of the events that it was registered to handle occurs on the widget it was registered for. 

An XtEventHandler should do whatever processing is necessary for the widget or application to handle the event event that occurred on widget w.  The client_data argument can be arbitrary data registered with the event handler procedure.  It is cast to an XtPointer when registered and should be cast back to the appropriate type within the event handler. 

The continue_to_dispatch_return is the address of a Boolean variable which is intialized to True by the Intrinsics before the event handler is called.  If a handler sets this variable to False, then no more handlers will be dispatched for the event.  Doing this may lead to portability problems because implementations of the Intrinsics are allowed to add event handlers for any widget at any time.  If you prevent these potential "invisible" event handlers from receiving events, the Intrinsics are not guaranteed to behave as expected. 

USAGE

Most widgets and applications do not need to use event handlers explicitly.  Instead they can use translation tables and action procedures. 

EXAMPLE

The procedure below is an event handler from the xmag client.  It is a special handler that follows the location of the mouse while it is dragged with the button down and a pointer grab is in effect.   When the button is released, it magnifies a new area of the screen, releases the pointer grab, and calls XtRemoveEventHandler() on itself.  /∗
 ∗ ResizeEH() -- Event Handler for resize of selection box.
 ∗/ static void ResizeEH(w, closure, event, continue_to_dispatch)       /∗ ARGSUSED ∗/
     Widget w; XtPointer closure; XEvent ∗event; Boolean ∗continue_to_dispatch; {
  hlPtr data = (hlPtr)closure;
  switch (event->type) {
  case MotionNotify:
    data->x = event->xmotion.x_root;
    data->y = event->xmotion.y_root;
    break;
  case ButtonRelease:
    GetImageAndAttributes(FindWindow(event->xmotion.x_root,
                        event->xmotion.y_root),
             min(data->homeX,event->xbutton.x_root),
             min(data->homeY,event->xbutton.y_root),
             abs(data->homeX - event->xbutton.x_root),
             abs(data->homeY - event->xbutton.y_root),
             data);
    if (data->newScale)
      PopupNewScale(data);
    else
      SWSetImage(data->scaleInstance, data->image);
    XtUngrabPointer(w, CurrentTime);
    XtRemoveEventHandler(w, PointerMotionMask|ButtonReleaseMask,
                         True, ResizeEH, (XtPointer)data);
    data->selectMode = done;
    break;
  } } This event handler is registered with the following code, invoked when the user presses mouse button 2. 
    XtAddEventHandler(w, PointerMotionMask|ButtonReleaseMask,
                      True, ResizeEH, (XtPointer)data);

SEE ALSO

XtAddEventHandlerUNIX SYSTEM V/68, XtAddRawEventHandlerUNIX SYSTEM V/68, XtAppAddActionsUNIX SYSTEM V/68, XtRemoveEventHandlerUNIX SYSTEM V/68, XtRemoveRawEventHandlerUNIX SYSTEM V/68. 

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