Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xteventhandler(3) [hpux man page]

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()

Check Out this Related Man Page

XtAddEventHandler(3)						   XT FUNCTIONS 					      XtAddEventHandler(3)

NAME
XtAddEventHandler, XtAddRawEventHandler, XtRemoveEventHandler, XtRemoveRawEventHandler, XtInsertEventHandler, XtInsertRawEventHandler - add and remove event handlers SYNTAX
void XtAddEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer client_data); void XtAddRawEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer client_data); void XtRemoveEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer client_data); void XtRemoveRawEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer client_data); void XtInsertEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer client_data, XtListPosition position); void XtInsertRawEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer client_data, XtListPosi- tion position); typedef enum { XtListHead, XtListTail } XtListPosition; ARGUMENTS
client_data Specifies additional data to be passed to the client's event handler. event_mask Specifies the event mask for which to call or unregister this procedure. nonmaskable Specifies a Boolean value that indicates whether this procedure should be called or removed on the nonmaskable events (Graphic- sExpose, NoExpose, SelectionClear, SelectionRequest, SelectionNotify, ClientMessage, and MappingNotify). proc Specifies the procedure that is to be added or removed. w Specifies the widget for which this event handler is being registered. position Specifies when the event handler is to be called relative to other previously registered handlers. DESCRIPTION
The XtAddEventHandler function registers a procedure with the dispatch mechanism that is to be called when an event that matches the mask occurs on the specified widget. If the procedure is already registered with the same client_data, the specified mask is ORed into the existing mask. If the widget is realized, XtAddEventHandler calls XSelectInput, if necessary. The XtAddRawEventHandler function is similar to XtAddEventHandler except that it does not affect the widget's mask and never causes an XSe- lectInput for its events. Note that the widget might already have those mask bits set because of other nonraw event handlers registered on it. The XtRemoveRawEventHandler function stops the specified procedure from receiving the specified events. Because the procedure is a raw event handler, this does not affect the widget's mask and never causes a call on XSelectInput. XtInsertEventHandler is identical to XtAddEventHandler with the additional position argument. if position is XtListHead, the event handler is registered to that it will be called before any event handlers that were previously registered for the same widget. If position is XtListTail, the event handler is registered to be called after any previously registered event handlers. If the procedure is already regis- tered with the same client_data value, the specified mask augments the existing mask and the procedure is repositioned in the list. XtInsertRawEventHandler is similar to XtInsertEventHandler except that it does not modify the widget's event mask and never causes an XSe- lectInput for the specified events. If the procedure is already registered with the same client_data value, the specified mask augments the existing mask and the procedure is repositioned in the list. SEE ALSO
XtAppNextEvent(3), XtBuildEventMask(3) X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.1.3 XtAddEventHandler(3)
Man Page