[libgd/wip/taggedentry] Fix allocation



commit d53b86e453aed9bd9bc22305e9b845176e7c255f
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Sat Jul 13 12:38:27 2013 +0200

    Fix allocation

 libgd/gd-tagged-entry.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/libgd/gd-tagged-entry.c b/libgd/gd-tagged-entry.c
index c8cf0f0..5060682 100644
--- a/libgd/gd-tagged-entry.c
+++ b/libgd/gd-tagged-entry.c
@@ -134,8 +134,7 @@ gd_tagged_entry_tag_panel_get_height (GdTaggedEntryTag *tag,
 }
 
 static void
-gd_tagged_entry_tag_panel_get_position (GdTaggedEntryTag *tag,
-                                        GdTaggedEntry *self,
+gd_tagged_entry_tag_panel_get_position (GdTaggedEntry *self,
                                         gint *x_out, 
                                         gint *y_out)
 {
@@ -143,20 +142,18 @@ gd_tagged_entry_tag_panel_get_position (GdTaggedEntryTag *tag,
   gint text_x, text_y, text_width, text_height, req_height;
   GtkAllocation allocation;
   GtkRequisition requisition;
-  GtkBorder margin;
 
   gtk_widget_get_allocation (widget, &allocation);
   gtk_widget_get_preferred_size (widget, &requisition, NULL);
   req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom 
(widget);
 
   gd_tagged_entry_get_text_area_size (GTK_ENTRY (self), &text_x, &text_y, &text_width, &text_height);
-  gd_tagged_entry_tag_get_margin (tag, self, &margin);
 
   /* allocate the panel immediately after the text area */
   if (x_out)
     *x_out = allocation.x + text_x + text_width;
   if (y_out)
-    *y_out = allocation.y + margin.top + (gint) floor ((allocation.height - req_height) / 2);
+    *y_out = allocation.y + (gint) floor ((allocation.height - req_height) / 2);
 }
 
 static gint
@@ -653,13 +650,16 @@ gd_tagged_entry_size_allocate (GtkWidget *widget,
 
   if (gtk_widget_get_realized (widget))
     {
+      gd_tagged_entry_tag_panel_get_position (self, &x, &y);
 
       for (l = self->priv->tags; l != NULL; l = l->next)
         {
+          GtkBorder margin;
+
           tag = l->data;
-          gd_tagged_entry_tag_panel_get_position (tag, self, &x, &y);
           gd_tagged_entry_tag_get_size (tag, self, &width, &height);
-          gdk_window_move_resize (tag->window, x, y, width, height);
+          gd_tagged_entry_tag_get_margin (tag, self, &margin);
+          gdk_window_move_resize (tag->window, x, y + margin.top, width, height);
 
           x += width;
         }


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