Merge branch 'issue-1631' into 'gtk-3-24'

switch: Take gadget clip into account

See merge request GNOME/gtk!543
This commit is contained in:
Benjamin Otte
2019-01-30 19:20:46 +00:00

View File

@@ -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)))
{