]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtksizerequest.c
TextView: Properly render background
[~andy/gtk] / gtk / gtksizerequest.c
index 644b47a521613faec7e29423d811655e56f63a79..0ce86bd66fc95b849c98347619791f28898604b8 100644 (file)
@@ -105,6 +105,9 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
   gint nat_size = 0;
   gboolean found_in_cache;
 
+  if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
+    for_size = -1;
+
   cache = _gtk_widget_peek_request_cache (widget);
   found_in_cache = _gtk_size_request_cache_lookup (cache,
                                                    orientation,
@@ -120,7 +123,7 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
 
       if (orientation == GTK_ORIENTATION_HORIZONTAL)
         {
-          if (for_size < 0 || gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
+          if (for_size < 0)
             {
              push_recursion_check (widget, orientation, for_size);
               GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_size, &nat_size);
@@ -153,7 +156,7 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
         }
       else
         {
-          if (for_size < 0 || gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
+          if (for_size < 0)
             {
              push_recursion_check (widget, orientation, for_size);
               GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_size, &nat_size);
@@ -265,6 +268,15 @@ _gtk_widget_compute_size_for_orientation (GtkWidget        *widget,
   gpointer key;
   gint    min_result = 0, nat_result = 0;
 
+  if (!gtk_widget_get_visible (widget) && !gtk_widget_is_toplevel (widget))
+    {
+      if (minimum)
+        *minimum = 0;
+      if (natural)
+        *natural = 0;
+      return;
+    }
+
   if (G_LIKELY (!_gtk_widget_get_sizegroups (widget)))
     {
       gtk_widget_query_size_for_orientation (widget, orientation, for_size, minimum, natural);