This doesn't quite achieve what I want as it does not constrain the
geometry of the main window.  In order to ensure its child has a fixed
aspect ratio, the GtkAspectFrame introduces horizontal or vertical padding
if its own aspect ratio is different.  The ability to provide a geometry
widget to gtk_window_set_geometry_hints seems to be designed to solve
exactly the problem I'm facing, except it doesn't have the desired effect.

Cheers,
Norbert

On Fri, Oct 24, 2014 at 8:47 PM, Phil Wolff <adia...@centurylink.net> wrote:

> Look at using GtkAspectFrame as the first HBox child, and put your game
> board in it.
>
>
> On 10/24/2014 02:52 PM, Norbert Zeh wrote:
>
>> 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
>> _______________________________________________
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>
> --
> If sunbeams were weapons of war, we would have had solar energy centuries
> ago.
>     -- George Porter
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to