GNOME Bugzilla – Bug 740640
Zero-sized widgets
Last modified: 2018-02-06 11:51:43 UTC
currently, GtkWidget imposes a minimum size of 1x1 to the allocation. this minimum size was needed because X windows cannot have a size of 0; thus, GdkWindow cannot have a size of 0; thus all GTK widgets must have a minimum size of 1x1. we don't create GdkWindow for each widget, and the ones we do create are for input purposes only. yet, the 1x1 limit remained inside GtkWidget, and makes it hard to do transitions of widgets without leaving 1 pixel trails here and there. we could drop this requirement if the widget does not have any GdkWindow registered through gtk_widget_register_window(), but that would probably leave pre-3.8 code in the blind. we could also check if the widget has a window (i.e. gtk_widget_get_has_window() returns TRUE). there's also the possibility of lifting the 1x1 size limit in GdkWindow itself, and only enforce it for the X11 backend.
other backends outside of X11 will likely die if they get passed a 0x0 size to GdkWindow.move_resize() — so if we want to allow GdkWindow to have a size of 0x0 without dying we are going to end up with some nasty ad hoc checks. docs/sizing-test.txt says: > - passing 0 is allowed, and results in requisition of 1x1 > (0x0 is a permitted requisition, but equivalent to 1x1, > we use 1x1 for implementation convenience) which makes the requisition, not the allocation, have a minimum size of 1x1; in theory this gives us a bit of leeway to allow a 0x0 allocation, if we ensure that the behaviour of widgets with GdkWindows does not change — i.e. if we ensure that widgets calling gdk_window_move_resize() with allocation.width and allocation.height are not going to emit criticals and die.
*** Bug 741210 has been marked as a duplicate of this bug. ***
I guess we fixed this as much as we could in master, but it won't change for gtk3.