aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjack <[email protected]>2024-04-26 10:08:27 -0600
committerjack <[email protected]>2024-04-26 10:08:27 -0600
commit17cc1cac9088ca8ba8b97ba92cf758a1b0077008 (patch)
tree47e996dba9d360945fc7f7320e3612f8529a4404
parentdd23baf5abbe5c8e57c0316a03bf33bc1889e238 (diff)
downloadst-17cc1cac9088ca8ba8b97ba92cf758a1b0077008.tar.gz
st-17cc1cac9088ca8ba8b97ba92cf758a1b0077008.zip
patch: dynamic cursor colour
-rw-r--r--x.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/x.c b/x.c
index 2eacd06..abaccad 100644
--- a/x.c
+++ b/x.c
@@ -1491,6 +1491,7 @@ void
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
{
Color drawcol;
+ XRenderColor colbg;
/* remove the old cursor */
if (selected(ox, oy))
@@ -1521,11 +1522,21 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le
if (selected(cx, cy)) {
g.fg = defaultfg;
g.bg = defaultrcs;
+ } else if (!(og.mode & ATTR_REVERSE)) {
+ unsigned long col = g.bg;
+ g.bg = g.fg;
+ g.fg = col;
+ }
+
+ if (IS_TRUECOL(g.bg)) {
+ colbg.alpha = 0xffff;
+ colbg.red = TRUERED(g.bg);
+ colbg.green = TRUEGREEN(g.bg);
+ colbg.blue = TRUEBLUE(g.bg);
+ XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &drawcol);
} else {
- g.fg = defaultbg;
- g.bg = defaultcs;
+ drawcol = dc.col[g.bg];
}
- drawcol = dc.col[g.bg];
}
/* draw the new one */