summary refs log tree commit diff
path: root/keyboard.h
diff options
context:
space:
mode:
authorMaarten van Gompel <proycon@anaproy.nl>2021-08-23 22:35:14 +0200
committerJohn Sullivan <jsullivan@csumb.edu>2021-10-19 23:12:01 -0700
commite5dfc175e9573d5f48cfa67d86473ec5344c4da6 (patch)
tree3cc70f9af180ffd80e4519edb262c9d95601d7f5 /keyboard.h
parent5746095e12d53e9572038f0c87c6575d3fc34288 (diff)
downloadsuggpicker-e5dfc175e9573d5f48cfa67d86473ec5344c4da6.tar.gz
added support for an additional colour scheme
Diffstat (limited to 'keyboard.h')
-rw-r--r--keyboard.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/keyboard.h b/keyboard.h
index 2e037d9..8580602 100644
--- a/keyboard.h
+++ b/keyboard.h
@@ -48,6 +48,7 @@ struct key {
 						   *   XKB keycodes are +8 */
 	struct layout *layout; //pointer back to the parent layout that holds this key
 	const uint32_t code_mod; /* modifier to force when this key is pressed */
+	uint8_t scheme; //index of the scheme to use
 	bool reset_mod; /* reset modifiers when clicked */
 
 	//actual coordinates on the surface (pixels), will be computed automatically for all keys
@@ -64,6 +65,7 @@ struct kbd {
 	struct layout *layout;
 	struct layout *prevlayout;
 	struct clr_scheme scheme;
+	struct clr_scheme scheme1;
 
 	uint32_t w, h;
 	uint8_t mods;
@@ -258,11 +260,12 @@ kbd_draw_key(struct kbd *kb, struct key *k, bool pressed) {
 	struct drwsurf *d = kb->surf;
 	const char *label = (kb->mods & Shift) ? k->shift_label : k->label;
     fprintf(stderr, "Draw key +%d+%d %dx%d -> %s\n", k->x, k->y, k->w, k->h, k->label);
-	Color *fill = pressed ? &kb->scheme.high : &kb->scheme.fg;
+	struct clr_scheme  * scheme = (k->scheme == 0) ? &(kb->scheme) : &(kb->scheme1);
+	Color *fill = pressed ? &scheme->high : &scheme->fg;
 	draw_inset(d, k->x, k->y, k->w, k->h, KBD_KEY_BORDER, fill->color);
 	uint32_t xoffset = k->w /  (strlen(label) + 2);
     fprintf(stderr, "  xoffset=%d\n", xoffset);
-	wld_draw_text(d->render, d->ctx->font, kb->scheme.text.color,
+	wld_draw_text(d->render, d->ctx->font, scheme->text.color,
 	              k->x + xoffset, k->y + (k->h / 2), label, -1, NULL);
 }