sizerequest: Export _gtk_widget_compute_size_for_orientation()
and add an "ignore_size_groups" flag to it. This way we can use it for size group shenanigans.
This commit is contained in:
@ -331,12 +331,13 @@ get_vfunc_name (GtkSizeGroupMode orientation,
|
|||||||
* not cached. If the for_size here is -1, then get_preferred_width()
|
* not cached. If the for_size here is -1, then get_preferred_width()
|
||||||
* or get_preferred_height() will be used.
|
* or get_preferred_height() will be used.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
compute_size_for_orientation (GtkWidget *widget,
|
_gtk_widget_compute_size_for_orientation (GtkWidget *widget,
|
||||||
GtkSizeGroupMode orientation,
|
GtkSizeGroupMode orientation,
|
||||||
gint for_size,
|
gboolean ignore_size_groups,
|
||||||
gint *minimum_size,
|
gint for_size,
|
||||||
gint *natural_size)
|
gint *minimum_size,
|
||||||
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
CachedSize *cached_size;
|
CachedSize *cached_size;
|
||||||
gboolean found_in_cache = FALSE;
|
gboolean found_in_cache = FALSE;
|
||||||
@ -472,11 +473,12 @@ compute_size_for_orientation (GtkWidget *widget,
|
|||||||
nat_size = cached_size->natural_size;
|
nat_size = cached_size->natural_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gtk_size_group_bump_requisition (widget,
|
if (!ignore_size_groups)
|
||||||
orientation,
|
_gtk_size_group_bump_requisition (widget,
|
||||||
for_size,
|
orientation,
|
||||||
&min_size,
|
for_size,
|
||||||
&nat_size);
|
&min_size,
|
||||||
|
&nat_size);
|
||||||
|
|
||||||
if (minimum_size)
|
if (minimum_size)
|
||||||
*minimum_size = min_size;
|
*minimum_size = min_size;
|
||||||
@ -487,12 +489,13 @@ compute_size_for_orientation (GtkWidget *widget,
|
|||||||
g_assert (min_size <= nat_size);
|
g_assert (min_size <= nat_size);
|
||||||
|
|
||||||
GTK_NOTE (SIZE_REQUEST,
|
GTK_NOTE (SIZE_REQUEST,
|
||||||
g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d (hit cache: %s)\n",
|
g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d (hit cache: %s, ignore size groups: %s)\n",
|
||||||
widget, G_OBJECT_TYPE_NAME (widget),
|
widget, G_OBJECT_TYPE_NAME (widget),
|
||||||
orientation == GTK_SIZE_GROUP_HORIZONTAL ?
|
orientation == GTK_SIZE_GROUP_HORIZONTAL ?
|
||||||
"width for height" : "height for width" ,
|
"width for height" : "height for width" ,
|
||||||
for_size, min_size, nat_size,
|
for_size, min_size, nat_size,
|
||||||
found_in_cache ? "yes" : "no"));
|
found_in_cache ? "yes" : "no",
|
||||||
|
ignore_size_groups ? "yes" : "no"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,8 +550,12 @@ gtk_widget_get_preferred_width (GtkWidget *widget,
|
|||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (minimum_width != NULL || natural_width != NULL);
|
g_return_if_fail (minimum_width != NULL || natural_width != NULL);
|
||||||
|
|
||||||
compute_size_for_orientation (widget, GTK_SIZE_GROUP_HORIZONTAL,
|
_gtk_widget_compute_size_for_orientation (widget,
|
||||||
-1, minimum_width, natural_width);
|
GTK_SIZE_GROUP_HORIZONTAL,
|
||||||
|
FALSE,
|
||||||
|
-1,
|
||||||
|
minimum_width,
|
||||||
|
natural_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -578,8 +585,12 @@ gtk_widget_get_preferred_height (GtkWidget *widget,
|
|||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (minimum_height != NULL || natural_height != NULL);
|
g_return_if_fail (minimum_height != NULL || natural_height != NULL);
|
||||||
|
|
||||||
compute_size_for_orientation (widget, GTK_SIZE_GROUP_VERTICAL,
|
_gtk_widget_compute_size_for_orientation (widget,
|
||||||
-1, minimum_height, natural_height);
|
GTK_SIZE_GROUP_VERTICAL,
|
||||||
|
FALSE,
|
||||||
|
-1,
|
||||||
|
minimum_height,
|
||||||
|
natural_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -613,11 +624,19 @@ gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
g_return_if_fail (height >= 0);
|
g_return_if_fail (height >= 0);
|
||||||
|
|
||||||
if (GTK_WIDGET_GET_CLASS (widget)->get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
|
if (GTK_WIDGET_GET_CLASS (widget)->get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
|
||||||
compute_size_for_orientation (widget, GTK_SIZE_GROUP_HORIZONTAL,
|
_gtk_widget_compute_size_for_orientation (widget,
|
||||||
-1, minimum_width, natural_width);
|
GTK_SIZE_GROUP_HORIZONTAL,
|
||||||
|
FALSE,
|
||||||
|
-1,
|
||||||
|
minimum_width,
|
||||||
|
natural_width);
|
||||||
else
|
else
|
||||||
compute_size_for_orientation (widget, GTK_SIZE_GROUP_HORIZONTAL,
|
_gtk_widget_compute_size_for_orientation (widget,
|
||||||
height, minimum_width, natural_width);
|
GTK_SIZE_GROUP_HORIZONTAL,
|
||||||
|
FALSE,
|
||||||
|
height,
|
||||||
|
minimum_width,
|
||||||
|
natural_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -649,11 +668,19 @@ gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
g_return_if_fail (width >= 0);
|
g_return_if_fail (width >= 0);
|
||||||
|
|
||||||
if (GTK_WIDGET_GET_CLASS (widget)->get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
|
if (GTK_WIDGET_GET_CLASS (widget)->get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
|
||||||
compute_size_for_orientation (widget, GTK_SIZE_GROUP_VERTICAL,
|
_gtk_widget_compute_size_for_orientation (widget,
|
||||||
-1, minimum_height, natural_height);
|
GTK_SIZE_GROUP_VERTICAL,
|
||||||
|
FALSE,
|
||||||
|
-1,
|
||||||
|
minimum_height,
|
||||||
|
natural_height);
|
||||||
else
|
else
|
||||||
compute_size_for_orientation (widget, GTK_SIZE_GROUP_VERTICAL,
|
_gtk_widget_compute_size_for_orientation (widget,
|
||||||
width, minimum_height, natural_height);
|
GTK_SIZE_GROUP_VERTICAL,
|
||||||
|
FALSE,
|
||||||
|
width,
|
||||||
|
minimum_height,
|
||||||
|
natural_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -112,6 +112,12 @@ void _gtk_widget_override_size_request (GtkWidget *widget,
|
|||||||
void _gtk_widget_restore_size_request (GtkWidget *widget,
|
void _gtk_widget_restore_size_request (GtkWidget *widget,
|
||||||
int old_width,
|
int old_width,
|
||||||
int old_height);
|
int old_height);
|
||||||
|
void _gtk_widget_compute_size_for_orientation (GtkWidget *widget,
|
||||||
|
GtkSizeGroupMode orientation,
|
||||||
|
gboolean ignore_size_groups,
|
||||||
|
gint for_size,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size);
|
||||||
|
|
||||||
gboolean _gtk_widget_get_translation_to_window (GtkWidget *widget,
|
gboolean _gtk_widget_get_translation_to_window (GtkWidget *widget,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
|
|||||||
Reference in New Issue
Block a user