widget: Remove gtk_widget_set_redraw_on_alloc

Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
This commit is contained in:
Timm Bäder 2017-08-09 16:26:26 +02:00
parent 5874a30c73
commit a8a755e5cd
17 changed files with 1 additions and 58 deletions

View File

@ -4547,7 +4547,6 @@ gtk_widget_get_font_map
gtk_widget_create_pango_layout
gtk_widget_queue_draw_area
gtk_widget_queue_draw_region
gtk_widget_set_redraw_on_allocate
gtk_widget_mnemonic_activate
gtk_widget_send_focus_change
gtk_widget_class_set_accessible_type

View File

@ -1351,7 +1351,6 @@ gtk_box_init (GtkBox *box)
private = box->priv;
gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
private->orientation = GTK_ORIENTATION_HORIZONTAL;
private->children = NULL;

View File

@ -474,7 +474,6 @@ static void
gtk_flow_box_child_init (GtkFlowBoxChild *child)
{
gtk_widget_set_can_focus (GTK_WIDGET (child), TRUE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (child), TRUE);
}
/* Public API {{{2 */
@ -3755,7 +3754,6 @@ gtk_flow_box_init (GtkFlowBox *box)
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), TRUE);
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
priv->selection_mode = GTK_SELECTION_SINGLE;

View File

@ -1727,7 +1727,6 @@ gtk_grid_init (GtkGrid *grid)
priv = grid->priv;
gtk_widget_set_has_window (GTK_WIDGET (grid), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (grid), FALSE);
priv->children = NULL;
priv->orientation = GTK_ORIENTATION_HORIZONTAL;

View File

@ -1986,7 +1986,6 @@ gtk_header_bar_init (GtkHeaderBar *bar)
priv = gtk_header_bar_get_instance_private (bar);
gtk_widget_set_has_window (GTK_WIDGET (bar), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (bar), FALSE);
priv->title = NULL;
priv->subtitle = NULL;

View File

@ -428,8 +428,6 @@ gtk_info_bar_init (GtkInfoBar *info_bar)
priv = info_bar->priv = gtk_info_bar_get_instance_private (info_bar);
gtk_widget_set_redraw_on_allocate (widget, TRUE);
/* message-type is a CONSTRUCT property, so we init to a value
* different from its default to trigger its property setter
* during construction */

View File

@ -592,7 +592,6 @@ gtk_list_box_init (GtkListBox *box)
GtkWidget *widget = GTK_WIDGET (box);
gtk_widget_set_has_window (widget, FALSE);
gtk_widget_set_redraw_on_allocate (widget, TRUE);
priv->selection_mode = GTK_SELECTION_SINGLE;
priv->activate_single_click = TRUE;
@ -3468,7 +3467,6 @@ static void
gtk_list_box_row_init (GtkListBoxRow *row)
{
gtk_widget_set_can_focus (GTK_WIDGET (row), TRUE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (row), TRUE);
ROW_PRIV (row)->activatable = TRUE;
ROW_PRIV (row)->selectable = TRUE;

View File

@ -195,7 +195,6 @@ gtk_path_bar_init (GtkPathBar *path_bar)
G_CALLBACK (gtk_path_bar_scroll_down), path_bar);
gtk_widget_set_has_window (GTK_WIDGET (path_bar), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE);
context = gtk_widget_get_style_context (GTK_WIDGET (path_bar));
gtk_style_context_add_class (context, "path-bar");

View File

@ -124,7 +124,6 @@ gtk_revealer_init (GtkRevealer *revealer)
priv->target_pos = 0.0;
gtk_widget_set_has_window ((GtkWidget*) revealer, FALSE);
gtk_widget_set_redraw_on_allocate ((GtkWidget*) revealer, FALSE);
}
static void

View File

@ -237,7 +237,6 @@ gtk_statusbar_init (GtkStatusbar *statusbar)
priv->keys = NULL;
gtk_widget_init_template (GTK_WIDGET (statusbar));
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (statusbar), TRUE);
}
/**

View File

@ -1713,9 +1713,6 @@ gtk_text_view_init (GtkTextView *text_view)
priv->text_window = text_window_new (GTK_TEXT_WINDOW_TEXT,
widget, 200, 200);
/* We handle all our own redrawing */
gtk_widget_set_redraw_on_allocate (widget, FALSE);
priv->multipress_gesture = gtk_gesture_multi_press_new (widget);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), 0);
g_signal_connect (priv->multipress_gesture, "pressed",

View File

@ -385,7 +385,6 @@ gtk_tool_item_group_init (GtkToolItemGroup *group)
GtkToolItemGroupPrivate* priv;
GtkCssNode *widget_node;
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (group), FALSE);
gtk_widget_set_has_window (GTK_WIDGET (group), FALSE);
group->priv = priv = gtk_tool_item_group_get_instance_private (group);

View File

@ -1670,7 +1670,6 @@ gtk_tree_view_init (GtkTreeView *tree_view)
priv = tree_view->priv = gtk_tree_view_get_instance_private (tree_view);
gtk_widget_set_can_focus (GTK_WIDGET (tree_view), TRUE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (tree_view), FALSE);
priv->show_expanders = TRUE;
priv->draw_keyfocus = TRUE;

View File

@ -343,7 +343,6 @@ gtk_viewport_init (GtkViewport *viewport)
widget = GTK_WIDGET (viewport);
gtk_widget_set_has_window (widget, FALSE);
gtk_widget_set_redraw_on_allocate (widget, FALSE);
priv->shadow_type = GTK_SHADOW_IN;
priv->hadjustment = NULL;

View File

@ -3798,7 +3798,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
priv->allocated_size_baseline = -1;
priv->sensitive = TRUE;
priv->redraw_on_alloc = TRUE;
priv->alloc_needed = TRUE;
priv->alloc_needed_on_child = TRUE;
priv->focus_on_click = TRUE;
@ -5566,7 +5565,7 @@ check_clip:
position_changed |= (old_clip.x != priv->clip.x ||
old_clip.y != priv->clip.y);
if (_gtk_widget_get_mapped (widget) && priv->redraw_on_alloc)
if (_gtk_widget_get_mapped (widget))
{
if (position_changed || size_changed || baseline_changed)
{
@ -8172,38 +8171,6 @@ gtk_widget_get_mapped (GtkWidget *widget)
return widget->priv->mapped;
}
/**
* gtk_widget_set_redraw_on_allocate:
* @widget: a #GtkWidget
* @redraw_on_allocate: if %TRUE, the entire widget will be redrawn
* when it is allocated to a new size. Otherwise, only the
* new portion of the widget will be redrawn.
*
* Sets whether the entire widget is queued for drawing when its size
* allocation changes. By default, this setting is %TRUE and
* the entire widget is redrawn on every size change. If your widget
* leaves the upper left unchanged when made bigger, turning this
* setting off will improve performance.
* Note that for widgets where gtk_widget_get_has_window() is %FALSE
* setting this flag to %FALSE turns off all allocation on resizing:
* the widget will not even redraw if its position changes; this is to
* allow containers that dont draw anything to avoid excess
* invalidations. If you set this flag on a widget with no window that
* does draw on @widget->window, you are
* responsible for invalidating both the old and new allocation of the
* widget when the widget is moved and responsible for invalidating
* regions newly when the widget increases size.
**/
void
gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
gboolean redraw_on_allocate)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
widget->priv->redraw_on_alloc = redraw_on_allocate;
}
/**
* gtk_widget_set_sensitive:
* @widget: a #GtkWidget

View File

@ -701,10 +701,6 @@ gboolean gtk_widget_get_realized (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_get_mapped (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
gboolean redraw_on_allocate);
GDK_AVAILABLE_IN_ALL
void gtk_widget_set_parent (GtkWidget *widget,
GtkWidget *parent);

View File

@ -66,7 +66,6 @@ struct _GtkWidgetPrivate
guint receives_default : 1;
guint has_grab : 1;
guint shadowed : 1;
guint redraw_on_alloc : 1;
guint child_visible : 1;
guint multidevice : 1;
guint has_shape_mask : 1;