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
displaySpecifies a connection to an X server; returned from XOpenDisplay().
wSpecifies 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
ButtonReleaseMask
EnterWindowMask
LeaveWindowMask
PointerMotionMask
PointerMotionHintMask
Button1MotionMask
Button2MotionMask
Button3MotionMask
Button4MotionMask
Button5MotionMask
ButtonMotionMask
KeymapStateMask
NoEventMask
KeyPressMask
KeyReleaseMask
ExposureMask
VisibilityChangeMask
StructureNotifyMask
ResizeRedirectMask
SubstructureNotifyMask
SubstructureRedirectMask
FocusChangeMask
PropertyChangeMask
ColormapChangeMask
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, ResizeRedirectMask, 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 Button1MotionMask, Button2MotionMask, Button3MotionMask, Button4MotionMask, Button5MotionMask is selected, MotionNotify events will be generated 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
BadValueSpecified event mask invalid.
BadWindow
See Also
QLength(), XAllowEvents(), XCheckIfEvent(), XCheckMaskEvent(), XCheckTypedEvent(), XCheckTypedWindowEvent(), XCheckWindowEvent(), XEventsQueued(), XGetInputFocus(), XGetMotionEvents(), XIfEvent(), XMaskEvent(), XNextEvent(), XPeekEvent(), XPeekIfEvent(), XPending(), XPutBackEvent(), XSendEvent(), XSetInputFocus(), XSynchronize(), XWindowEvent.
Copyright O’Reilly & Assoc. —