[gtk+/gtk-3-8] GtkEntry: ellipsize placeholder text



commit d7798950edbc2bd1e78b89ff4f438bdada1fa2f9
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 1c247fc..044481b 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -5934,6 +5934,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)
@@ -6074,6 +6075,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]