mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Fix icon offset.
- Always add more ()
This commit is contained in:
parent
21615ccacd
commit
044c55dd2f
1 changed files with 11 additions and 11 deletions
|
@ -327,7 +327,7 @@ void textbox_icon ( textbox *tb, cairo_surface_t *icon )
|
||||||
// within the parent handled auto width/height modes
|
// within the parent handled auto width/height modes
|
||||||
void textbox_moveresize ( textbox *tb, int x, int y, int w, int h )
|
void textbox_moveresize ( textbox *tb, int x, int y, int w, int h )
|
||||||
{
|
{
|
||||||
unsigned int offset = tb->left_offset + ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0;
|
unsigned int offset = tb->left_offset + (( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0);
|
||||||
if ( tb->flags & TB_AUTOWIDTH ) {
|
if ( tb->flags & TB_AUTOWIDTH ) {
|
||||||
pango_layout_set_width ( tb->layout, -1 );
|
pango_layout_set_width ( tb->layout, -1 );
|
||||||
w = textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( WIDGET ( tb ) ) + offset;
|
w = textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( WIDGET ( tb ) ) + offset;
|
||||||
|
@ -862,9 +862,9 @@ int textbox_get_font_height ( const textbox *tb )
|
||||||
|
|
||||||
int textbox_get_font_width ( const textbox *tb )
|
int textbox_get_font_width ( const textbox *tb )
|
||||||
{
|
{
|
||||||
int width;
|
PangoRectangle rect;
|
||||||
pango_layout_get_pixel_size ( tb->layout, &width, NULL );
|
pango_layout_get_pixel_extents ( tb->layout, NULL, &rect );
|
||||||
return width;
|
return rect.width+rect.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Caching for the expected character height. */
|
/** Caching for the expected character height. */
|
||||||
|
@ -897,7 +897,7 @@ int textbox_get_estimated_height ( const textbox *tb, int eh )
|
||||||
int textbox_get_desired_width ( widget *wid )
|
int textbox_get_desired_width ( widget *wid )
|
||||||
{
|
{
|
||||||
textbox *tb = (textbox *) wid;
|
textbox *tb = (textbox *) wid;
|
||||||
unsigned int offset = tb->left_offset + ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0;
|
unsigned int offset = tb->left_offset + (( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0);
|
||||||
if ( wid->expand && tb->flags & TB_AUTOWIDTH ) {
|
if ( wid->expand && tb->flags & TB_AUTOWIDTH ) {
|
||||||
return textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( wid ) + offset;
|
return textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( wid ) + offset;
|
||||||
}
|
}
|
||||||
|
@ -907,12 +907,12 @@ int textbox_get_desired_width ( widget *wid )
|
||||||
{
|
{
|
||||||
return wi;
|
return wi;
|
||||||
}
|
}
|
||||||
int width = 0;
|
int padding = widget_padding_get_left ( WIDGET ( tb ) );
|
||||||
|
padding += widget_padding_get_right ( WIDGET ( tb ) );
|
||||||
|
int old_width = pango_layout_get_width ( tb->layout );
|
||||||
pango_layout_set_width ( tb->layout, -1 );
|
pango_layout_set_width ( tb->layout, -1 );
|
||||||
width = textbox_get_font_width ( tb );
|
int width = textbox_get_font_width ( tb );
|
||||||
// Restore.
|
// Restore.
|
||||||
pango_layout_set_width ( tb->layout, PANGO_SCALE * ( tb->widget.w - widget_padding_get_padding_width ( WIDGET ( tb ) ) - offset ) );
|
pango_layout_set_width ( tb->layout, old_width );
|
||||||
width = width + widget_padding_get_padding_width ( wid ) + offset;
|
return width + padding + offset;
|
||||||
|
|
||||||
return width;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue