From aa9d16a41b34a4e1508f8f860e6232cc8db5a2a2 Mon Sep 17 00:00:00 2001 From: syrell Date: Tue, 27 Jun 2023 22:31:10 +0200 Subject: [PATCH] Added dynamic-cursor-color v0.9 patch (#7) Reviewed-on: https://git.syyrell.com/syrell/st/pulls/7 --- x.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/x.c b/x.c index f6c3b80..f0c0f53 100644 --- a/x.c +++ b/x.c @@ -1541,6 +1541,7 @@ void xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) { Color drawcol; + XRenderColor colbg; /* remove the old cursor */ if (selected(ox, oy)) @@ -1569,11 +1570,21 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) if (selected(cx, cy)) { g.fg = defaultfg; g.bg = defaultrcs; - } else { - g.fg = defaultbg; - g.bg = defaultcs; + } 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 { + drawcol = dc.col[g.bg]; } - drawcol = dc.col[g.bg]; } /* draw the new one */