Query: xteventhandler
OS: hpux
Section: 2
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
XtEventHandler() XtEventHandler() 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 w Specifies the widget for which the handler was registered. client_data Specifies data registered with this event handler. event Specifies 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 wid- get w. The client_data argument can be arbitrary data registered with the event handler procedure. It is cast to an XtPointer when regis- tered 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 pre- vent 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 XtAddEventHandler(1), XtAddRawEventHandler(1), XtAppAddActions(1), XtRemoveEventHandler(1), XtRemoveRawEventHandler(1). Xt - Event Handling XtEventHandler()
Related Man Pages |
---|
xtaddraweventhandler(3) - debian |
xtinsertraweventhandler(3) - debian |
xtremoveraweventhandler(3) - centos |
xtaddeventhandler(3) - x11r4 |
xteventhandler(2) - hpux |
Similar Topics in the Unix Linux Community |
---|
Applying data warehousing principles to event processing |