summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--src/entry_backend/harfbuzz.c19
2 files changed, 19 insertions, 4 deletions
diff --git a/README.md b/README.md
index 64cde1b..99f3fe6 100644
--- a/README.md
+++ b/README.md
@@ -161,6 +161,10 @@ In roughly descending order, the most important options for performance are:
results will speed this up, but since this likely only applies to dmenu-like
themes (which are already very quick) it's probably not worth setting this.
+* `--selection-match-color`, `--selection-background` - Passing either of these
+ options causes some more complex rendering to take place, again leading to a
+ couple of ms slowdown.
+
* `--hint-font` - Getting really into it now, one of the remaining slow points
is hinting fonts. For the dmenu theme on battery power on my laptop, with a
specific font file chosen, the initial text render with the default font
diff --git a/src/entry_backend/harfbuzz.c b/src/entry_backend/harfbuzz.c
index 9868578..b90936f 100644
--- a/src/entry_backend/harfbuzz.c
+++ b/src/entry_backend/harfbuzz.c
@@ -270,8 +270,21 @@ void entry_backend_harfbuzz_update(struct entry *entry)
}
const char *result = entry->results.buf[index].string;
- /* If this isn't the selected result, just print as normal. */
- if (i != entry->selection) {
+ /*
+ * If this isn't the selected result, or it is but we're not
+ * doing any fancy match-highlighting or backgrounds, just
+ * print as normal.
+ */
+ if (i != entry->selection
+ || (entry->selection_highlight_color.a == 0
+ && entry->selection_background_color.a == 0)) {
+ if (i == entry->selection) {
+ color = entry->selection_foreground_color;
+ } else {
+ color = entry->foreground_color;
+ }
+ cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
+
hb_buffer_clear_contents(buffer);
setup_hb_buffer(buffer);
hb_buffer_add_utf8(buffer, result, -1, 0, -1);
@@ -444,8 +457,6 @@ void entry_backend_harfbuzz_update(struct entry *entry)
cairo_fill(cr);
cairo_restore(cr);
cairo_paint(cr);
- color = entry->foreground_color;
- cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
}
}
entry->num_results_drawn = i;