Thanks for answer!
But in your example same problem!
If you pack wrapbox directly in to frame (without scrolled_window)
then,
you can not change the height of the window to smaller than it was at the start.
look at screenshots
this is window after start
http://imageshack.us/photo/my-images/847/testwrapbox1.png/and this is
http://imageshack.us/photo/my-images/696/testwrapbox.png/after changing the width of the window, it should allow to reduce its height, because there are many free space, but it does not.
With GTK3.0 i use little trick for that,
i store maximum allowed width in private variable, and in function
get_preferred_height_for_width
i always calculate height not for minimum width but for stored width.
There is how it looks like
public override void get_preferred_height_for_width (int width,out int minimum_height, out int natural_height) {
/*workaround for min_height, if actual available width more than self minimum width*/
if( this.minimum_width!=width ||
!(this.minimum_width==width && this.natural_width >= width) ){
this.natural_width=width;
}
this._get_preferred_height_for_width(this.natural_width,out minimum_height, out natural_height);
this.natural_height = natural_height;
}
where this.natural_width is stored maximum width.
Because get_preferred_height_for_width called several times , first time for minimum width, others for allocated width,
and because while i resizing window, gtk always recalculate size , in gtk3.0 my window always have actual size.
As i'm understand, problem appears because of the following changes in gtk
container.c in GTK3.2
+typedef struct {
+ gint hfw;
+ gint wfh;
+} RequestModeCount;
+
+static void
+count_request_modes (GtkWidget *widget,
+ RequestModeCount *count)
+{
+ GtkSizeRequestMode mode = gtk_widget_get_request_mode (widget);
+
+ switch (mode)
+ {
+ case GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH:
+ count->hfw++;
+ break;
+ case GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT:
+ count->wfh++;
+ break;
+ case GTK_SIZE_REQUEST_CONSTANT_SIZE:
+ default:
+ break;
+ }
+}
+
+static GtkSizeRequestMode
+gtk_container_get_request_mode (GtkWidget *widget)
+{
+ GtkContainer *container = GTK_CONTAINER (widget);
+ GtkContainerPrivate *priv = container->priv;
+
+ /* Recalculate the request mode of the children by majority
+ * vote whenever the internal content changes */
+ if (_gtk_widget_get_width_request_needed (widget) ||
+ _gtk_widget_get_height_request_needed (widget))
+ {
+ RequestModeCount count = { 0, 0 };
+
+ gtk_container_forall (container, (GtkCallback)count_request_modes, &count);
+
+ if (!count.hfw && !count.wfh)
+ priv->request_mode = GTK_SIZE_REQUEST_CONSTANT_SIZE;
+ else
+ priv->request_mode = count.wfh > count.hfw ?
+ GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT :
+ GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
+ }
+
+ return priv->request_mode;
+}
+
so, container will recalculate it size only if
if (_gtk_widget_get_width_request_needed (widget) ||
_gtk_widget_get_height_request_needed (widget))
because of that, my trick don't working with GTK 3.2,
so, my question is,
how to force the container/window to recalculate its size in gtk 3.2 ?
i try to use set_size_request and queue_resize (for container and for window),
but this functions don't help.
I hope I have clearly described their
thoughts.