diff options
author | jack <[email protected]> | 2024-04-26 10:08:27 -0600 |
---|---|---|
committer | jack <[email protected]> | 2024-04-26 10:08:27 -0600 |
commit | 17cc1cac9088ca8ba8b97ba92cf758a1b0077008 (patch) | |
tree | 47e996dba9d360945fc7f7320e3612f8529a4404 | |
parent | dd23baf5abbe5c8e57c0316a03bf33bc1889e238 (diff) | |
download | st-17cc1cac9088ca8ba8b97ba92cf758a1b0077008.tar.gz st-17cc1cac9088ca8ba8b97ba92cf758a1b0077008.zip |
patch: dynamic cursor colour
-rw-r--r-- | x.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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 */ |