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 58952 - gtk_paned_set_proportion
gtk_paned_set_proportion
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other Linux
: Normal enhancement
: Small API
Assigned To: gtk-bugs
gtk-bugs
: 339461 (view as bug list)
Depends on:
Blocks: 551358
 
 
Reported: 2001-08-13 20:17 UTC by Gustavo J. A. M. Carneiro
Modified: 2018-04-15 00:24 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
paned patch (5.85 KB, patch)
2001-08-13 20:18 UTC, Gustavo J. A. M. Carneiro
needs-work Details | Review
paned documentation patch (497 bytes, patch)
2001-08-13 20:21 UTC, Gustavo J. A. M. Carneiro
needs-work Details | Review
Introduce "ratio" and "ratio_set" (9.54 KB, patch)
2008-02-14 12:51 UTC, Christian Dywan
none Details | Review
Introduce "ratio" and "ratio-set" #2 (8.87 KB, patch)
2009-04-04 11:13 UTC, Christian Dywan
none Details | Review

Description Gustavo J. A. M. Carneiro 2001-08-13 20:17:38 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.
Comment 1 Gustavo J. A. M. Carneiro 2001-08-13 20:18:29 UTC
Created attachment 887 [details] [review]
paned patch
Comment 2 Gustavo J. A. M. Carneiro 2001-08-13 20:21:00 UTC
Created attachment 888 [details] [review]
paned documentation patch
Comment 3 Owen Taylor 2001-08-23 19:29:25 UTC
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.
Comment 4 Gustavo J. A. M. Carneiro 2001-08-23 20:53:55 UTC
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.


Comment 5 Federico Mena Quintero 2005-03-09 00:09:45 UTC
See also bug #169673, about a "quantum-size" property for GtkPaned.
Comment 6 Matthias Clasen 2006-01-10 19:03:45 UTC
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.


Comment 7 Christian Dywan 2008-02-14 12:51:38 UTC
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'.
Comment 8 Christian Dywan 2008-09-10 12:47:07 UTC
*** Bug 339461 has been marked as a duplicate of this bug. ***
Comment 9 André Klapper 2008-10-29 22:47:37 UTC
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
Comment 10 Christian Dywan 2009-04-04 11:13:22 UTC
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.
Comment 11 Matthew Barnes 2009-08-26 02:16:51 UTC
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"
Comment 12 Matthew Barnes 2009-08-26 04:14:56 UTC
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.
Comment 13 André Klapper 2010-03-27 20:02:48 UTC
Can this patch get a review for the next cycle please?
Comment 14 André Klapper 2012-02-21 00:31:45 UTC
Can this patch get a review for the next cycle please?
Comment 15 André Klapper 2012-02-21 00:31:45 UTC
Can this patch get a review for the next cycle please?
Comment 16 André Klapper 2012-02-21 00:31:45 UTC
Can this patch get a review for the next cycle please?
Comment 17 André Klapper 2015-01-21 04:52:09 UTC
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 18 André Klapper 2015-01-21 04:52:09 UTC
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)
Comment 19 Matthias Clasen 2018-02-10 05:05:19 UTC
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.
Comment 20 Matthias Clasen 2018-04-15 00:24:53 UTC
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