[gtk+] GtkEntry: ellipsize placeholder text



commit c27ddc66c573ae897945155e3ef6e1b64d630fba
Author: Jonh Wendell <jonh wendell intel com>
Date:   Thu Jun 20 14:39:28 2013 -0300

    GtkEntry: ellipsize placeholder text
    
    The placeholder string is truncated when there's no
    room for it in entry's width.
    
    So, by ellipsizing it, the user can notice the text
    was truncated so that they can workaround that by,
    for example, maximizing the window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702763

 gtk/gtkentry.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 8158c81..c4e6013 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -5987,6 +5987,7 @@ gtk_entry_create_layout (GtkEntry *entry,
       attr->start_index = 0;
       attr->end_index = G_MAXINT;
       pango_attr_list_insert (tmp_attrs, attr);
+      pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
     }
 
   if (preedit_length)
@@ -6127,6 +6128,9 @@ draw_text_with_color (GtkEntry *entry,
 
   get_layout_position (entry, &x, &y);
 
+  if (show_placeholder_text (entry))
+    pango_layout_set_width (layout, PANGO_SCALE * gdk_window_get_width (entry->priv->text_area));
+
   cairo_move_to (cr, x, y);
   gdk_cairo_set_source_rgba (cr, default_color);
   pango_cairo_show_layout (cr, layout);


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