From 5f954df63c958dfef8d1cb7e296a3d38d45610ed Mon Sep 17 00:00:00 2001 From: ve5li Date: Wed, 27 Sep 2023 17:32:16 +0200 Subject: [PATCH 1/2] Fix text color when cursor color is set --- source/widgets/textbox.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index c1f0eabcd..727519bc3 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -540,6 +540,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) { tb->cursor_x_pos = x + cursor_x; } if (tb->blink) { + cairo_save(draw); // use text color as fallback for themes that don't specify the cursor // color rofi_theme_get_color(WIDGET(tb), "cursor-color", draw); @@ -555,6 +556,7 @@ static void textbox_draw(widget *wid, cairo_t *draw) { } else { cairo_fill(draw); } + cairo_restore(draw); } } From 11a3cc3ed7854a0bd691353373c40058d4c9f79e Mon Sep 17 00:00:00 2001 From: ve5li Date: Wed, 27 Sep 2023 17:38:06 +0200 Subject: [PATCH 2/2] Add comment --- source/widgets/textbox.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 727519bc3..592504039 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -540,6 +540,8 @@ static void textbox_draw(widget *wid, cairo_t *draw) { tb->cursor_x_pos = x + cursor_x; } if (tb->blink) { + // This save/restore state is necessary to render the text in the + // correct color when `cursor-color` is set cairo_save(draw); // use text color as fallback for themes that don't specify the cursor // color