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 631903 - Report correct minimum/natural sizes for GTK+ 3
Report correct minimum/natural sizes for GTK+ 3
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks: 631797
 
 
Reported: 2010-10-11 17:27 UTC by Owen Taylor
Modified: 2010-10-11 19:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Report correct minimum/natural sizes for GTK+ 3 (4.60 KB, patch)
2010-10-11 17:27 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2010-10-11 17:27:49 UTC
In GTK+ 3, the hack of reporting the current size of the terminal
as its minimum size breaks down because GTK+ 3 will never allocate
a widget smaller than its minimum size. However, in GTK+ 3 it's
possible to report separate minimum and natural sizes, so we
should just report a minimum size of 1x1 character and a natural
size of the current size.

This requires a change in vteapp.c to make the window start off
at the right size.
Comment 1 Owen Taylor 2010-10-11 17:27:50 UTC
Created attachment 172114 [details] [review]
Report correct minimum/natural sizes for GTK+ 3
Comment 2 Christian Persch 2010-10-11 18:53:21 UTC
+	else {
+		/* As of GTK+ 2.91.0, the default size of a window comes from its minimum
+		 * size not its natural size, so we need to set the right default size
+		 * explicitly */
+		gtk_window_set_default_geometry (window,
+						 vte_terminal_get_column_count (terminal),
+						 vte_terminal_get_row_count (terminal));
+	}

Does that mean that any gtk3 app embedding a vte app will have its terminal collapse to a 1x1 grid (the minimum size that the new get_preferred_width/height funcs return) without adding code similar to this, or am I misunderstanding this comment?
Comment 3 Owen Taylor 2010-10-11 19:00:00 UTC
(In reply to comment #2)
> +    else {
> +        /* As of GTK+ 2.91.0, the default size of a window comes from its
> minimum
> +         * size not its natural size, so we need to set the right default size
> +         * explicitly */
> +        gtk_window_set_default_geometry (window,
> +                         vte_terminal_get_column_count (terminal),
> +                         vte_terminal_get_row_count (terminal));
> +    }
> 
> Does that mean that any gtk3 app embedding a vte app will have its terminal
> collapse to a 1x1 grid (the minimum size that the new
> get_preferred_width/height funcs return) without adding code similar to this,
> or am I misunderstanding this comment?

If they are sizing their toplevel in a simple way like vteapp and not a complex way like gnome-terminal. Without this change, any gtk3 app embedding a gnome-terminal will have the terminal get bigger and bigger and never smaller without regarding the size of the toplevel window. Not better and far more confusing.

If GTK+ 3 was changed to select the default toplevel size from the natural size (which probably makes sense) then this code could be removed, which is why I said "As of GTK+ 2.91.0" not "In GTK+ 3". But it will never be wrong code just unnecessary code.
Comment 4 Christian Persch 2010-10-11 19:10:17 UTC
Comment on attachment 172114 [details] [review]
Report correct minimum/natural sizes for GTK+ 3

Thanks for the explanation. Please commit to master.

(In reply to comment #3)
> If GTK+ 3 was changed to select the default toplevel size from the natural size
> (which probably makes sense) then this code could be removed

Indeed, IMHO that would be better.
Comment 5 Owen Taylor 2010-10-11 19:17:30 UTC
(In reply to comment #4)
> (From update of attachment 172114 [details] [review])
> Thanks for the explanation. Please commit to master.
> 
> (In reply to comment #3)
> > If GTK+ 3 was changed to select the default toplevel size from the natural size
> > (which probably makes sense) then this code could be removed
> 
> Indeed, IMHO that would be better.

Do you really want to block this on a big discussion of "proper" sizing behavior for GTK+ 3?
Comment 6 Christian Persch 2010-10-11 19:20:00 UTC
No; I marked the patch as 'accepted-commit-now', didn't I :)
Comment 7 Owen Taylor 2010-10-11 19:36:07 UTC
Comment on attachment 172114 [details] [review]
Report correct minimum/natural sizes for GTK+ 3

Thanks for the review, pushed as 7d0eb2ff21