[wiki] [sites] [st][visualbell] Enable visualbell even when bellvolume is zero || Matthias Schoth

From: <git_AT_suckless.org>
Date: Mon, 01 Jan 2018 16:04:10 +0100

commit 101037846c28b8b42e562ec63b2d27d77d1da8b1
Author: Matthias Schoth <mschoth_AT_gmail.com>
Date: Mon Jan 1 16:00:05 2018 +0100

    [st][visualbell] Enable visualbell even when bellvolume is zero
    
    Fixes bug where the visual bell only works if the volume of the audible bell
    is not equal zero.

diff --git a/st.suckless.org/patches/visualbell/index.md b/st.suckless.org/patches/visualbell/index.md
index f02b56a4..41bf5ffb 100644
--- a/st.suckless.org/patches/visualbell/index.md
+++ b/st.suckless.org/patches/visualbell/index.md
_AT_@ -17,7 +17,7 @@ Download
 --------
 
  * [st-visualbell-20160727-308bfbf.diff](st-visualbell-20160727-308bfbf.diff)
- * [st-visualbell-20170924-b1338e9.diff](st-visualbell-20170924-b1338e9.diff)
+ * [st-visualbell-20180101-1f24bde.diff](st-visualbell-20180101-1f24bde.diff)
 
 Authors
 -------
diff --git a/st.suckless.org/patches/visualbell/st-visualbell-20180101-1f24bde.diff b/st.suckless.org/patches/visualbell/st-visualbell-20180101-1f24bde.diff
new file mode 100644
index 00000000..3ed5c875
--- /dev/null
+++ b/st.suckless.org/patches/visualbell/st-visualbell-20180101-1f24bde.diff
_AT_@ -0,0 +1,74 @@
+diff --git a/st.c b/st.c
+index 7c7ddff..2dc10c2 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -218,6 +218,7 @@ char *opt_line = NULL;
+ char *opt_name = NULL;
+ char *opt_title = NULL;
+ int oldbutton = 3; /* button event on startup: 3 = release */
++int bellon = 0;
+
+ static CSIEscape csiescseq;
+ static STREscape strescseq;
+_AT_@ -2187,8 +2188,7 @@ tcontrolcode(uchar ascii)
+ } else {
+ if (!(win.state & WIN_FOCUSED))
+ xseturgency(1);
+- if (bellvolume)
+- xbell(bellvolume);
++ xbell(bellvolume);
+ }
+ break;
+ case '': /* ESC */
+diff --git a/st.h b/st.h
+index 44d4938..24a6eb6 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -231,6 +231,7 @@ extern char *opt_line;
+ extern char *opt_name;
+ extern char *opt_title;
+ extern int oldbutton;
++extern int bellon;
+
+ extern char *usedfont;
+ extern double usedfontsize;
+diff --git a/x.c b/x.c
+index c484dfc..0b59d0e 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -1484,7 +1484,17 @@ xseturgency(int add)
+ void
+ xbell(int vol)
+ {
+- XkbBell(xw.dpy, xw.win, vol, (Atom)NULL);
++ if (vol)
++ XkbBell(xw.dpy, xw.win, vol, (Atom)NULL);
++
++ /* visual bell*/
++ if (!bellon) {
++ bellon = 1;
++ MODBIT(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE);
++ redraw();
++ XFlush(xw.dpy);
++ MODBIT(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE);
++ }
+ }
+
+ unsigned long
+_AT_@ -1676,7 +1686,12 @@ run(void)
+ (handler[ev.type])(&ev);
+ }
+
+- draw();
++ if (bellon) {
++ bellon = 0;
++ redraw();
++ }
++ else draw();
++
+ XFlush(xw.dpy);
+
+ if (xev && !FD_ISSET(xfd, &rfd))
+--
+2.15.1
+
Received on Mon Jan 01 2018 - 16:04:10 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 01 2018 - 16:12:21 CET