diff options
author | Dave Davenport <qball@gmpclient.org> | 2015-06-03 09:04:29 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2015-06-03 09:04:29 +0200 |
commit | e517001d3951a4bb299c11ca427902ec7771f2b1 (patch) | |
tree | 390bbe0723979a41400896573735869a33af2f9f | |
parent | 8a3510e03374dc4dcc5f26fad214d7e1bed80cf7 (diff) |
Fix ellip. in entry box, wrap message box.
-rw-r--r-- | Changelog | 4 | ||||
-rw-r--r-- | source/rofi.c | 3 | ||||
-rw-r--r-- | source/textbox.c | 19 |
3 files changed, 17 insertions, 9 deletions
@@ -1,5 +1,7 @@ 0.15.6 (unrelease): - + Bug fixes: + - Auto-wrap text in message dialog. + - Fix ellipsiziing in entry box. 0.15.5: Bug fixes: diff --git a/source/rofi.c b/source/rofi.c index 96034e11..7d811def 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1020,7 +1020,8 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom state.message_tb = textbox_create ( main_window, &vinfo, map, TB_AUTOHEIGHT | TB_MARKUP, ( config.padding ), state.top_offset, - entrybox_width, -1, + state.w - ( 2 * ( config.padding ) ), + -1, NORMAL, message ); textbox_show ( state.message_tb ); diff --git a/source/textbox.c b/source/textbox.c index 9bc37e20..d5fe2e52 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -119,6 +119,7 @@ textbox* textbox_create ( Window parent, textbox_font ( tb, tbft ); if ( ( flags & TB_MARKUP ) == TB_MARKUP ) { + pango_layout_set_wrap ( tb->layout, PANGO_WRAP_WORD_CHAR ); textbox_text_markup ( tb, text ? text : "" ); } else{ @@ -228,10 +229,6 @@ void textbox_move ( textbox *tb, int x, int y ) // within the parent handled auto width/height modes void textbox_moveresize ( textbox *tb, int x, int y, int w, int h ) { - if ( tb->flags & TB_AUTOHEIGHT ) { - h = textbox_get_height ( tb ); - } - if ( tb->flags & TB_AUTOWIDTH ) { pango_layout_set_width ( tb->layout, -1 ); if ( w > 1 ) { @@ -246,19 +243,27 @@ void textbox_moveresize ( textbox *tb, int x, int y, int w, int h ) if ( ( tb->flags & TB_EDITABLE ) == TB_EDITABLE ) { pango_layout_set_ellipsize ( tb->layout, PANGO_ELLIPSIZE_MIDDLE ); } - else{ + else if ( ( tb->flags & TB_MARKUP ) != TB_MARKUP ) { pango_layout_set_ellipsize ( tb->layout, PANGO_ELLIPSIZE_END ); } } + if ( tb->flags & TB_AUTOHEIGHT ) { + // Width determines height! + int tw = MAX ( 1, w ); + pango_layout_set_width ( tb->layout, PANGO_SCALE * ( tw - 2 * SIDE_MARGIN ) ); + h = textbox_get_height ( tb ); + } + if ( x != tb->x || y != tb->y || w != tb->w || h != tb->h ) { tb->x = x; tb->y = y; - tb->w = MAX ( 1, w ); tb->h = MAX ( 1, h ); + tb->w = MAX ( 1, w ); XMoveResizeWindow ( display, tb->window, tb->x, tb->y, tb->w, tb->h ); - pango_layout_set_width ( tb->layout, PANGO_SCALE * ( tb->w - 2 * SIDE_MARGIN ) ); } + // We always want to update this + pango_layout_set_width ( tb->layout, PANGO_SCALE * ( tb->w - 2 * SIDE_MARGIN ) ); } void textbox_show ( textbox *tb ) |