Set window position correctly on X
<p>Simple question: how do I set the position of a window in X11 taking into account any window manager added decoration?</p>

<p>I'm aware that when I create a window the window manager will wrap it in another window so that if I want to get the "true" position of the window I have to do something like this</p>

<pre><code>XGetGeometry(dpy, win, &amp;root, &amp;oldx, &amp;oldy, &amp;w, &amp;h, &amp;bw, &amp;depth);
XTranslateCoordinates(dpy, win, root, oldx, oldy, &amp;newx, &amp;newy, &amp;c);
</code></pre>

<p>How, then, do I correctly use <code>XMoveWindow()</code> to move a window so that <code>newx</code> and <code>newy</code> are what I want?</p>

<p>Thanks.</p>