st-lesscases-20250404-98610fc.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       st-lesscases-20250404-98610fc.diff (2086B)
       ---
            1 From e850c042907e96d0e52876fa5fe3f2ada499e11e Mon Sep 17 00:00:00 2001
            2 From: Mertoalex Ashley <mertoalex+git@disroot.org>
            3 Date: Fri, 4 Apr 2025 22:39:26 +0300
            4 Subject: [PATCH] just a patch to make more understandable/minimal cursorshape
            5  switch-case.
            6 
            7 ---
            8  config.def.h | 10 +++++-----
            9  x.c          | 12 ++++--------
           10  2 files changed, 9 insertions(+), 13 deletions(-)
           11 
           12 diff --git a/config.def.h b/config.def.h
           13 index 2cd740a..6f6b987 100644
           14 --- a/config.def.h
           15 +++ b/config.def.h
           16 @@ -136,12 +136,12 @@ static unsigned int defaultrcs = 257;
           17  
           18  /*
           19   * Default shape of cursor
           20 - * 2: Block ("█")
           21 - * 4: Underline ("_")
           22 - * 6: Bar ("|")
           23 - * 7: Snowman ("☃")
           24 + * 0: Block ("█")
           25 + * 1: Underline ("_")
           26 + * 2: Bar ("|")
           27 + * 3: Snowman ("☃")
           28   */
           29 -static unsigned int cursorshape = 2;
           30 +static unsigned int cursorshape = 0;
           31  
           32  /*
           33   * Default columns and rows numbers
           34 diff --git a/x.c b/x.c
           35 index d73152b..1bf330a 100644
           36 --- a/x.c
           37 +++ b/x.c
           38 @@ -1561,24 +1561,20 @@ 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                          g.u = 0x2603; /* snowman (U+2603) */
           45                          /* FALLTHROUGH */
           46                  case 0: /* Blinking Block */
           47 -                case 1: /* Blinking Block (Default) */
           48 -                case 2: /* Steady Block */
           49                          xdrawglyph(g, cx, cy);
           50                          break;
           51 -                case 3: /* Blinking Underline */
           52 -                case 4: /* Steady Underline */
           53 +                case 1: /* Blinking Underline */
           54                          XftDrawRect(xw.draw, &drawcol,
           55                                          borderpx + cx * win.cw,
           56                                          borderpx + (cy + 1) * win.ch - \
           57                                                  cursorthickness,
           58                                          win.cw, cursorthickness);
           59                          break;
           60 -                case 5: /* Blinking bar */
           61 -                case 6: /* Steady bar */
           62 +                case 2: /* Blinking bar */
           63                          XftDrawRect(xw.draw, &drawcol,
           64                                          borderpx + cx * win.cw,
           65                                          borderpx + cy * win.ch,
           66 @@ -1746,7 +1742,7 @@ xsetmode(int set, unsigned int flags)
           67  int
           68  xsetcursor(int cursor)
           69  {
           70 -        if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
           71 +        if (!BETWEEN(cursor, 0, 3)) /* 3: st extension */
           72                  return 1;
           73          win.cursor = cursor;
           74          return 0;
           75 -- 
           76 2.48.1
           77