opcodes: add routine to draw window bg
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQT/foVVmI9pK13hPWFohAcXSWbK8wUCZcr8/wAKCRBohAcXSWbK 89WGAQD0BBxdjo1PnBqeK2wA0MZvJ8S8kd0/6C3fWllMgXhtTwD/eu6x5LOsSAWo HBZb1Us+LK/IZfWGZlhdA/xN7InPMAo= =g/s6 -----END PGP SIGNATURE-----
1 files changed,
14 insertions(+),
0 deletions(-)
jump to
M
opcodes.c
→
opcodes.c
@@ -13,6 +13,18 @@ void set_handler(Opcode o, Handler h) {
handlers[o] = h; } +static void window_redraw(Node* self) { + short fheight = self->memory->editorState[0]->frame->font->height; + + /* TODO: tagrect's height should be multiplied by the numer of lines in the tag */ + + Rectangle tagrect = Rect(0,0,self->memory->img->r.max.x,fheight); + Rectangle bodyrect = Rect(0,fheight,self->memory->img->r.max.x,self->memory->img->r.max.y); + + draw(self->memory->img, tagrect, tagcols[BACK], nil, tagrect.min); + draw(self->memory->img, bodyrect, textcols[BACK], nil, bodyrect.min); +} + static void handle_init(void* node, void* data) { Node* self = (Node*)node;@@ -36,6 +48,8 @@
f = openfont(display, PRIMARY_FONT); frinit(tag->frame, r, f, self->memory->img, tagcols); frinit(body->frame, r2, f, self->memory->img, textcols); + + window_redraw(self); Rune* rr = testdata; for (char* c = testbytes; *c; c++, rr++) {