A client can monopolise the keyboard and pointer but if at all possible
you should avoid doing this. If you have selected both ButtonPress and
ButtonRelease in a window, then X will `grab' the pointer after the
ButtonPress event until the button is released.
XGrabServer(display) /* the server will buffer up requests from */
/* all other client programs */
XUngrabServer(display) /* allow execution of other client's requests */
XSetInputFocus(display,focus,revert_to,time)/* keybd events go to window*/
Window focus; /* is in if it is a decendent of the focus */
int revert_to; /*RevertToParent,RevertToPointerRoot,RevertToNone
if the window becomes non- viewable. */
Time time; /* timestamp or CurrentTime */
/* window, otherwise they are sent to the focus window itself*/
/* the RootWindow is the default focus window */
XGetInputFocus(display,focus,revert_to)
Window *focus; /* RETURNS ID of focus window */
int *revert_to; /*RevertToParent,RevertToPointerRoot,RevertToNone*/
/* GRAB ALL MOUSE EVENTS for those of the clients windows */
Status XGrabPointer(display,w,owner_events,event_mask,
pointer_mode,keyboard_mode,confine_to,cursor,time)
Window w; /* SelectInput suitably else send here if */
/* normal window has not called SelectInput */
Bool owner_events; /*If False then all pointer events selected by
the mask are reported with respect to grab_window.
If True then pointer events that would normally
have been reported are reported as usual,
otherwise as in False */
unsigned int event_mask;/* always augmented with ButtonPressMask and
ButtonReleaseMask*/
int pointer_mode,keyboard_mode; /*If GrabModeAsync then event
processing continues normally.
If GrabModeSync the pointer/keyboard
appears to freeze until XAllowEvents
is called */
Window confine_to; /* if pointer isn't initially in this window
then it's warped into it */
Cursor cursor; /* temporary cursor to use */
Time time; /* either a timestamp or CurrentTime */
XUngrabPointer(display,time) /* UNDO THE EFFECT OF XGrabPointer */
Time time; /* either a timestamp or CurrentTime */
/* GRAB THE MOUSE WHENEVER A PARTICULAR COMBINATION OF */
/* MOUSE BUTTONS AND KEYBOARD KEYS ARE PRESSED */
Status XGrabButton(display,button,modifiers,w,owner_events,event_mask,
pointer_mode,keyboard_mode,confine_to,cursor,time)
unsigned int buttons;
unsigned int modifiers;
Window w; /* window for events which are excluded by */
/* SelectInput from the window they would normally go to */
Bool owner_events;
unsigned int event_mask;
int pointer_mode,keyboard_mode;
Window confine_to;
Cursor cursor; /* temporary cursor to use */
XUngrabButton(display,button,modifiers,w) /* UNDO XGrabButton */
unsigned int buttons;
unsigned int modifiers;
Window w; /* window for events which are excluded by */