[gtk+] color swatch: Use right allocation for window



commit 1f65f1b746fb5948dc2ba29a3e281e9730f9d616
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 13 13:58:52 2016 -0500

    color swatch: Use right allocation for window
    
    Generally, input-only windows that correspond to CSS boxes
    should be sized to the border allocation of the gadget.

 gtk/gtkcolorswatch.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 175167f..8d1b608 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -507,13 +507,6 @@ swatch_size_allocate (GtkWidget     *widget,
 
   gtk_widget_set_allocation (widget, allocation);
 
-  if (gtk_widget_get_realized (widget))
-    gdk_window_move_resize (swatch->priv->event_window,
-                            allocation->x,
-                            allocation->y,
-                            allocation->width,
-                            allocation->height);
-
   gtk_css_gadget_allocate (swatch->priv->gadget,
                            allocation,
                            gtk_widget_get_allocated_baseline (widget),
@@ -526,6 +519,18 @@ swatch_size_allocate (GtkWidget     *widget,
   gdk_rectangle_union (&clip, &clip2, &clip);
 
   gtk_widget_set_clip (widget, &clip);
+
+  if (gtk_widget_get_realized (widget))
+    {
+      GtkAllocation border_allocation;
+      gtk_css_gadget_get_border_allocation(swatch->priv->gadget, &border_allocation, NULL);
+      gdk_window_move_resize (swatch->priv->event_window,
+                              border_allocation.x,
+                              border_allocation.y,
+                              border_allocation.width,
+                              border_allocation.height);
+    }
+
 }
 
 static void


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