mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
Adding dynamic cursor color patch ref. #10
This commit is contained in:
parent
6c42872476
commit
884c62a056
@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
||||
|
||||
### Changelog:
|
||||
|
||||
2021-02-26 - Added the dynamic cursor color patch
|
||||
|
||||
2021-02-15 - Added the alpha gradient patch
|
||||
|
||||
2020-11-14 - Added the wide glyphs patch
|
||||
@ -80,6 +82,9 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
||||
- [disable-fonts](https://st.suckless.org/patches/disable_bold_italic_fonts/)
|
||||
- this patch adds the option of disabling bold/italic/roman fonts globally
|
||||
|
||||
- [dynamic-cursor-color](https://st.suckless.org/patches/dynamic-cursor-color/)
|
||||
- this patch makes the cursor color the inverse of the current cell color
|
||||
|
||||
- [externalpipe](https://st.suckless.org/patches/externalpipe/)
|
||||
- this patch allows for eading and writing st's screen through a pipe, e.g. to pass info to dmenu
|
||||
|
||||
|
@ -79,6 +79,11 @@
|
||||
*/
|
||||
#define DISABLE_ROMAN_FONTS_PATCH 0
|
||||
|
||||
/* This patch makes the cursor color the inverse of the current cell color.
|
||||
* https://st.suckless.org/patches/dynamic-cursor-color/
|
||||
*/
|
||||
#define DYNAMIC_CURSOR_COLOR_PATCH 0
|
||||
|
||||
/* Reading and writing st's screen through a pipe, e.g. pass info to dmenu.
|
||||
* https://st.suckless.org/patches/externalpipe/
|
||||
*/
|
||||
|
20
x.c
20
x.c
@ -1848,6 +1848,9 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
||||
#endif // LIGATURES_PATCH
|
||||
{
|
||||
Color drawcol;
|
||||
#if DYNAMIC_CURSOR_COLOR_PATCH
|
||||
XRenderColor colbg;
|
||||
#endif // DYNAMIC_CURSOR_COLOR_PATCH
|
||||
|
||||
/* remove the old cursor */
|
||||
if (selected(ox, oy))
|
||||
@ -1887,10 +1890,27 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
||||
g.fg = defaultfg;
|
||||
g.bg = defaultrcs;
|
||||
} else {
|
||||
#if DYNAMIC_CURSOR_COLOR_PATCH
|
||||
g.bg = g.fg;
|
||||
g.fg = defaultbg;
|
||||
#else
|
||||
g.fg = defaultbg;
|
||||
g.bg = defaultcs;
|
||||
#endif // DYNAMIC_CURSOR_COLOR_PATCH
|
||||
}
|
||||
|
||||
#if DYNAMIC_CURSOR_COLOR_PATCH
|
||||
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];
|
||||
#else
|
||||
drawcol = dc.col[g.bg];
|
||||
#endif // DYNAMIC_CURSOR_COLOR_PATCH
|
||||
}
|
||||
|
||||
/* draw the new one */
|
||||
|
Loading…
Reference in New Issue
Block a user