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 631796 - GtkWindow: Allow setting size from geometry
GtkWindow: Allow setting size from geometry
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: 3.0
Assigned To: gtk-bugs
gtk-bugs
Depends on: 68668
Blocks: 631797
 
 
Reported: 2010-10-10 02:44 UTC by Owen Taylor
Modified: 2010-10-11 18:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkWindow: Allow setting size from geometry (11.48 KB, patch)
2010-10-10 02:44 UTC, Owen Taylor
accepted-commit_now Details | Review

Description Owen Taylor 2010-10-10 02:44:51 UTC
If you set a geometry widget via gtk_window_set_geometry_hints() it
becomes very hard to compute appropriate toplevel sizes in pixels
to make the window a particular size. Synthesizing strings and passing
them to gtk_window_parse_geometry() is possible, but to avoid
avoid such ugliness, add functions:

 gtk_window_set_default_geometry()
 gtk_window_resize_to_geometry()

That act like gtk_window_set_default_size() and
gtk_window_resize() but are in terms of the resize increments of the
geometry widget.
Comment 1 Owen Taylor 2010-10-10 02:44:53 UTC
Created attachment 172033 [details] [review]
GtkWindow: Allow setting size from geometry
Comment 2 Matthias Clasen 2010-10-11 13:13:52 UTC
Review of attachment 172033 [details] [review]:

Sounds ok to me.
Geometry widget seems like a pretty fringe case, but why not make terminal authors life a little easier...

::: gtk/gtkwidget.h
@@ +897,3 @@
+					int        old_width,
+					int        old_height);
+

Ah, thats the header for these functions that I was missing in the other patch.
Comment 3 Owen Taylor 2010-10-11 18:11:19 UTC
(In reply to comment #2)
> Review of attachment 172033 [details] [review]:
> 
> Sounds ok to me.
> Geometry widget seems like a pretty fringe case, but why not make terminal
> authors life a little easier...

One thing you can do here which might be more generally useful is:

 gtk_window_set_geometry_widget(window, embedded_drawing_canvas,
                                NULL, 0);
 [...]
 gtk_widget_resize_to_geometry(window, 300, 300);

Avoiding some pretty bad hacks I've had to do elsewhere to figure out "how big does the window have to be to make widget X 300,300".
Comment 4 Owen Taylor 2010-10-11 18:17:09 UTC
Attachment 172033 [details] pushed as a4a7a61 - GtkWindow: Allow setting size from geometry