Re: [hackers] [st][PATCH] Call xsetcursor to set win.cursor in main

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sun, 24 May 2020 13:47:38 +0200

On Wed, May 20, 2020 at 10:24:55PM -0400, Steve Ward wrote:
> In xsetcursor, remove "DEFAULT(cursor, 1)" because 0 is a valid value.
> Increase max allowed value of cursor from 6 to 7 (st extension).
> ---
> x.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/x.c b/x.c
> index 1dc44d6..210f184 100644
> --- a/x.c
> +++ b/x.c
> _AT_@ -1526,8 +1526,8 @@ 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: snowman (U+2603) */
> - g.u = 0x2603;
> + case 7: /* st extension */
> + g.u = 0x2603; /* snowman (U+2603) */
> /* FALLTHROUGH */
> case 0: /* Blinking Block */
> case 1: /* Blinking Block (Default) */
> _AT_@ -1690,8 +1690,7 @@ xsetmode(int set, unsigned int flags)
> int
> xsetcursor(int cursor)
> {
> - DEFAULT(cursor, 1);
> - if (!BETWEEN(cursor, 0, 6))
> + if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
> return 1;
> win.cursor = cursor;
> return 0;
> _AT_@ -1983,7 +1982,7 @@ main(int argc, char *argv[])
> {
> xw.l = xw.t = 0;
> xw.isfixed = False;
> - win.cursor = cursorshape;
> + xsetcursor(cursorshape);
>
> ARGBEGIN {
> case 'a':
> --
> 2.20.1
>
>

Applied, thanks.

Now dynamic snowman works :)

        printf '\x1b[7 q'

-- 
Kind regards,
Hiltjo
Received on Sun May 24 2020 - 13:47:38 CEST

This archive was generated by hypermail 2.3.0 : Sun May 24 2020 - 13:48:39 CEST