summaryrefslogtreecommitdiffstats
path: root/source/widgets/textbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/widgets/textbox.c')
-rw-r--r--source/widgets/textbox.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index 77d7ef28..097748cc 100644
--- a/source/widgets/textbox.c
+++ b/source/widgets/textbox.c
@@ -330,15 +330,13 @@ static void textbox_free ( widget *wid )
static void textbox_draw ( widget *wid, cairo_t *draw )
{
- textbox *tb = (textbox *) wid;
- unsigned int offset = ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0;
-
+ textbox *tb = (textbox *) wid;
+ unsigned int offset = ( tb->flags & TB_INDICATOR ) ? DOT_OFFSET : 0;
if ( tb->changed ) {
__textbox_update_pango_text ( tb );
}
-
// Skip the side MARGIN on the X axis.
int x = widget_padding_get_left ( WIDGET ( tb ) ) + offset;
@@ -360,7 +358,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
rofi_theme_get_color ( WIDGET ( tb ), "text", draw );
// draw the cursor
if ( tb->flags & TB_EDITABLE && tb->blink ) {
- int y = top + ( pango_font_metrics_get_ascent ( tb->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE;
+ int y = top + ( pango_font_metrics_get_ascent ( tb->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE;
// We want to place the cursor based on the text shown.
const char *text = pango_layout_get_text ( tb->layout );
// Clamp the position, should not be needed, but we are paranoid.
@@ -369,10 +367,10 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
// convert to byte location.
char *offset = g_utf8_offset_to_pointer ( text, cursor_offset );
pango_layout_get_cursor_pos ( tb->layout, offset - text, &pos, NULL );
- int cursor_x = pos.x / PANGO_SCALE;
- int cursor_y = pos.y / PANGO_SCALE;
- int cursor_height = pos.height / PANGO_SCALE;
- int cursor_width = 2;
+ int cursor_x = pos.x / PANGO_SCALE;
+ int cursor_y = pos.y / PANGO_SCALE;
+ int cursor_height = pos.height / PANGO_SCALE;
+ int cursor_width = 2;
cairo_rectangle ( draw, x + cursor_x, y + cursor_y, cursor_width, cursor_height );
cairo_fill ( draw );
}