st-visualbell-20160727-308bfbf.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       st-visualbell-20160727-308bfbf.diff (1212B)
       ---
            1 diff --git a/st.c b/st.c
            2 index 2594c65..89bffdd 100644
            3 --- a/st.c
            4 +++ b/st.c
            5 @@ -532,6 +532,7 @@ static char *opt_line  = NULL;
            6  static char *opt_name  = NULL;
            7  static char *opt_title = NULL;
            8  static int oldbutton   = 3; /* button event on startup: 3 = release */
            9 +static int bellon      = 0; /* visual bell status */
           10  
           11  static char *usedfont = NULL;
           12  static double usedfontsize = 0;
           13 @@ -2766,6 +2767,15 @@ tcontrolcode(uchar ascii)
           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(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE);
           22 +                                redraw();
           23 +                                XFlush(xw.dpy);
           24 +                                MODBIT(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE);
           25 +                        }
           26                  }
           27                  break;
           28          case '\033': /* ESC */
           29 @@ -4292,7 +4302,12 @@ run(void)
           30                                          (handler[ev.type])(&ev);
           31                          }
           32  
           33 -                        draw();
           34 +                        if (bellon) {
           35 +                                bellon = 0;
           36 +                                redraw();
           37 +                        }
           38 +                        else draw();
           39 +
           40                          XFlush(xw.dpy);
           41  
           42                          if (xev && !FD_ISSET(xfd, &rfd))