]> Pileus Git - ~andy/gtk/commitdiff
Return a sufficient width for cases where pango_layout_get_pixel_extents()
authorMatthias Clasen <mclasen@redhat.com>
Mon, 2 May 2005 17:53:52 +0000 (17:53 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 2 May 2005 17:53:52 +0000 (17:53 +0000)
2005-05-02  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkcellrenderertext.c (get_size): Return a sufficient
width for cases where pango_layout_get_pixel_extents() returns
a rectangle with nonzero x.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkcellrenderertext.c

index 1db7d1bc78592d86ded90a74da9c6097c781bc7f..7043b5a34e99fc5d121bafc6d2c8e5fd3ed4982d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-05-02  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcellrenderertext.c (get_size): Return a sufficient
+       width for cases where pango_layout_get_pixel_extents() returns
+       a rectangle with nonzero x. 
+
        * gtk/gtkselection.c: Small doc fixes.
 
        * gtk/gtkmenushell.c (gtk_menu_shell_set_take_focus): 
index 1db7d1bc78592d86ded90a74da9c6097c781bc7f..7043b5a34e99fc5d121bafc6d2c8e5fd3ed4982d 100644 (file)
@@ -1,5 +1,9 @@
 2005-05-02  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcellrenderertext.c (get_size): Return a sufficient
+       width for cases where pango_layout_get_pixel_extents() returns
+       a rectangle with nonzero x. 
+
        * gtk/gtkselection.c: Small doc fixes.
 
        * gtk/gtkmenushell.c (gtk_menu_shell_set_take_focus): 
index 1db7d1bc78592d86ded90a74da9c6097c781bc7f..7043b5a34e99fc5d121bafc6d2c8e5fd3ed4982d 100644 (file)
@@ -1,5 +1,9 @@
 2005-05-02  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcellrenderertext.c (get_size): Return a sufficient
+       width for cases where pango_layout_get_pixel_extents() returns
+       a rectangle with nonzero x. 
+
        * gtk/gtkselection.c: Small doc fixes.
 
        * gtk/gtkmenushell.c (gtk_menu_shell_set_take_focus): 
index f7d93b519e93b540cbdc876919eaebde86f4a9a9..b3235c44a8d11f101f5a0d4d01ce7171a9152634 100644 (file)
@@ -1516,7 +1516,7 @@ get_size (GtkCellRenderer *cell,
   pango_layout_get_pixel_extents (layout, NULL, &rect);
 
   if (height)
-    *height = GTK_CELL_RENDERER (celltext)->ypad * 2 + rect.height;
+    *height = cell->ypad * 2 + rect.height;
 
   /* The minimum size for ellipsized labels is ~ 3 chars */
   if (width)
@@ -1533,12 +1533,11 @@ get_size (GtkCellRenderer *cell,
          char_width = pango_font_metrics_get_approximate_char_width (metrics);
          pango_font_metrics_unref (metrics);
          
-         *width = GTK_CELL_RENDERER (celltext)->xpad * 2
-           + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, 3));
+         *width = cell->xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, 3));
        }
       else
        {
-         *width = GTK_CELL_RENDERER (celltext)->xpad * 2 + rect.width;
+         *width = cell->xpad * 2 + rect.x + rect.width;
        }         
     }
 
@@ -1547,16 +1546,16 @@ get_size (GtkCellRenderer *cell,
       if (x_offset)
        {
          if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-           *x_offset = (1.0 - cell->xalign) * (cell_area->width - rect.width - (2 * cell->xpad));
+           *x_offset = (1.0 - cell->xalign) * (cell_area->width - (rect.x + rect.width + 2 * cell->xpad));
          else 
-           *x_offset = cell->xalign * (cell_area->width - rect.width - (2 * cell->xpad));
+           *x_offset = cell->xalign * (cell_area->width - (rect.x + rect.width + 2 * cell->xpad));
 
          if (priv->ellipsize_set || priv->wrap_width != -1)
            *x_offset = MAX(*x_offset, 0);
        }
       if (y_offset)
        {
-         *y_offset = cell->yalign * (cell_area->height - rect.height - (2 * cell->ypad));
+         *y_offset = cell->yalign * (cell_area->height - (rect.height + 2 * cell->ypad));
          *y_offset = MAX (*y_offset, 0);
        }
     }