GNOME Bugzilla – Bug 646500
GTK+ 3.1 causes terminals to start up with 0 height
Last modified: 2011-04-04 17:07:21 UTC
Created attachment 184920 [details] screenshot of terminal with GTK+ 3.0.7 Reverting to 3.0.6 fixes this.
Bisected that down to http://git.gnome.org/browse/gtk+/commit/?id=edb44589 So this one looks like Tristan's job.
Oh yeah, it's not just happening on 3.0, it's also still in master.
It turns out that adding static GtkSizeRequestMode vte_terminal_get_request_mode (GtkWidget *widget) { return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH; } to VteTerminal fixes things. Not sure that's expected, considering VteTerminal is not actually doing hfw. Tristan ?
alo this breaks gdm http://paste.xinu.at/dMh31/
correction, it crashes the greeter
better log with debug symbols. the commit from comment 1 is not the cause of the crash and i cannot revert the other two commits made by Tristan http://git.gnome.org/browse/gtk+/log/gtk/gtksizerequest.c?h=gtk-3-0 http://paste.xinu.at/U3s/
(In reply to comment #4) > alo this breaks gdm > This is bug 646498
I've reverted the problematic commits in 3.0 now. Going to do a 3.0.8 release soon.
*** Bug 646611 has been marked as a duplicate of this bug. ***
Created attachment 185054 [details] [review] Fixes gnome-terminal with height-for-width optimizations This patch makes gtk_widget_get_preferred_size() treat CONSTANT_SIZE specially. However interestingly, this could seemingly should not be needed, since the width_for_height() apis fall back on get_preferred_width() anyway in the case of CONSTANT_SIZE. Further tests show that if we query the height before the width, gnome-terminal shows the same bug again.
(In reply to comment #3) > It turns out that adding > > static GtkSizeRequestMode > vte_terminal_get_request_mode (GtkWidget *widget) > { > return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH; > } > > to VteTerminal fixes things. Not sure that's expected, considering VteTerminal > is not actually doing hfw. This was causing the request mode for the interface to be height-for-width, which as you say should change nothing because no height-for-width calculations are done here. However it does change that GtkWidgetClass.get_preferred_width() is called before GtkWidgetClass.get_preferred_height(). It seems in this case something is breaking simply because the height is queried before the width... trying to track the reason for that now.
Ok, I dont have an immediate fix. But the root cause of this story is that gtk_widget_override_size_request() is broken in some way. I pushed 0b8a1dcac252b3af1bf1c90721f35092ffa04448 today which masks the problem, running gnome-terminal with GTK+ master should appear right, however it's probably off by some pixels in height, and now you get the warning message from gtk_window_compute_hints() g_warning("Toplevel size doesn't seem to directly depend on the " "size of the geometry widget from gtk_window_set_geometry_hints(). " "The geometry widget might not be in the window, or it might not " "be packed into the window appropriately"); By adding some trace before and after the calls to override_size_request() and gtk_widget_get_preferred_size()... and by running with GTK_DEBUG=size-request, I was able to confirm that the call to gtk_widget_get_preferred_size() on the toplevel hits the cache for the "height" but not for the "width" for whatever reason. That code in gtk_window_compute_hints() forces the "geometry widget" to be large (10000x10000 pixels), so essentially what happens is the terminal's toplevel returns a cached height of 50 or so pixels (the minimum height) and then the 10000 pixels difference is subtracted... the remaining "-9950" or so pixels becomes the "base height" of the GdkGeometry structure and things go badly (the window gets allocated a small height). I'm currently not completely sure of the intentions behind the function gtk_widget_override_size_request() and I'm not sure exactly how it is to be fixed... I did try replacing the override/restore calls with direct calls to gtk_widget_set/get_size_request(), for some reason this causes some infinite recursion.
Fixed, after all that running around it turned out to be the cache was not getting correctly invalidated in the case that height is queried before width, whatever gtk_widget_override_size_request() is doing is not the problem (was just a silly typo on gtksizerequest.c). commit d4021d7a1b88d8c649029285ee8f0968d8992243 Author: Tristan Van Berkom <tristan.van.berkom@gmail.com> Date: Mon Apr 4 13:58:05 2011 +0900 Fixed bug in GtkSizeRequest code where the cache is not reset properly Fixes this bug https://bugzilla.gnome.org/show_bug.cgi?id=646500 Fixed in master, closing bug and would like to get this fix back into 3.0.x if possible.