xselectinput(3x) [hpux man page]
XSelectInput() XSelectInput() Name XSelectInput - select the event types to be sent to a window. Synopsis XSelectInput(display, w, event_mask) Display *display; Window w; long event_mask; Arguments display Specifies a connection to an X server; returned from XOpenDisplay(). w Specifies the ID of the window interested in the events. event_mask Specifies the event mask. This mask is the bitwise OR of one or more of the valid event mask bits (see below). Description XSelectInput() defines which input events the window is interested in. If a window is not interested in a device event (button, key, motion, or border crossing), it propagates up to the closest ancestor unless otherwise specified in the do_not_propagate_mask attribute. The bits of the mask are defined in <X11/X.h> : ButtonPressMask NoEventMask ButtonReleaseMask KeyPressMask EnterWindowMask KeyReleaseMask LeaveWindowMask ExposureMask PointerMotionMask VisibilityChangeMask PointerMotionHintMask StructureNotifyMask Button1MotionMask ResizeRedirectMask Button2MotionMask SubstructureNotifyMask Button3MotionMask SubstructureRedirectMask Button4MotionMask FocusChangeMask Button5MotionMask PropertyChangeMask ButtonMotionMask ColormapChangeMask KeymapStateMask OwnerGrabButtonMask A call on XSelectInput() overrides any previous call on XSelectInput() for the same window from the same client but not for other clients. Multiple clients can select input on the same window; their event_mask window attributes are disjoint. When an event is generated it will be reported to all interested clients. However, only one client at a time can select for each of SubstructureRedirectMask, ResizeRedirect- Mask, and ButtonPress. If a window has both ButtonPressMask and ButtonReleaseMask selected, then a ButtonPress event in that window will automatically grab the mouse until all buttons are released, with events sent to windows as described for XGrabPointer(). This ensures that a window will see the ButtonRelease event corresponding to the ButtonPress event, even though the mouse may have exited the window in the meantime. If PointerMotionMask is selected, events will be sent independent of the state of the mouse buttons. If instead, one or more of But- ton1MotionMask, Button2MotionMask, Button3MotionMask, Button4MotionMask, or Button5MotionMask is selected, MotionNotify events will be gen- erated only when one or more of the specified buttons is depressed. XCreateWindow() and XChangeWindowAttributes() can also set the event_mask attribute. For more information, see Volume One, Chapter 8, Events. Errors BadValue Specified event mask invalid. BadWindow See Also XQLength(), XAllowEvents(), XCheckIfEvent(), XCheckMaskEvent(), XCheckTypedEvent(), XCheckTypedWindowEvent(), XCheckWindowEvent(), XEventsQueued(), XGetInputFocus(), XGetMotionEvents(), XIfEvent(), XMaskEvent(), XNextEvent(), XPeekEvent(), XPeekIfEvent(), XPending(), XPutBackEvent(), XSendEvent(), XSetInputFocus(), XSynchronize(), XWindowEvent(). Xlib - Input Handling XSelectInput()
Check Out this Related Man Page
XtAddEventHandler() XtAddEventHandler() Name XtAddEventHandler - register a procedure to be called when specified events occur on a widget. Synopsis void XtAddEventHandler(w, event_mask, nonmaskable, proc, client_data) Widget w; EventMask event_mask; Boolean nonmaskable; XtEventHandler proc; XtPointer client_data; Inputs w Specifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof. event_mask Specifies the event type that will trigger the handler. nonmaskable Specifies whether this procedure should be called on nonmaskable event types. proc Specifies the handler procedure. client_data Specifies additional data to be passed to the event handler. Description XtAddEventHandler() registers the procedure proc and the data client_data with the Intrinsics event dispatching mechanism. When an event of one of the types set in event_mask occurs on the window of the widget w, proc will be invoked and client_data passed as one of its argu- ments. If the window of the widget is not already receiving events of the specified types, XtAddEventHandler() calls XSelectInput() to ensure that they will be delivered. Additionally, if the handler is registered with the nonmaskable argument True, then it will also be invoked when any of the nonmaskable event types occur. These events are GraphicsExpose, NoExpose, SelectionClear, SelectionRequest, Selec- tionNotify, ClientMessage, and MappingNotify. Ordinarily, nonmaskable events are of interest only to the Intrinsics. If the specified procedure/data pair has already been registered for this widget, then the event_mask argument augments the event mask already registered for the handler, and the procedure will only be called once for any particular event. The same procedure may be regis- tered multiple times with different values of client_data, and each instance will be treated as a separate handler. See XtEventHandler(2) for an explanation of how to write an event handler procedure. Usage Neither applications nor widgets often need to use event handlers. Using action procedures and translation tables provides a more flexible way to respond to input events. The Intrinsics do not specify the order in which event handlers will be called when an event arrives. As of Release 4, however, the func- tion XtInsertEventHandler() will register an event handler that will be called before or after all previously registered handlers. An event handler can be removed with XtRemoveEventHandler(). Structures Each of the event mask symbols listed in the table below set a single bit in an event mask. The event_mask argument is formed by combining these symbols with the bitwise OR operator ( ). Note that the nonmaskable event types do not appear in this table and cannot be requested in an event mask. NoEventMask Button1MotionMask StructureNotifyMask KeyPressMask Button2MotionMask ResizeRedirectMask KeyReleaseMask Button3MotionMask SubstructureNotifyMask ButtonPressMask Button4MotionMask SubstructureRedirectMask ButtonReleaseMask Button5MotionMask FocusChangeMask EnterWindowMask ButtonMotionMask PropertyChangeMask LeaveWindowMask KeymapStateMask ColormapChangeMask PointerMotionMask ExposureMask OwnerGrabButtonMask PointerMotionHintMask VisibilityChangeMask See Appendix C, Event Reference, for more information on event types and masks. See Also XtAddRawEventHandler(1), XtInsertEventHandler(1), XtRemoveEventHandler(1), XtEventHandler(2). Xt - Event Handling XtAddEventHandler()