On Sat, Oct 25, 2014 at 5:15 AM, Lucas Levrel <llev...@yahoo.fr> wrote:
> Le 24 octobre 2014, Norbert Zeh a écrit : > > 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. >> > > From the name it looks like gtk_window_set_geometry_hints works on > windows. Your constraint results in a variable aspect ratio for the window; > it means the system would have to compute an aspect ratio for each cursor > position during window resizing. I've never seen any app doing this, > especially video players which would be a perfect candidate for this > feature, so I guess it's impossible. > > Just my 2 ¢. Except that the documentation for the function says exactly the opposite ... and terminal emulators use exactly this feature, not to constrain the aspect ratio but to ensure the window gets resized only in increments of the character size, and of course they need to ensure the widget whose size is a multiple of the character dimensions is not the main window but the terminal's text area. In any case, here's what the documentation for gtk_window_set_geometry_hints has to say: void gtk_window_set_geometry_hints (GtkWindow *window, GtkWidget *geometry_widget, GdkGeometry *geometry, GdkWindowHints geom_mask); This function sets up hints about how a window can be resized by the user. You can set a minimum and maximum size; allowed resize increments (e.g. for xterm, you can only resize by the size of a character); aspect ratios; and more. See the GdkGeometry struct. Parameters: window - a GtkWindow geometry_widget - widget the geometry hints will be applied to geometry - struct containing geometry information geom_mask - mask indicating which struct fields should be paid attention to So, this seems to be doable and xfce4-terminal and roxterm do use gtk_window_set_geometry_hints with their terminal area to constrain the window size. Cheers, Norbert _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list