mirror of
https://github.com/LukeSmithxyz/st.git
synced 2025-04-11 21:21:08 +02:00
add dynamic cursor color patch
hey luke I think your zoomer viewers will enjoy this one cheers https://st.suckless.org/patches/dynamic-cursor-color/ Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
This commit is contained in:
parent
67ef1c4d4e
commit
559e33396f
1 changed files with 17 additions and 2 deletions
19
x.c
19
x.c
|
@ -1652,6 +1652,7 @@ void
|
||||||
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
|
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
|
||||||
{
|
{
|
||||||
Color drawcol;
|
Color drawcol;
|
||||||
|
XRenderColor colbg;
|
||||||
|
|
||||||
/* remove the old cursor */
|
/* remove the old cursor */
|
||||||
if (selected(ox, oy))
|
if (selected(ox, oy))
|
||||||
|
@ -1684,10 +1685,24 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le
|
||||||
g.fg = defaultfg;
|
g.fg = defaultfg;
|
||||||
g.bg = defaultrcs;
|
g.bg = defaultrcs;
|
||||||
} else {
|
} else {
|
||||||
|
/** this is the main part of the dynamic cursor color patch */
|
||||||
|
g.bg = g.fg;
|
||||||
g.fg = defaultbg;
|
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 */
|
/* draw the new one */
|
||||||
|
|
Loading…
Add table
Reference in a new issue