diff options
author | Dave Davenport <qball@blame.services> | 2022-07-23 00:55:59 +0200 |
---|---|---|
committer | Dave Davenport <qball@blame.services> | 2022-07-23 00:55:59 +0200 |
commit | 7bd77684db07c6d8d2c083c73bc30885945d6bab (patch) | |
tree | 63725d6f914c481ae222e3230e8c9ef5ba505cf6 | |
parent | 0e90fb065f488cde2584e1f0059e169141b04830 (diff) |
[Textbox] Fix multi-select dot placement.
-rw-r--r-- | source/widgets/textbox.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 85bbe87a..b8915e45 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -453,14 +453,14 @@ static void textbox_draw(widget *wid, cairo_t *draw) { return; } textbox *tb = (textbox *)wid; - unsigned int dot_offset = ((tb->flags & TB_INDICATOR) ? DOT_OFFSET : 0); + int dot_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)); + int x; int top = widget_padding_get_top(WIDGET(tb)); int y = (pango_font_metrics_get_ascent(tb->tbfc->metrics) - pango_layout_get_baseline(tb->layout)) / @@ -475,10 +475,6 @@ static void textbox_draw(widget *wid, cairo_t *draw) { } y += top; - x += dot_offset; - - if (tb->xalign > 0.001) { - } // TODO check if this is still needed after flatning. cairo_set_operator(draw, CAIRO_OPERATOR_OVER); cairo_set_source_rgb(draw, 0.0, 0.0, 0.0); @@ -493,7 +489,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) { case PANGO_ALIGN_CENTER: { int rem = MAX(0, tb->widget.w - widget_padding_get_padding_width(WIDGET(tb)) - - line_width); + line_width - dot_offset); x = (tb->xalign - 0.5) * rem + widget_padding_get_left(WIDGET(tb)); cairo_move_to(draw, x, top); break; @@ -501,7 +497,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) { case PANGO_ALIGN_RIGHT: { int rem = MAX(0, tb->widget.w - widget_padding_get_padding_width(WIDGET(tb)) - - line_width); + line_width - dot_offset); x = -(1.0 - tb->xalign) * rem + widget_padding_get_left(WIDGET(tb)); cairo_move_to(draw, x, top); break; @@ -509,8 +505,9 @@ static void textbox_draw(widget *wid, cairo_t *draw) { default: { int rem = MAX(0, tb->widget.w - widget_padding_get_padding_width(WIDGET(tb)) - - line_width); + line_width - dot_offset); x = tb->xalign * rem + widget_padding_get_left(WIDGET(tb)); + x += dot_offset; cairo_move_to(draw, x, top); break; } |