After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 646500 - GTK+ 3.1 causes terminals to start up with 0 height
GTK+ 3.1 causes terminals to start up with 0 height
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 646611 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-04-02 01:03 UTC by Christopher Aillon
Modified: 2011-04-04 17:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot of terminal with GTK+ 3.0.7 (7.57 KB, image/png)
2011-04-02 01:03 UTC, Christopher Aillon
  Details
Fixes gnome-terminal with height-for-width optimizations (1.13 KB, patch)
2011-04-03 17:52 UTC, Tristan Van Berkom
none Details | Review

Description Christopher Aillon 2011-04-02 01:03:48 UTC
Created attachment 184920 [details]
screenshot of terminal with GTK+ 3.0.7

Reverting to 3.0.6 fixes this.
Comment 1 Benjamin Otte (Company) 2011-04-02 01:06:20 UTC
Bisected that down to http://git.gnome.org/browse/gtk+/commit/?id=edb44589

So this one looks like Tristan's job.
Comment 2 Benjamin Otte (Company) 2011-04-02 01:06:44 UTC
Oh yeah, it's not just happening on 3.0, it's also still in master.
Comment 3 Matthias Clasen 2011-04-02 03:24:48 UTC
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 ?
Comment 4 Ionut Biru 2011-04-02 10:03:18 UTC
alo this breaks gdm

http://paste.xinu.at/dMh31/
Comment 5 Ionut Biru 2011-04-02 10:15:53 UTC
correction, it crashes the greeter
Comment 6 Ionut Biru 2011-04-02 10:52:07 UTC
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/
Comment 7 Benjamin Otte (Company) 2011-04-02 10:55:10 UTC
(In reply to comment #4)
> alo this breaks gdm
> 
This is bug 646498
Comment 8 Matthias Clasen 2011-04-02 21:53:57 UTC
I've reverted the problematic commits in 3.0 now. Going to do a 3.0.8 release soon.
Comment 9 Olav Vitters 2011-04-03 11:43:06 UTC
*** Bug 646611 has been marked as a duplicate of this bug. ***
Comment 10 Tristan Van Berkom 2011-04-03 17:52:28 UTC
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.
Comment 11 Tristan Van Berkom 2011-04-03 18:05:33 UTC
(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.
Comment 12 Tristan Van Berkom 2011-04-03 21:33:56 UTC
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.
Comment 13 Tristan Van Berkom 2011-04-04 17:07:21 UTC
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.