st-visualbell-0.8.1.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.1.diff (872B)
       ---
            1 diff --git a/x.c b/x.c
            2 index c343ba2..26bb9bb 100644
            3 --- a/x.c
            4 +++ b/x.c
            5 @@ -239,6 +239,7 @@ static char *opt_name  = NULL;
            6  static char *opt_title = NULL;
            7  
            8  static int oldbutton = 3; /* button event on startup: 3 = release */
            9 +static int bellon = 0;    /* visual bell status */
           10  
           11  void
           12  clipcopy(const Arg *dummy)
           13 @@ -1614,6 +1615,15 @@ xbell(void)
           14                  xseturgency(1);
           15          if (bellvolume)
           16                  XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL);
           17 +
           18 +        /* visual bell*/
           19 +        if (!bellon) {
           20 +                bellon = 1;
           21 +                MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE);
           22 +                redraw();
           23 +                XFlush(xw.dpy);
           24 +                MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE);
           25 +        }
           26  }
           27  
           28  void
           29 @@ -1840,7 +1850,11 @@ run(void)
           30                                          (handler[ev.type])(&ev);
           31                          }
           32  
           33 -                        draw();
           34 +                        if (bellon) {
           35 +                                bellon = 0;
           36 +                                redraw();
           37 +                        }
           38 +                        else draw();
           39                          XFlush(xw.dpy);
           40  
           41                          if (xev && !FD_ISSET(xfd, &rfd))