title: Creating InputOnly window
body: <p>I want to create "InputOnly" window which should be invisible and taking input, but when running code bellow, my InputOnly window does get any event.
  I want to have my focus on other window and still getting input. How can I achieve it?</p>
  
  <pre><code>#include &lt;X11/Xlib.h&gt;
  #include &lt;iostream&gt;
  
  int main(void) {
      Display *dsp;
      Window root;
      Window windows[2];
      XEvent ev; 
      int i = 0;
  
      dsp = XOpenDisplay(NULL);
      root = RootWindow(dsp, DefaultScreen(dsp));
  
      windows[i] = XCreateSimpleWindow(
          dsp,
          root,
          0, 0, 200, 200,
          1,
          BlackPixel(dsp, DefaultScreen(dsp)),
          WhitePixel(dsp, DefaultScreen(dsp))
      );
      XSelectInput(dsp, windows[i], 0);
      XMapWindow(dsp, windows[i]);
  
      ++i;
  
      XSetWindowAttributes at;
      at.event_mask = KeyPressMask;
      windows[i] = XCreateWindow(
          dsp,
          root,
          10,10,200,200,
          0,
          CopyFromParent,
          InputOnly,
          0,
          0,
          &amp;at
      );
      XSelectInput(dsp, windows[i], KeyPressMask);
      //XMapWindow(dsp, windows[i]);
  
      while(1) {
          XNextEvent(dsp, &amp;ev);
          std::cout &lt;&lt; "foo" &lt;&lt; std::endl;
      }   
      return 0;
  }
  </code></pre>