summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorQC <qball@gmpclient.org>2014-11-09 12:35:12 +0100
committerQC <qball@gmpclient.org>2014-11-09 12:35:12 +0100
commit03f919a0fbb7ff4397768437037de9423d57f409 (patch)
tree5a18f199b53fe71a6eed3149040ead190011d2f0 /source
parent7f7f3acafbc3a24db81b0375b5071ec1a7e4eca0 (diff)
Fix center mode.
Diffstat (limited to 'source')
-rw-r--r--source/textbox.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/textbox.c b/source/textbox.c
index 26fea7f8..3cbcb293 100644
--- a/source/textbox.c
+++ b/source/textbox.c
@@ -252,7 +252,8 @@ void textbox_draw ( textbox *tb )
x = ( tb->w - line_width ) * PANGO_SCALE;
}
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;
// Render the layout.
@@ -261,7 +262,7 @@ void textbox_draw ( textbox *tb )
// draw the cursor
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 );