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
This commit is contained in:
committed by
Jakub Steiner
parent
7644c0866b
commit
e28c7a41ee
@@ -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;
|
||||
|
||||
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;
|
||||
@@ -465,13 +466,17 @@ gtk_switch_allocate_contents (GtkCssGadget *gadget,
|
||||
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)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user