I am trying to port XBoard to GTK, and I encountered some very weird GTK behavior (on Ubunto 10.04) concerning the automatic positioning of a drawing-area widget inside its container:
XBoard always draws the chess-board (with a fixed size) in the upper-left corner of the drawing-area widget, so I can see where that is. When I resize the window by hand to make it wider, but vertically it is an exact fit, the board is centered horizontally (equal left ad right blank margins next to it). When there is an exact horizontal fit, and I make the window higher, it centers it vertically. So far so good; apparently the drawing-area widget is centered in the vbox.
But now starts the weirdness:
When the window is of exactly the right width, but too high, so that there are equal blank top and bottom margins above and below the board, and I start to make the window wider, the chess board remains touching the left window edge, but moves up. It continues moving up until it reaches the upper-right corner. If I continue to make the window wider, it then turns the corner, and starts moving horizontally (touching the upper edge of the space available for it).
It seems like what is intended to be added to the left margin is in fact subtracted from the top margin, and vice versa. Is this a known GTK bug? If so, what is the work-around?
(For those who want to see it with their own eyes: this occurs in the secondary board window of XBoard 4.7.0, which appears when you observe two games on FICS simultaneously.)Widening the window moves the board right, heigtening it moves it leftuntil it hits the edge, then down.