[Textbox] cairo_save/restore does not store path.

Fix by moving cairo_move_to to after blink.
Also fix drawing outline.
This commit is contained in:
Dave Davenport 2023-02-23 15:14:11 +01:00
parent f6248c6ea9
commit a5bd8bc630

View file

@ -505,7 +505,6 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
MAX(0, tb->widget.w - widget_padding_get_padding_width(WIDGET(tb)) -
line_width - dot_offset);
x = (tb->xalign - 0.5) * rem + widget_padding_get_left(WIDGET(tb));
cairo_move_to(draw, x, top);
break;
}
case PANGO_ALIGN_RIGHT: {
@ -513,7 +512,6 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
MAX(0, tb->widget.w - widget_padding_get_padding_width(WIDGET(tb)) -
line_width - dot_offset);
x = -(1.0 - tb->xalign) * rem + widget_padding_get_left(WIDGET(tb));
cairo_move_to(draw, x, top);
break;
}
default: {
@ -522,7 +520,6 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
line_width - dot_offset);
x = tb->xalign * rem + widget_padding_get_left(WIDGET(tb));
x += dot_offset;
cairo_move_to(draw, x, top);
break;
}
}
@ -550,7 +547,6 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
if ( tb->blink) {
// use text color as fallback for themes that don't specify the cursor
// color
cairo_save(draw);
rofi_theme_get_color(WIDGET(tb), "cursor-color", draw);
cairo_rectangle(draw, x + cursor_x, y + cursor_y, cursor_pixel_width,
cursor_height);
@ -564,7 +560,6 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
} else {
cairo_fill(draw);
}
cairo_restore(draw);
}
}
@ -578,11 +573,13 @@ static void textbox_draw(widget *wid, cairo_t *draw) {
rofi_theme_get_color(WIDGET(tb), "placeholder-color", draw);
show_outline = FALSE;
}
cairo_move_to(draw, x, top);
pango_cairo_show_layout(draw, tb->layout);
if (show_outline) {
rofi_theme_get_color(WIDGET(tb), "text-outline-color", draw);
double width = rofi_theme_get_double(WIDGET(tb), "text-outline-width", 0.5);
cairo_move_to(draw, x, top);
pango_cairo_layout_path(draw, tb->layout);
cairo_set_line_width(draw, width);
cairo_stroke(draw);