[gtk/issue-1631] switch: Take gadget clip into account



commit 8901ab1a4685c4aa164bb5439fadfedcf20652f4
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jan 30 17:31:07 2019 +0000

    switch: Take gadget clip into account
    
    Now that we've switched the on and off states to gadgets, we need to
    ensure that the widget's clip take into account the clip of every
    gadget.
    
    Fixes #1631

 gtk/gtkswitch.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 88596c7d1f..8fe98fc5f6 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -449,7 +449,8 @@ gtk_switch_allocate_contents (GtkCssGadget        *gadget,
   GtkSwitch *self = GTK_SWITCH (gtk_css_gadget_get_owner (gadget));
   GtkSwitchPrivate *priv = self->priv;
   GtkAllocation child_alloc;
-  
+  GtkAllocation on_clip, off_clip, slider_clip;
+
   child_alloc.x = allocation->x + round (priv->handle_pos * (allocation->width - allocation->width / 2));
   child_alloc.y = allocation->y;
   child_alloc.width = allocation->width / 2;
@@ -458,20 +459,26 @@ gtk_switch_allocate_contents (GtkCssGadget        *gadget,
   gtk_css_gadget_allocate (priv->slider_gadget,
                            &child_alloc,
                            baseline,
-                           out_clip);
+                           &slider_clip);
+
+  gdk_rectangle_union (out_clip, &slider_clip, out_clip);
 
   child_alloc.x = allocation->x;
 
   gtk_css_gadget_allocate (priv->on_gadget,
                            &child_alloc,
                            baseline,
-                           out_clip);
+                           &on_clip);
+
+  gdk_rectangle_union (out_clip, &on_clip, out_clip);
 
   child_alloc.x = allocation->x + allocation->width - child_alloc.width;
   gtk_css_gadget_allocate (priv->off_gadget,
                            &child_alloc,
                            baseline,
-                           out_clip);
+                           &off_clip);
+
+  gdk_rectangle_union (out_clip, &off_clip, out_clip);
 
   if (gtk_widget_get_realized (GTK_WIDGET (self)))
     {


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