summaryrefslogtreecommitdiff
path: root/x.c
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2022-09-04 20:24:29 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2022-09-04 20:24:29 +0530
commit27412972e99912314e905f3f09b1d131662f1cf3 (patch)
tree43692a8514a3bf08bffded61b62f2ead6b48c6f7 /x.c
parentb7d827af67ba0ec162747362151c1f83746cbf26 (diff)
Applied dynamic cursor
Diffstat (limited to 'x.c')
-rw-r--r--x.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/x.c b/x.c
index 9951269..9747ce0 100644
--- a/x.c
+++ b/x.c
@@ -1650,6 +1650,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))
@@ -1679,10 +1680,24 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
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 */