pathbar: Compute widget clip directly

Instead of relying on gtk_widge_set_simple_clip
This commit is contained in:
Timm Bäder 2017-06-18 12:25:39 +02:00 committed by Matthias Clasen
parent f40c61fb40
commit 6b9d10039d

View File

@ -463,11 +463,13 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
gint up_slider_offset = 0;
gint down_slider_offset = 0;
GtkRequisition child_requisition;
GtkAllocation clip = *allocation;
GtkAllocation child_clip;
/* No path is set; we don't have to allocate anything. */
if (path_bar->priv->button_list == NULL)
{
_gtk_widget_set_simple_clip (widget, NULL);
gtk_widget_set_clip (widget, allocation);
return;
}
@ -622,6 +624,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
gtk_widget_set_child_visible (child, TRUE);
gtk_widget_size_allocate (child, &child_allocation);
gtk_widget_get_clip (child, &child_clip);
gdk_rectangle_union (&clip, &child_clip, &clip);
if (direction == GTK_TEXT_DIR_RTL)
{
@ -651,6 +655,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
child_allocation.width = path_bar->priv->slider_width;
child_allocation.x = up_slider_offset + allocation->x;
gtk_widget_size_allocate (path_bar->priv->up_slider_button, &child_allocation);
gtk_widget_get_clip (path_bar->priv->up_slider_button, &child_clip);
gdk_rectangle_union (&clip, &child_clip, &clip);
gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
gtk_widget_show (path_bar->priv->up_slider_button);
@ -669,6 +675,8 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
child_allocation.x = down_slider_offset + allocation->x;
gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
gtk_widget_get_clip (path_bar->priv->down_slider_button, &child_clip);
gdk_rectangle_union (&clip, &child_clip, &clip);
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, TRUE);
gtk_widget_show (path_bar->priv->down_slider_button);
@ -679,7 +687,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
gtk_widget_set_child_visible (path_bar->priv->down_slider_button, FALSE);
}
_gtk_widget_set_simple_clip (widget, NULL);
gtk_widget_set_clip (widget, &clip);
}
static void