title: Capture global mouse press and release
body: <p>I'd like to capture press and separately release of button 2 of my mouse. I wanted to use xbindkeys but afaik it doesn't give me such functionality. (does it?)</p>
  
  <p>This: <a href="http://developers-blog.org/blog/default/2010/08/10/XServer-Event-Handling-C-Example" rel="nofollow">http://developers-blog.org/blog/default/2010/08/10/XServer-Event-Handling-C-Example</a> more or less explains how this stuff works when it comes to writing it on my own. However when I added ButtonPressMask I get:</p>
  
  <pre><code>func: attach_to_focuswin
  func: handle_event
  X Error of failed request:  BadAccess (attempt to access private resource denied)
    Major opcode of failed request:  2 (X_ChangeWindowAttributes)
    Serial number of failed request:  8
    Current serial number in output stream:  8
  </code></pre>