GNOME Bugzilla – Bug 747584
Using gtk_window_set_geometry_hints() to set a fixed aspect ratio makes GtkWindow shrink to 1x1
Last modified: 2018-05-02 16:31:46 UTC
Created attachment 301236 [details] 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
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
https://gitlab.gnome.org/GNOME/gtk/issues/164 may be a dupe
Resolving NEEDINFO.
Created attachment 370666 [details] edited test case by Rafał Mużyło who wrote at the aforementioned GitLab Issue: "Attached is a trimmed down copy of the testcase from that bug. Trimming down is mostly due to the problem being identified wrong in that bug. See the commented line: for window size 160x32, aspect of 3.0 makes the window shrink into 1x1 for the same size, aspect of 3.01 makes the window size itself correctly Chances are it's window manager dependent, so openbox 3.6.1. gtk+-3.22.19"
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/546.