Apply st-dynamic-cursor-color-0.8.4 patch

This commit is contained in:
Amolith 2022-01-22 00:01:22 -05:00
parent 764f576c7c
commit 7a84745f6c
Signed by: Amolith
GPG Key ID: 5548AD9930655715
1 changed files with 17 additions and 2 deletions

17
x.c
View File

@ -1511,6 +1511,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))
@ -1540,11 +1541,25 @@ 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;
}
/**
* 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 */
if (IS_SET(MODE_FOCUSED)) {