1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Fix ellip. in entry box, wrap message box.

This commit is contained in:
Dave Davenport 2015-06-03 09:04:29 +02:00
parent 8a3510e033
commit e517001d39
3 changed files with 17 additions and 9 deletions

View file

@ -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:

View file

@ -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 );

View file

@ -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 )