From a8ceeb17667e40b61806e3e9a8e631c304e30b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 12 Jan 2016 21:36:37 +0100 Subject: [PATCH] switch: Don't include margins in input window size https://bugzilla.gnome.org/show_bug.cgi?id=760509 --- gtk/gtkswitch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c index 8c1616faea..9f6f6596ba 100644 --- a/gtk/gtkswitch.c +++ b/gtk/gtkswitch.c @@ -485,6 +485,17 @@ gtk_switch_allocate_contents (GtkCssGadget *gadget, &slider_alloc, baseline, out_clip); + + if (gtk_widget_get_realized (GTK_WIDGET (self))) + { + GtkAllocation border_allocation; + gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL); + gdk_window_move_resize (priv->event_window, + border_allocation.x, + border_allocation.y, + border_allocation.width, + border_allocation.height); + } } static void @@ -495,19 +506,11 @@ gtk_switch_size_allocate (GtkWidget *widget, GtkAllocation clip; gtk_widget_set_allocation (widget, allocation); - - if (gtk_widget_get_realized (widget)) - gdk_window_move_resize (priv->event_window, - allocation->x, - allocation->y, - allocation->width, - allocation->height); - gtk_css_gadget_allocate (priv->gadget, allocation, gtk_widget_get_allocated_baseline (widget), &clip); - + gtk_widget_set_clip (widget, &clip); }