title: Xlib: XGetWindowAttributes always returns 1x1?
body: <p>I'd like to have width and height of the currently focussed window. The selection of the window works like a charm whereas the height and width are <strong>always</strong> returning 1.</p>
  
  <pre><code>#include &lt;X11/Xlib.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(int argc, char *argv[])
  {
      Display *display;
      Window focus;
      XWindowAttributes attr;
      int revert;
  
      display = XOpenDisplay(NULL);
      XGetInputFocus(display, &amp;focus, &amp;revert);
      XGetWindowAttributes(display, focus, &amp;attr);
      printf("[0x%x] %d x %d\n", (unsigned)focus, attr.width, attr.height);
  
      return 0;
  }
  </code></pre>
  
  <p>Is this not the "real" window but the currently active component (like a textbox or a button?) And why would it have the size of 1x1 anyways then? If this is the case, how do i get the main window of the application containig this control? Means... kinda the top-level window, the top-most window except the root window.</p>
  
  <p>PS: Don't know whether it's really important; I use Ubuntu 10.04 32 and 64 bit.</p>