From 7bebd1d7ddf4bd1421dcaee380995cafc8e9bc15 Mon Sep 17 00:00:00 2001 From: QC Date: Sat, 2 Aug 2014 20:25:43 +0200 Subject: [PATCH] Set ellipsizing in the middle for edit boxes. --- source/textbox.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/textbox.c b/source/textbox.c index 0ab4f580..812319e7 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -178,7 +178,11 @@ void textbox_moveresize ( textbox *tb, int x, int y, int w, int h ) } else { // set ellipsize - pango_layout_set_ellipsize ( tb->layout, PANGO_ELLIPSIZE_END ); + if( (tb->flags & TB_EDITABLE) == TB_EDITABLE ) { + pango_layout_set_ellipsize ( tb->layout, PANGO_ELLIPSIZE_MIDDLE ); + }else{ + pango_layout_set_ellipsize ( tb->layout, PANGO_ELLIPSIZE_END ); + } } if ( x != tb->x || y != tb->y || w != tb->w || h != tb->h ) { @@ -263,9 +267,7 @@ void textbox_draw ( textbox *tb ) x = ( tb->w - line_width ) / 2; } - // draw the text. -// XftDrawStringUtf8 ( draw, &tb->color_fg, tb->font, x, y, ( unsigned char * ) text, length ); - + // Render the layout. pango_xft_render_layout ( draw, &( tb->color_fg ), tb->layout, x, y ); // draw the cursor