sizegroup: Remove GtkQueueResizeFlags

They were only used with geometry widgets.
This commit is contained in:
Benjamin Otte
2015-03-24 04:45:38 +01:00
parent 5dd2087d19
commit ab2d236d3d
5 changed files with 44 additions and 93 deletions

View File

@@ -2105,32 +2105,6 @@ gtk_container_queue_resize_handler (GtkContainer *container)
}
}
static void
_gtk_container_queue_resize_internal (GtkContainer *container,
gboolean invalidate_only)
{
GtkWidget *widget;
widget = (GtkWidget*)container;
do
{
_gtk_widget_set_alloc_needed (widget, TRUE);
_gtk_size_request_cache_clear (_gtk_widget_peek_request_cache (widget));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (((GtkContainer*)widget)->priv->resize_mode != GTK_RESIZE_PARENT)
break;
G_GNUC_END_IGNORE_DEPRECATIONS;
widget = _gtk_widget_get_parent (widget);
}
while (widget);
if (widget && !invalidate_only)
gtk_container_queue_resize_handler ((GtkContainer*)widget);
}
void
_gtk_container_queue_restyle (GtkContainer *container)
{
@@ -2161,20 +2135,28 @@ _gtk_container_queue_restyle (GtkContainer *container)
void
_gtk_container_queue_resize (GtkContainer *container)
{
_gtk_container_queue_resize_internal (container, FALSE);
}
GtkWidget *widget;
/**
* _gtk_container_resize_invalidate:
* @container: a #GtkContainer
*
* Invalidates cached sizes like _gtk_container_queue_resize() but doesn't
* actually queue the resize container for resize.
*/
void
_gtk_container_resize_invalidate (GtkContainer *container)
{
_gtk_container_queue_resize_internal (container, TRUE);
g_return_if_fail (GTK_IS_CONTAINER (container));
widget = GTK_WIDGET (container);
do
{
_gtk_widget_set_alloc_needed (widget, TRUE);
_gtk_size_request_cache_clear (_gtk_widget_peek_request_cache (widget));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (GTK_IS_RESIZE_CONTAINER (widget))
break;
G_GNUC_END_IGNORE_DEPRECATIONS;
widget = gtk_widget_get_parent (widget);
}
while (widget);
if (widget)
gtk_container_queue_resize_handler (GTK_CONTAINER (widget));
}
void

View File

@@ -27,7 +27,6 @@ G_BEGIN_DECLS
void _gtk_container_queue_resize (GtkContainer *container);
void _gtk_container_queue_restyle (GtkContainer *container);
void _gtk_container_resize_invalidate (GtkContainer *container);
void _gtk_container_clear_resize_widgets (GtkContainer *container);
gchar* _gtk_container_child_composite_name (GtkContainer *container,
GtkWidget *child);

View File

@@ -23,26 +23,9 @@
G_BEGIN_DECLS
/*
* GtkQueueResizeFlags:
* @GTK_QUEUE_RESIZE_INVALIDATE_ONLY: invalidate all cached sizes
* as we would normally do when a widget is queued for resize,
* but dont actually add the toplevel resize container to the
* resize queue. Useful if we want to change the size of a widget
* see how that would affect the overall layout, then restore
* the old size.
*
* Flags that affect the operation of queueing a widget for resize.
*/
typedef enum
{
GTK_QUEUE_RESIZE_INVALIDATE_ONLY = 1 << 0
} GtkQueueResizeFlags;
GHashTable * _gtk_size_group_get_widget_peers (GtkWidget *for_widget,
GtkOrientation orientation);
void _gtk_size_group_queue_resize (GtkWidget *widget,
GtkQueueResizeFlags flags);
void _gtk_size_group_queue_resize (GtkWidget *widget);
G_END_DECLS

View File

@@ -204,8 +204,7 @@ _gtk_size_group_get_widget_peers (GtkWidget *for_widget,
}
static void
real_queue_resize (GtkWidget *widget,
GtkQueueResizeFlags flags)
real_queue_resize (GtkWidget *widget)
{
GtkWidget *container;
@@ -219,17 +218,13 @@ real_queue_resize (GtkWidget *widget,
if (container)
{
if (flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY)
_gtk_container_resize_invalidate (GTK_CONTAINER (container));
else
_gtk_container_queue_resize (GTK_CONTAINER (container));
_gtk_container_queue_resize (GTK_CONTAINER (container));
}
}
static void
queue_resize_on_widget (GtkWidget *widget,
gboolean check_siblings,
GtkQueueResizeFlags flags)
queue_resize_on_widget (GtkWidget *widget,
gboolean check_siblings)
{
GHashTable *widgets;
GHashTable *groups;
@@ -248,7 +243,7 @@ queue_resize_on_widget (GtkWidget *widget,
if (widget == parent && !check_siblings)
{
real_queue_resize (widget, flags);
real_queue_resize (widget);
parent = _gtk_widget_get_parent (parent);
continue;
}
@@ -257,7 +252,7 @@ queue_resize_on_widget (GtkWidget *widget,
if (!widget_groups)
{
if (widget == parent)
real_queue_resize (widget, flags);
real_queue_resize (widget);
parent = _gtk_widget_get_parent (parent);
continue;
@@ -273,14 +268,14 @@ queue_resize_on_widget (GtkWidget *widget,
if (current == parent)
{
if (widget == parent)
real_queue_resize (parent, flags);
real_queue_resize (parent);
}
else if (current == widget)
{
g_warning ("A container and its child are part of this SizeGroup");
}
else
queue_resize_on_widget (current, FALSE, flags);
queue_resize_on_widget (current, FALSE);
}
parent = _gtk_widget_get_parent (parent);
@@ -291,12 +286,12 @@ queue_resize_on_widget (GtkWidget *widget,
}
static void
queue_resize_on_group (GtkSizeGroup *size_group)
queue_resize_on_group (GtkSizeGroup *size_group)
{
GtkSizeGroupPrivate *priv = size_group->priv;
if (priv->widgets)
queue_resize_on_widget (priv->widgets->data, TRUE, 0);
queue_resize_on_widget (priv->widgets->data, TRUE);
}
static void
@@ -611,10 +606,9 @@ gtk_size_group_get_widgets (GtkSizeGroup *size_group)
* Queue a resize on a widget, and on all other widgets grouped with this widget.
**/
void
_gtk_size_group_queue_resize (GtkWidget *widget,
GtkQueueResizeFlags flags)
_gtk_size_group_queue_resize (GtkWidget *widget)
{
queue_resize_on_widget (widget, TRUE, flags);
queue_resize_on_widget (widget, TRUE);
}
typedef struct {

View File

@@ -806,8 +806,7 @@ static gboolean setup_template_child (GtkWidgetTemplat
static void gtk_widget_set_usize_internal (GtkWidget *widget,
gint width,
gint height,
GtkQueueResizeFlags flags);
gint height);
static void gtk_widget_add_events_internal (GtkWidget *widget,
GdkDevice *device,
@@ -3671,10 +3670,10 @@ gtk_widget_set_property (GObject *object,
gtk_container_add (GTK_CONTAINER (g_value_get_object (value)), widget);
break;
case PROP_WIDTH_REQUEST:
gtk_widget_set_usize_internal (widget, g_value_get_int (value), -2, 0);
gtk_widget_set_usize_internal (widget, g_value_get_int (value), -2);
break;
case PROP_HEIGHT_REQUEST:
gtk_widget_set_usize_internal (widget, -2, g_value_get_int (value), 0);
gtk_widget_set_usize_internal (widget, -2, g_value_get_int (value));
break;
case PROP_VISIBLE:
gtk_widget_set_visible (widget, g_value_get_boolean (value));
@@ -5600,7 +5599,7 @@ gtk_widget_queue_resize (GtkWidget *widget)
if (_gtk_widget_get_realized (widget))
gtk_widget_queue_draw (widget);
_gtk_size_group_queue_resize (widget, 0);
_gtk_size_group_queue_resize (widget);
}
/**
@@ -5617,7 +5616,7 @@ gtk_widget_queue_resize_no_redraw (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
_gtk_size_group_queue_resize (widget, 0);
_gtk_size_group_queue_resize (widget);
}
/**
@@ -10988,8 +10987,7 @@ gtk_widget_error_bell (GtkWidget *widget)
static void
gtk_widget_set_usize_internal (GtkWidget *widget,
gint width,
gint height,
GtkQueueResizeFlags flags)
gint height)
{
GtkWidgetPrivate *priv = widget->priv;
gboolean changed = FALSE;
@@ -10998,25 +10996,20 @@ gtk_widget_set_usize_internal (GtkWidget *widget,
if (width > -2 && priv->width != width)
{
if ((flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY) == 0)
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_WIDTH_REQUEST]);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_WIDTH_REQUEST]);
priv->width = width;
changed = TRUE;
}
if (height > -2 && priv->height != height)
{
if ((flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY) == 0)
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HEIGHT_REQUEST]);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HEIGHT_REQUEST]);
priv->height = height;
changed = TRUE;
}
if (_gtk_widget_get_visible (widget) && changed)
{
if ((flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY) == 0)
gtk_widget_queue_resize (widget);
else
_gtk_size_group_queue_resize (widget, GTK_QUEUE_RESIZE_INVALIDATE_ONLY);
gtk_widget_queue_resize (widget);
}
g_object_thaw_notify (G_OBJECT (widget));
@@ -11073,7 +11066,7 @@ gtk_widget_set_size_request (GtkWidget *widget,
if (height == 0)
height = 1;
gtk_widget_set_usize_internal (widget, width, height, 0);
gtk_widget_set_usize_internal (widget, width, height);
}