title: X11 restrict mouse to visible area
body: <p>I am currently running Linux Mint 17.2 with Cinnamon. I have 2 monitors.</p>
  
  <p>When I set monitors to be adjacent in Cinnamon settings, mouse freely moves through border shared between monitors but cannot escape visible area.</p>
  
  <p>That is, if I set monitors to share only corner, mouse is effectively locked to current monitor and can escape to another only through corner.</p>
  
  <p>However, setting monitors to be non-adjacent allows mouse to roam freely all over virtual framebuffer, including invisible areas.</p>
  
  <p>I thought that Cinnamon sets some flag that controls this behavior, but changing monitor position using <code>xrandr</code> has the same effect.</p>
  
  <p><em>Also, it is the same when I start plain <code>Xorg</code> with nothing but <code>xterm</code>, even without a window manager, and configure monitors using <code>xrandr</code>.</em></p>
  
  <p>What exactly stops mouse from leaving visible area when all monitors are adjacent? <strong>Is there a way to override this behavior?</strong></p>
  
  <p>Being able to control this might be useful e.g. to stop mouse from leaving monitor every time you try to click something near border, without running a busy loop that monitors mouse and moves it back if needed (and without doubling framebuffer size by making monitors be adjacent by corner).</p>
  
  <p>With more control it can be used to e.g. make mouse "reluctant" to leave current window, and maybe do other fun stuff. At least it will make it possible to reimplement <a href="https://github.com/PsiZzZ/WGrab" rel="nofollow">this thing</a> so that it can actually lock mouse to window for apps like Chrome browser or OpenGL games and not just <code>xterm</code> and the like.</p>
  
  <p>Now that I think of it, I may even try to implement it, if it is not yet and if I find relevant code.</p>