Window gravity caveat (or bug?)
gregory.merchan at gmail.com
Fri Feb 22 04:41:41 PST 2013
This may be obvious, but for people like me yesterday to whom it isn't:
I wrote a simple client to test my understanding of window gravity and
spent far too long looking for a bug that was not there.
Create within one window a smaller window at each corner, centered on
each edge, and in the center, with each window's window gravity set to
keep it in the corner, centered on the edge, or in the center. Resize
the parent window multiple times. Perhaps the easiest way is with an
opaquely resizing window manager. After some number of resizings, it
will be apparent that the formerly centered windows are no longer
My naïve expectation was that they would be, and I assumed I had done
something wrong or that the window managers I tried were somehow
broken. Eventually I looked for bug reports or mailing list
discussions of the matter, but never found this explanation:
Odd numbers are not divisible by 2.
In the course of resizing the parent window, the centered windows are
shifted to decreasing coordinates because of rounding. Those who
better remember the documented meaning of window gravity may laugh at
the suggestion that it would have kept an initially centered window
Anyone who wishes to rely on a centered gravity should ensure even
window dimensions and resize increments.
I assume this serves as a caveat and not a description of a bug.
More information about the xorg