title: Locking mouse pointer using xGrabPointer in Linux
body: <p>I am using <code>X11</code> to get mouse position when the mouse button is pressed in a application which runs on terminal without any window.</p>
  
  <p><strong>Getting Mouse Position :</strong> </p>
  
  <pre><code>Display *dpy;
  Window root, child;
  int rootX, rootY, winX, winY;
  unsigned int mask;
  dpy = XOpenDisplay(NULL);
  XQueryPointer(dpy,DefaultRootWindow(dpy),&amp;root,&amp;child,
               &amp;rootX,&amp;rootY,&amp;winX,&amp;winY,&amp;mask);
  </code></pre>
  
  <p>Now I want to use <code>XGrabPointer()</code> to lock the mouse so that it does not interact with objects(windows , icons and docks ) present on desktop . <a href="http://tronche.com/gui/x/xlib/input/XGrabPointer.html" rel="nofollow">here</a> is the documentation of XGrabPointer , but I don't seem to understand how to use it and what arguments to pass . </p>