Re: questions re: aux info, size request



Hi,

On Sun, Sep 12, 2010 at 12:45 AM, Tristan Van Berkom
<tristanvb openismus com> wrote:
> While on this topic, there's this XXX comment I left dangling
> in gtksizegroup.c:
>   http://git.gnome.org/browse/gtk+/tree/gtk/gtksizegroup.c#n677
>
> I was thinking maybe that for all the widgets in a group to be
> effectively the same size, maybe we should be basing the minimum
> base requests from the natural requests of all widgets in a group.

I would expect that GtkSizeGroup caused all widgets in the group to
request a min size of the largest min size in the group, and a natural
size of the largest natural size in the group. Then it Just Works,
right? Is there a reason that only one of min or natural can be picked
for size group?

> But if set_size_request() were to limit the natural size; combining
> it with sizegroups that demand/require the natural size as a minimum
> might work nicely.

To be clear, I was proposing a set_natural_size() or something (i.e. I
think making set_size_request set natural would be too incompatible)

It might be clearer to rename set_size_request to set_minimum_size()
but that function is maybe too heavily used to rename... at least
without keeping the old name also.

btw along these lines, I can't remember if I filed the attached patch.
Natural size much less useful without it.

Havoc
From 7ddeb49f1643799794bdc7d96a55fe9a885cd39f Mon Sep 17 00:00:00 2001
From: Havoc Pennington <hp pobox com>
Date: Mon, 6 Sep 2010 11:18:35 -0400
Subject: [PATCH] Make GtkWindow default to natural size not minimum size

Otherwise your ellipsized labels all start out ellipsized, unless
you manually gtk_window_set_default_size().

This probably makes it important to clamp the window's default
size to the size of the monitor's work area.
---
 gtk/gtkwindow.c |    4 ++--
 tests/testgtk.c |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 5f75dae..b50a9ab 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5725,9 +5725,9 @@ gtk_window_compute_configure_request_size (GtkWindow *window,
   
   if (window->need_default_size)
     {
-      gtk_widget_get_child_requisition (widget, &requisition);
+      gtk_size_request_get_size (GTK_SIZE_REQUEST (widget), NULL, &requisition);
 
-      /* Default to requisition */
+      /* Default to natural requisition */
       *width = requisition.width;
       *height = requisition.height;
 
diff --git a/tests/testgtk.c b/tests/testgtk.c
index cddb7df..8ea1117 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -8431,6 +8431,7 @@ create_window_sizing (GtkWidget *widget)
 			     gtk_widget_get_screen (widget));
       label = gtk_label_new (NULL);
       gtk_label_set_markup (GTK_LABEL (label), "<span foreground=\"purple\"><big>Window being resized</big></span>\nBlah blah blah blah\nblah blah blah\nblah blah blah blah blah");
+      gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
       gtk_container_add (GTK_CONTAINER (target_window), label);
       gtk_widget_show (label);
       
-- 
1.7.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]