summaryrefslogtreecommitdiff
path: root/addons/fake/fake.c
diff options
context:
space:
mode:
Diffstat (limited to 'addons/fake/fake.c')
-rw-r--r--addons/fake/fake.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/addons/fake/fake.c b/addons/fake/fake.c
index b3f6b288..b5423317 100644
--- a/addons/fake/fake.c
+++ b/addons/fake/fake.c
@@ -6,7 +6,8 @@
*
* A pane of it counts: keys and clicks and ticks and words each add to a
* count it paints, dumps and answers `where` with; `:N` sets it. It paints
- * which view it is painted for and that view's size as `view` told it. */
+ * which view it is painted for and that view's size as `view` told it,
+ * and the theme's hit colours its window has (since 3.4). */
#include "pardes_addon.h"
/* The loader's tests build it wrong on purpose: another ABI, no export,
@@ -60,6 +61,10 @@ static void view(void *st, const pa_view *v) {
f->cols[v->id - 1] = v->cols, f->rows[v->id - 1] = v->rows;
}
+static void hex(char *out, uint32_t rgb) {
+ for (int i = 0; i < 6; i++) out[i] = "0123456789abcdef"[rgb >> (20 - 4 * i) & 0xf];
+}
+
static void num(char *out, unsigned n) {
char t[12];
int k = 0;
@@ -84,6 +89,12 @@ static void paint(void *st, const pa_window *w, pa_paint *out) {
if (w->glyphs) memcpy(v + strlen(v), " glyphs", 8);
pa_put(w, 3, 0, v, PA_DEFAULT, PA_DEFAULT, 0);
}
+ if (api->abi >= 0x30004u) {
+ char h[] = "hits rrggbb rrggbb";
+ hex(h + 5, w->hit);
+ hex(h + 12, w->hit_current);
+ pa_put(w, 4, 0, h, PA_DEFAULT, PA_DEFAULT, 0);
+ }
if (f && out->cap > 0 && w->rows > 2) {
pa_placement *pl = &out->placements[out->n++];
*pl = (pa_placement){.rgba = f->pixels, .w = 2, .h = 2, .src = {0, 0, 2, 2}, .dst = {0, 2, 2, 1}, .key = f->count};