I can't find how to do that :( there's gtk_window_set_resizable, but it disables resizing at all and i still want my window to resize horizontally. Any ideas?
I believe you can try using gtk_window_set_geometry_hints function and specify max and min height for your window. In this case you would still allow width change whereas height will stay constant. Pls, check if an example below would work for you:
int main(int argc, char * argv[])
{
gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GdkGeometry hints;
hints.min_width = 0;
hints.max_width = gdk_screen_get_width(gtk_widget_get_screen(window));;
hints.min_height = 300;
hints.max_height = 300;
gtk_window_set_geometry_hints(
GTK_WINDOW(window),
window,
&hints,
(GdkWindowHints)(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE));
gtk_widget_show_all(window);
gtk_main();
return 0;
}
hope this helps, regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With