summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaumit Dinesan <79687674+Saumit-D@users.noreply.github.com>2021-11-14 00:31:02 +0530
committerGitHub <noreply@github.com>2021-11-14 00:31:02 +0530
commitf2af962dced5e8fad7b4b25dfa0d9ad260533777 (patch)
tree6fdb797df5636c6aa2c55456ffcf215cb0be3ce7
parent0eea036018c78b371b4feca6cd86b02cc2bdd0fc (diff)
Update x.c
-rw-r--r--x.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/x.c b/x.c
index 738bb1c..eb1f2bc 100644
--- a/x.c
+++ b/x.c
@@ -1611,6 +1611,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))
@@ -1643,10 +1644,24 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le
g.fg = defaultfg;
g.bg = defaultrcs;
} else {
+ /** this is the main part of the dynamic cursor color patch */
+ g.bg = g.fg;
g.fg = defaultbg;
- g.bg = defaultcs;
}
- drawcol = dc.col[g.bg];
+
+ /**
+ * and this is the second part of the dynamic cursor color patch.
+ * it handles the `drawcol` variable
+ */
+ 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];
+ }
}
/* draw the new one */