From e850c042907e96d0e52876fa5fe3f2ada499e11e Mon Sep 17 00:00:00 2001 From: Mertoalex Ashley Date: Fri, 4 Apr 2025 22:39:26 +0300 Subject: [PATCH] just a patch to make more understandable/minimal cursorshape switch-case. --- config.def.h | 10 +++++----- x.c | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/config.def.h b/config.def.h index 2cd740a..6f6b987 100644 --- a/config.def.h +++ b/config.def.h @@ -136,12 +136,12 @@ static unsigned int defaultrcs = 257; /* * Default shape of cursor - * 2: Block ("█") - * 4: Underline ("_") - * 6: Bar ("|") - * 7: Snowman ("☃") + * 0: Block ("█") + * 1: Underline ("_") + * 2: Bar ("|") + * 3: Snowman ("☃") */ -static unsigned int cursorshape = 2; +static unsigned int cursorshape = 0; /* * Default columns and rows numbers diff --git a/x.c b/x.c index d73152b..1bf330a 100644 --- a/x.c +++ b/x.c @@ -1561,24 +1561,20 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) /* draw the new one */ if (IS_SET(MODE_FOCUSED)) { switch (win.cursor) { - case 7: /* st extension */ + case 3: /* st extension */ g.u = 0x2603; /* snowman (U+2603) */ /* FALLTHROUGH */ case 0: /* Blinking Block */ - case 1: /* Blinking Block (Default) */ - case 2: /* Steady Block */ xdrawglyph(g, cx, cy); break; - case 3: /* Blinking Underline */ - case 4: /* Steady Underline */ + case 1: /* Blinking Underline */ XftDrawRect(xw.draw, &drawcol, borderpx + cx * win.cw, borderpx + (cy + 1) * win.ch - \ cursorthickness, win.cw, cursorthickness); break; - case 5: /* Blinking bar */ - case 6: /* Steady bar */ + case 2: /* Blinking bar */ XftDrawRect(xw.draw, &drawcol, borderpx + cx * win.cw, borderpx + cy * win.ch, @@ -1746,7 +1742,7 @@ xsetmode(int set, unsigned int flags) int xsetcursor(int cursor) { - if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */ + if (!BETWEEN(cursor, 0, 3)) /* 3: st extension */ return 1; win.cursor = cursor; return 0; -- 2.48.1