diff options
Diffstat (limited to 'swt.c')
| -rw-r--r-- | swt.c | 86 |
1 files changed, 68 insertions, 18 deletions
@@ -48,6 +48,7 @@ typedef struct { Canvas *canvas; FontCache *fontcache; int mode; + int cursor; } Window; @@ -177,23 +178,70 @@ void wdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) { borderpx + oy * win.fontcache->box.height + win.fontcache->fontsize, colors[og.fg] ); - draw_rect( - win.canvas, - borderpx + cx * win.fontcache->box.width, - borderpx + cy * win.fontcache->box.height, - win.fontcache->box.width, - win.fontcache->box.height, - colors[g.fg] - ); - win.fontcache->fonttype = FONTMODE(g.mode); - draw_char( - win.canvas, - win.fontcache, - g.u, - borderpx + cx * win.fontcache->box.width, - borderpx + cy * win.fontcache->box.height + win.fontcache->fontsize, - colors[g.bg] - ); + + switch(win.cursor) { + case 0: + case 1: + case 2: + draw_rect( + win.canvas, + borderpx + cx * win.fontcache->box.width, + borderpx + cy * win.fontcache->box.height, + win.fontcache->box.width, + win.fontcache->box.height, + colors[defaultcursorcolor] + ); + win.fontcache->fonttype = FONTMODE(g.mode); + draw_char( + win.canvas, + win.fontcache, + g.u, + borderpx + cx * win.fontcache->box.width, + borderpx + cy * win.fontcache->box.height + win.fontcache->fontsize, + colors[g.bg] + ); + break; + case 3: + case 4: + draw_rect( + win.canvas, + borderpx + cx * win.fontcache->box.width, + borderpx + cy * win.fontcache->box.height + win.fontcache->box.height - cursorthickness, + win.fontcache->box.width, + cursorthickness, + colors[defaultcursorcolor] + ); + win.fontcache->fonttype = FONTMODE(g.mode); + draw_char( + win.canvas, + win.fontcache, + g.u, + borderpx + cx * win.fontcache->box.width, + borderpx + cy * win.fontcache->box.height + win.fontcache->fontsize, + colors[g.fg] + ); + break; + case 5: + case 6: + draw_rect( + win.canvas, + borderpx + cx * win.fontcache->box.width, + borderpx + cy * win.fontcache->box.height, + cursorthickness, + win.fontcache->box.height, + colors[defaultcursorcolor] + ); + win.fontcache->fonttype = FONTMODE(g.mode); + draw_char( + win.canvas, + win.fontcache, + g.u, + borderpx + cx * win.fontcache->box.width, + borderpx + cy * win.fontcache->box.height + win.fontcache->fontsize, + colors[g.fg] + ); + break; + } } @@ -294,7 +342,9 @@ void wsettitle(char *title) { int wsetcursor(int cursor) { - fprintf(stderr, "SET CURSOR: %i\n", cursor); + if (!BETWEEN(cursor, 0, 7)) + return 0; + win.cursor = cursor; return 1; } |