XSelectInput()XSelectInput()NameXSelectInput – 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).
DescriptionXSelectInput() 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, 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 But‐
ton1MotionMask, Button2MotionMask, Button3MotionMask, Button4Motion‐
Mask, or 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
BadValue Specified event mask invalid.
BadWindow
See AlsoXQLength(), XAllowEvents(), XCheckIfEvent(), XCheckMaskEvent(), XCheck‐
TypedEvent(), XCheckTypedWindowEvent(), XCheckWindowEvent(),
XEventsQueued(), XGetInputFocus(), XGetMotionEvents(), XIfEvent(),
XMaskEvent(), XNextEvent(), XPeekEvent(), XPeekIfEvent(), XPending(),
XPutBackEvent(), XSendEvent(), XSetInputFocus(), XSynchronize(), XWin‐
dowEvent().
Xlib - Input Handling XSelectInput()