[gtk+/wip/baedert/drawing: 265/348] pathbar: Compute widget clip directly



commit f42b00e41e0569026d43e80bacf4245181ef09e3
Author: Timm Bäder <mail baedert org>
Date:   Sun Jun 18 12:25:39 2017 +0200

    pathbar: Compute widget clip directly
    
    Instead of relying on gtk_widge_set_simple_clip

 gtk/gtkpathbar.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index dd90ee1..399bb94 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]