st-visualbell-0.8.4.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       st-visualbell-0.8.4.diff (1012B)
       ---
            1 From b7f2e9e933710e3339b710e24e37c6f0b3befa34 Mon Sep 17 00:00:00 2001
            2 From: Matthias Schoth <mschoth@gmail.com>
            3 Date: Fri, 24 Jul 2020 23:55:31 +0200
            4 Subject: [PATCH] visualbell
            5 
            6 ---
            7  x.c | 11 ++++++++++-
            8  1 file changed, 10 insertions(+), 1 deletion(-)
            9 
           10 diff --git a/x.c b/x.c
           11 index 210f184..bcf61f1 100644
           12 --- a/x.c
           13 +++ b/x.c
           14 @@ -253,6 +253,7 @@ static char *opt_name  = NULL;
           15  static char *opt_title = NULL;
           16  
           17  static int oldbutton = 3; /* button event on startup: 3 = release */
           18 +static int bellon = 0;    /* visual bell status */
           19  
           20  void
           21  clipcopy(const Arg *dummy)
           22 @@ -1713,6 +1714,8 @@ xbell(void)
           23                  xseturgency(1);
           24          if (bellvolume)
           25                  XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL);
           26 +        if (!bellon) /* turn visual bell on */
           27 +                bellon = 1;
           28  }
           29  
           30  void
           31 @@ -1958,7 +1961,13 @@ run(void)
           32                          }
           33                  }
           34  
           35 -                draw();
           36 +                if (bellon) {
           37 +                        bellon++;
           38 +                        bellon %= 3;
           39 +                        MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE);
           40 +                        redraw();
           41 +                }
           42 +                else draw();
           43                  XFlush(xw.dpy);
           44                  drawing = 0;
           45          }
           46 -- 
           47 2.27.0
           48