XGrabPointer is a function in Xlib (also known as libX11). XGrabPointer function actively grabs control of the pointer and returns GrabSuccess if the grab was successful.
The XGrabPointer() function actively grabs control of the pointer and returns GrabSuccess if the grab was successful. Further pointer events are reported only to the grabbing client. XGrabPointer() overrides any active pointer grab by this client. The syntax for this function is
int XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode,
keyboard_mode, confine_to, cursor, time)
Display *display;
Window grab_window;
Bool owner_events;
unsigned int event_mask;
int pointer_mode, keyboard_mode;
Window confine_to;
Cursor cursor;
Time time;
where
display Specifies the connection to the X server.
grab_window Specifies the grab window.
owner_events Specifies a Boolean value that indicates whether the pointer events are to be reported as usual or reported with respect to the grab window if selected by the event mask.
event_mask Specifies which pointer events are reported to the client. The mask is the bitwise inclusive OR of the valid pointer event mask bits.
pointer_mode Specifies further processing of pointer events. You can pass GrabModeSync or GrabModeAsync.
keyboard_mode Specifies further processing of keyboard events. You can pass GrabModeSync or GrabModeAsync.
confine_to Specifies the window to confine the pointer in or None.
cursor Specifies the cursor that is to be displayed during the grab or None.
time Specifies the time. You can pass either a timestamp or CurrentTime.
XGrabPointer()
generatesEnterNotify
andLeaveNotify
events.- If unsuccessful,
XGrabPointer()
can generateBadCursor
,BadValue
, andBadWindow
errors.
You should use this tag if your question is related to any error related to the usage of XGrabPointer()
function.