mirror of https://github.com/davatorium/rofi.git
[Textbox|Listview] Fix sizing of textbox.
- don't get height of layout, but calculate height using metrics. - listview, set string with right number of lines. Issue: #925, #1069
This commit is contained in:
parent
cca9fa3372
commit
ca067234ff
|
@ -668,6 +668,13 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca
|
||||||
//
|
//
|
||||||
_listview_row row;
|
_listview_row row;
|
||||||
listview_create_row ( lv, &row );
|
listview_create_row ( lv, &row );
|
||||||
|
// FIXME: hack to scale hight correctly.
|
||||||
|
if ( lv->eh > 1 && row.textbox ) {
|
||||||
|
char buff[lv->eh*2+1] ;
|
||||||
|
memset( buff, '\0', lv->eh*2+1);
|
||||||
|
for ( unsigned int i = 0; i < lv->eh; i++) { buff[i] ='\n'; };
|
||||||
|
textbox_text( row.textbox, buff);
|
||||||
|
}
|
||||||
lv->element_height = widget_get_desired_height ( WIDGET ( row.box ) );
|
lv->element_height = widget_get_desired_height ( WIDGET ( row.box ) );
|
||||||
widget_free ( WIDGET ( row.box ) );
|
widget_free ( WIDGET ( row.box ) );
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ static int textbox_get_desired_height ( widget *wid )
|
||||||
if ( tb->changed ) {
|
if ( tb->changed ) {
|
||||||
__textbox_update_pango_text ( tb );
|
__textbox_update_pango_text ( tb );
|
||||||
}
|
}
|
||||||
int height = textbox_get_height ( tb );
|
int height = textbox_get_estimated_height ( tb, pango_layout_get_line_count ( tb->layout ) );
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,7 +852,7 @@ int _textbox_get_height ( widget *wid )
|
||||||
{
|
{
|
||||||
textbox *tb = (textbox *) wid;
|
textbox *tb = (textbox *) wid;
|
||||||
if ( tb->flags & TB_AUTOHEIGHT ) {
|
if ( tb->flags & TB_AUTOHEIGHT ) {
|
||||||
return textbox_get_height ( tb );
|
return textbox_get_estimated_height ( tb, pango_layout_get_line_count ( tb->layout ) );
|
||||||
}
|
}
|
||||||
return tb->widget.h;
|
return tb->widget.h;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue