gtk_window_set_geometry_hints woes



Hi folks,

I am trying to put together a simple game board window, which packs the
game board on the left and a button panel on the right.  The top-level
container within the window is an HBox.  First child of the HBox is the
game board, second child is a VBox containing all the buttons.  The game
board is set to occupy the available space as the HBox gets resized.  My
goal is to ensure that the top-level window can only be resized to shapes
that ensure the game board has an aspect ratio of 1 (i.e., is a square).
Now, as I understand the documentation of gtk_window_set_geometry_hints,
the following should just do this:

GdkGeometry geom;

geom.min_aspect = geom.max_aspect = 1;
gtk_window_set_geometry_hints(GTK_WINDOW(main_window), board, &geom,
GDK_HINT_ASPECT);

However, no matter what I do, whether I do the above when the window gets
created or in response to a "realize" signal, whether I provide board or
main_window as the second argument, the result is always that the
main_window itself is constrained to a square aspect ratio, which due to
the button panel means that the board is not square.  Any pointers as to
what I'm doing wrong?

I can put the entire code on pastebin if necessary.

Thanks,
Norbert


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]