sizerequest: Optimize CONSTANT_SIZE better

We can set for_size to -1 earlier than we did. Doing so makes sure we
only cache one value (as we should in the first place). In GTK 3.6, this
worked properly, but with Previously, this check was moved further up to
avoid interacting with size groups. But after recent refactorings, size
groups are handled way earlier anyway.
This commit is contained in:
Benjamin Otte
2012-11-14 14:03:47 +01:00
parent 6d3b4d9382
commit 53262cf7a6

View 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);