commit 3ded9ea4ddc139e17fb77a40480283c99f737ede
parent bb619d3e657c9ab0b9363b030671020817140485
Author: TripleK2004 <kowkeerthankumar@gmail.com>
Date: Tue, 8 Jun 2021 22:16:48 +0530
patched dynamic cursor
Diffstat:
4 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -5,7 +5,7 @@
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
-static char *font = "JetBrainsMono Nerd Font :pixelsize=15:antialias=true:autohint=true";
+static char *font = "JetBrainsMono Nerd Font :pixelsize=17:antialias=true:autohint=true";
static char *font2[] = { "JetBrainsMono Nerd Font :pixelsize=15:antialias=true:autohint=true" };
static int borderpx = 0;
@@ -17,7 +17,7 @@ static int borderpx = 0;
* 4: value of shell in /etc/passwd
* 5: value of shell in config.h
*/
-static char *shell = "/bin/sh";
+static char *shell = "/bin/fish";
char *utmp = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
@@ -143,7 +143,7 @@ static const char *colorname[] = {
*/
unsigned int defaultfg = 259;
unsigned int defaultbg = 258;
-unsigned int defaultcs = 256;
+unsigned int defaultcs = 257;
unsigned int defaultrcs = 257;
/*
@@ -249,8 +249,8 @@ static Shortcut shortcuts[] = {
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
- { MODKEY, XK_comma, zoom, {.f = +1} },
- { MODKEY, XK_period, zoom, {.f = -1} },
+ { ControlMask, XK_equal, zoom, {.f = +1} },
+ { ControlMask, XK_minus, zoom, {.f = -1} },
{ MODKEY, XK_g, zoomreset, {.f = 0} },
{ ControlMask | ShiftMask, XK_C, clipcopy, {.i = 0} },
{ ShiftMask, XK_Insert, clippaste, {.i = 0} },
diff --git a/config.h b/config.h
@@ -5,7 +5,7 @@
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
-static char *font = "JetBrainsMono Nerd Font :pixelsize=15:antialias=true:autohint=true";
+static char *font = "JetBrainsMono Nerd Font :pixelsize=17:antialias=true:autohint=true";
static char *font2[] = { "JetBrainsMono Nerd Font :pixelsize=15:antialias=true:autohint=true" };
static int borderpx = 0;
@@ -17,7 +17,7 @@ static int borderpx = 0;
* 4: value of shell in /etc/passwd
* 5: value of shell in config.h
*/
-static char *shell = "/bin/sh";
+static char *shell = "/bin/fish";
char *utmp = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
@@ -143,7 +143,7 @@ static const char *colorname[] = {
*/
unsigned int defaultfg = 259;
unsigned int defaultbg = 258;
-unsigned int defaultcs = 256;
+unsigned int defaultcs = 257;
unsigned int defaultrcs = 257;
/*
@@ -249,8 +249,8 @@ static Shortcut shortcuts[] = {
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
- { MODKEY, XK_comma, zoom, {.f = +1} },
- { MODKEY, XK_period, zoom, {.f = -1} },
+ { ControlMask, XK_equal, zoom, {.f = +1} },
+ { ControlMask, XK_minus, zoom, {.f = -1} },
{ MODKEY, XK_g, zoomreset, {.f = 0} },
{ ControlMask | ShiftMask, XK_C, clipcopy, {.i = 0} },
{ ShiftMask, XK_Insert, clippaste, {.i = 0} },
diff --git a/config.mk b/config.mk
@@ -21,7 +21,7 @@ INCS = -I$(X11INC) \
`$(PKG_CONFIG) --cflags fontconfig` \
`$(PKG_CONFIG) --cflags freetype2` \
`$(PKG_CONFIG) --cflags harfbuzz`
-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
+LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender \
`$(PKG_CONFIG) --libs fontconfig` \
`$(PKG_CONFIG) --libs freetype2` \
`$(PKG_CONFIG) --libs harfbuzz`
diff --git a/x.c b/x.c
@@ -697,7 +697,7 @@ brelease(XEvent *e)
return;
}
- if (e->xbutton.button == Button3)
+ if (e->xbutton.button == Button2)
selpaste(NULL);
else if (e->xbutton.button == Button1)
mousesel(e, 1);
@@ -1612,6 +1612,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))
@@ -1644,10 +1645,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 */