GNOME Bugzilla – Bug 58952
gtk_paned_set_proportion
Last modified: 2018-04-15 00:24:53 UTC
This patch adds a new method of size allocation where the first widget is assigned a percentage of the total available size. When the paned is resized, both child widgets are resized proportionally.
Created attachment 887 [details] [review] paned patch
Created attachment 888 [details] [review] paned documentation patch
As a feature addition, this needs to wait at this point for GTK+-2.2, so I'm putting this on the future milestone. I think there would need to be some further investigation in how this works in relationship to the current GtkPaned options ... note that with the current setup, resizing is already proportional when both children are packed with resize = TRUE or resize = FALSE.
Please note that this is a new feature but does not interfere in any way with GtkPaned's standard behaviour. By default, the paned widgets behave exactly as before. Only after setting the proportion will it start behaving differently upon resize. The argument that "resizing is already proportional when both children are packed with resize = TRUE or resize = FALSE" may be true, but in this case the proportion is fixed at 50%. With the patch, and when proportion is activated by the programmer, the user can set a new proportion manually and it will be maintained after resize.
See also bug #169673, about a "quantum-size" property for GtkPaned.
Hmm, the patch does not apply anymore (no wonder, its from 2001...), and playing around a bit with gtkpaned, it is not entirely clear to me how such a proportional property would behave. Regarding #4, the proportion is not fixed at 50%: paned->child1_size = allocation * ((gdouble) paned->child1_size / (paned->last_allocation)) + 0.5; so we keep the proportion the same as it was before. Maybe easier to understand would be some float "resizability" child-property which would generalize the boolean resizable. But that would be a deviation from what we do for other containers, and probably needs some more thought.
Created attachment 105230 [details] [review] Introduce "ratio" and "ratio_set" Moving here from bug 339461, updated with regard to latest comments. This bug has the same functional intention as far as I can see, apart from using a different term. I choose to prefer the term 'ratio'.
*** Bug 339461 has been marked as a duplicate of this bug. ***
Are there plans to consider Christian's patch to get it committed? Note to myself: Downstream at https://bugs.maemo.org/show_bug.cgi?id=1239
Created attachment 132064 [details] [review] Introduce "ratio" and "ratio-set" #2 I updated the patch to trunk. Review would be appreciated. I tested with applications and with testgtk and it works fine.
Spotted a typo: @@ -1254,9 +1315,18 @@ gtk_paned_grab_broken static void stop_drag (GtkPaned *paned) { + GObject *object = G_OBJECT (object); ^^^^^^ should be "paned"
I'd really like to use this ratio feature in Evolution, but the interaction between "ratio" and "position" isn't quite right. The problem with the patch is the ratio is lost as soon as the user touches the resize handle. Based on the Evolution bugs I've seen, this is not what users expect. They expect to be able to resize the panes to their liking and have that ratio persist no matter what they do to the window size. This is the behavior I want for Evolution's main window panes: 1) Child widgets should be resized proportionally, even after the user manually changes the proportions. 2) Preserve the user's chosen proportion across sessions by binding the ratio value to a configuration key (via GConfBridge or GSettings). Here's an alternate approach that I think would satisfy my needs and maybe simplify the semantics: - Add a "ratio" property similar to Christian's proposal, but have it proxy the "position" property at all times. Setting the ratio would actually set the position based on the widget's current allocation. In other words, maintain the invariant: GtkPaned:ratio == GtkPaned:position / widget dimension - Add a "ratio-locked" boolean property that controls how resizing works. This would always be set explicitly, never by GtkPaned itself. FALSE gives you the current behavior: "position" remains fixed (kind of) and "ratio" changes as the widget is resized. TRUE gives you the opposite: "ratio" remains fixed and "position" changes as the widget is resized.
Can this patch get a review for the next cycle please?
Comment on attachment 887 [details] [review] paned patch (In reply to comment #6) > Hmm, the patch does not apply anymore (no wonder, its from 2001...) -> status=needs-work
Comment on attachment 888 [details] [review] paned documentation patch (In reply to comment #6) > Hmm, the patch does not apply anymore (no wonder, its from 2001...) -> status=needs-work (depending on the other patch)
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new