[gtk+] modelbutton: Don't include margins in input window size



commit ff7e2797f6ffb61eb5dcb7865a85322c8ef22238
Author: Timm Bäder <mail baedert org>
Date:   Tue Jan 12 20:25:25 2016 +0100

    modelbutton: Don't include margins in input window size
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760509

 gtk/gtkmodelbutton.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index adeac69..e67a57e 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -860,12 +860,6 @@ gtk_model_button_size_allocate (GtkWidget     *widget,
     gadget = GTK_MODEL_BUTTON (widget)->gadget;
 
   gtk_widget_set_allocation (widget, allocation);
-
-  if (gtk_widget_get_realized (widget))
-    gdk_window_move_resize (gtk_button_get_event_window (GTK_BUTTON (widget)),
-                            allocation->x, allocation->y,
-                            allocation->width, allocation->height);
-
   gtk_css_gadget_allocate (gadget,
                            allocation,
                            gtk_widget_get_allocated_baseline (widget),
@@ -959,6 +953,19 @@ gtk_model_button_allocate (GtkCssGadget        *gadget,
     (pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics));
   pango_font_metrics_unref (metrics);
 
+
+  if (gtk_widget_get_realized (widget))
+    {
+      GtkAllocation border_allocation;
+      gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
+
+      gdk_window_move_resize (gtk_button_get_event_window (GTK_BUTTON (widget)),
+                              border_allocation.x,
+                              border_allocation.y,
+                              border_allocation.width,
+                              border_allocation.height);
+    }
+
   gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
   gdk_rectangle_union (out_clip, &check_clip, out_clip);
 }


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