[gtk/issue-1631] switch: Take gadget clip into account
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/issue-1631] switch: Take gadget clip into account
- Date: Wed, 30 Jan 2019 18:41:58 +0000 (UTC)
commit 0a9aa768d83bbf5753379c31fb2123c510fdd02f
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 | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 88596c7d1f..a26c97bc28 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;
+
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)))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]