Questions tagged [xgrabpointer]

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() generates EnterNotify and LeaveNotify events.
  • If unsuccessful, XGrabPointer() can generate BadCursor, BadValue, and BadWindow errors.

You should use this tag if your question is related to any error related to the usage of XGrabPointer() function.

4 questions
14
votes
1 answer

X11: How do I REALLY grab the mouse pointer?

I've implemented a horizontal splitter widget in Xlib. I'm trying to grab the mouse when the user clicks & drags on the splitter bar (so that the user can dynamically move the split & thus resize the windows on either side of the splitter…
Drew Hall
  • 28,429
  • 12
  • 61
  • 81
2
votes
2 answers

X11 XGrabPointer, how do I clear all the events before I release the mouse?

I am able to grab the mouse, but my problem is that the mouse events that happen while the mouse is grabbed are just queued, and happen after I release the mouse. this is the code I have until now: #include #include…
itayrabin
  • 398
  • 1
  • 2
  • 12
1
vote
1 answer

How to capture the pointermotion event and limit the pointer in an area?

I'm running two fullscreen apps on two monitors on Ubuntu 16.10. app1 needs the pointer and must be focused all time, so I need to lock the pointer in app1. I had written a tool to grab the pointer like this: #include #include…
user6731513
  • 21
  • 1
  • 5
1
vote
1 answer

Locking mouse pointer using xGrabPointer in Linux

I am using X11 to get mouse position when the mouse button is pressed in a application which runs on terminal without any window. Getting Mouse Position : Display *dpy; Window root, child; int rootX, rootY, winX, winY; unsigned int mask; dpy =…
rajat
  • 3,415
  • 15
  • 56
  • 90