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

Fix center mode.

This commit is contained in:
QC 2014-11-09 12:35:12 +01:00
parent 7f7f3acafb
commit 03f919a0fb

View file

@ -252,7 +252,8 @@ void textbox_draw ( textbox *tb )
x = ( tb->w - line_width ) * PANGO_SCALE; x = ( tb->w - line_width ) * PANGO_SCALE;
} }
else if ( tb->flags & TB_CENTER ) { else if ( tb->flags & TB_CENTER ) {
x = ( PANGO_SCALE * ( tb->w - line_width ) ) / 2; int tw = textbox_get_font_width ( tb );
x = ( PANGO_SCALE * ( tb->w - tw ) ) / 2;
} }
y = ( PANGO_SCALE * ( textbox_get_width ( tb ) - textbox_get_font_width ( tb ) ) ) / 2; y = ( PANGO_SCALE * ( textbox_get_width ( tb ) - textbox_get_font_width ( tb ) ) ) / 2;
// Render the layout. // Render the layout.
@ -261,7 +262,7 @@ void textbox_draw ( textbox *tb )
// draw the cursor // draw the cursor
if ( tb->flags & TB_EDITABLE ) { if ( tb->flags & TB_EDITABLE ) {
XftDrawRect ( draw, &tb->color_fg, cursor_x + SIDE_MARGIN, SIDE_MARGIN, cursor_width, font_height ); XftDrawRect ( draw, &tb->color_fg, x / PANGO_SCALE + cursor_x + SIDE_MARGIN, SIDE_MARGIN, cursor_width, font_height );
} }
XftDrawRect ( draw, &tb->color_bg, tb->w, 0, 0, tb->h ); XftDrawRect ( draw, &tb->color_bg, tb->w, 0, 0, tb->h );