Using gtk_window_set_geometry_hints() to set a fixed aspect ratio makes GtkWindow shrink to 1x1
Submitted by zeb..@..il.com
Link to original bug (#747584)
Description
Created attachment 301236 A minimal working example of the bug
I have a piece of software that uses gtk_window_set_geometry_hints to set a fixed (1:1) aspect ratio for a window. This worked until I updated from 3.12 to 3.14. It now produces a 0-size window that cannot be resized properly. Rather than showing a window normally, it resizes to become very small. Attempts to resize it have resulted in the window refusing to change size, becoming very large, and in one case locking up the window manager.
I tracked the issue down to a minimal working example (the attached code), in which an aspect range of 0.5-2.0 works fine, but a range of 1.0-1.0 does not.
Using geometry hints to impose a minimum and maximum size works, but the window cannot be set to anything other than the two extremes.
Interestingly, on the working version, horizontally-constrained resizing (tall window) works smoothly, while vertically-constrained resizing (wide window) resizes in an unstable and shaky manner.
I've attached a piece of example code demonstrating the bug. Compile normally to get the working version, with -D FIXED_ASPECT to get the broken 1:1 version.
Reproduction instructions:
Compile attached code with
gcc -D FIXED_ASPECT -o gtkTest gtkTest.c pkg-config --cflags gtk+-3.0
pkg-config --libs gtk+-3.0
Run executable
Expected results: A 200x200 window that can be resized with 1:1 aspect ratio
Actual results: A tiny window that cannot be resized
Bonus: compile with
gcc -o gtkTest gtkTest.c pkg-config --cflags gtk+-3.0
pkg-config --libs gtk+-3.0
to get a version that mostly resizes correctly.
System: Gentoo, kernel 3.10.25, gcc (Gentoo 4.8.3 p1.1, pie-0.5.9) 4.8.3 gtk+3.14.9 built with USE="X cups introspection xinerama (-aqua) -broadway -cloudprint -colord -debug -examples {-test} -vim-syntax -wayland
Attachment 301236, "A minimal working example of the bug":
gtkTest.c
Version: 3.22.x