st-lesscases-customcursor-20250405-98610fc.diff (2188B)
1 From 826f4841b27fba77b2fce753c2ec6b44c910afe5 Mon Sep 17 00:00:00 2001 2 From: Mertoalex Ashley <mertoalex+git@disroot.org> 3 Date: Sat, 5 Apr 2025 00:33:59 +0300 4 Subject: [PATCH] lesscases patch and customcursor together 5 6 --- 7 config.def.h | 11 ++++++----- 8 x.c | 16 ++++++++-------- 9 2 files changed, 14 insertions(+), 13 deletions(-) 10 11 diff --git a/config.def.h b/config.def.h 12 index 2cd740a..501523d 100644 13 --- a/config.def.h 14 +++ b/config.def.h 15 @@ -136,12 +136,13 @@ static unsigned int defaultrcs = 257; 16 17 /* 18 * Default shape of cursor 19 - * 2: Block ("█") 20 - * 4: Underline ("_") 21 - * 6: Bar ("|") 22 - * 7: Snowman ("☃") 23 + * 0: Block ("█") 24 + * 1: Underline ("_") 25 + * 2: Bar ("|") 26 + * 3: Custom (Default: "☃") 27 */ 28 -static unsigned int cursorshape = 2; 29 +static unsigned int cursorshape = 0; 30 +#define CUSTOM_BLOCK 0x2603 /* snowman (U+2603) */ 31 32 /* 33 * Default columns and rows numbers 34 diff --git a/x.c b/x.c 35 index d73152b..bdd74a1 100644 36 --- a/x.c 37 +++ b/x.c 38 @@ -1561,24 +1561,24 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) 39 /* draw the new one */ 40 if (IS_SET(MODE_FOCUSED)) { 41 switch (win.cursor) { 42 - case 7: /* st extension */ 43 + case 3: /* st extension */ 44 + #ifdef CUSTOM_BLOCK 45 + g.u = CUSTOM_BLOCK; 46 + #else 47 g.u = 0x2603; /* snowman (U+2603) */ 48 + #endif 49 /* FALLTHROUGH */ 50 case 0: /* Blinking Block */ 51 - case 1: /* Blinking Block (Default) */ 52 - case 2: /* Steady Block */ 53 xdrawglyph(g, cx, cy); 54 break; 55 - case 3: /* Blinking Underline */ 56 - case 4: /* Steady Underline */ 57 + case 1: /* Blinking Underline */ 58 XftDrawRect(xw.draw, &drawcol, 59 borderpx + cx * win.cw, 60 borderpx + (cy + 1) * win.ch - \ 61 cursorthickness, 62 win.cw, cursorthickness); 63 break; 64 - case 5: /* Blinking bar */ 65 - case 6: /* Steady bar */ 66 + case 2: /* Blinking bar */ 67 XftDrawRect(xw.draw, &drawcol, 68 borderpx + cx * win.cw, 69 borderpx + cy * win.ch, 70 @@ -1746,7 +1746,7 @@ xsetmode(int set, unsigned int flags) 71 int 72 xsetcursor(int cursor) 73 { 74 - if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */ 75 + if (!BETWEEN(cursor, 0, 3)) /* 3: st extension */ 76 return 1; 77 win.cursor = cursor; 78 return 0; 79 -- 80 2.48.1 81