[wiki] [sites] [st] Introducing visualbell patch || Matthias Schoth

From: <git_AT_suckless.org>
Date: Tue, 09 Feb 2016 18:08:22 +0100

commit 0d932db493af0d566b817658f2930b7a934e3699
Author: Matthias Schoth <mschoth_AT_gmail.com>
Date: Tue Feb 9 18:04:14 2016 +0100

    [st] Introducing visualbell patch

diff --git a/st.suckless.org/patches/st-git-20160209-visualbell.diff b/st.suckless.org/patches/st-git-20160209-visualbell.diff
new file mode 100644
index 0000000..5682b6e
--- /dev/null
+++ b/st.suckless.org/patches/st-git-20160209-visualbell.diff
_AT_@ -0,0 +1,42 @@
+diff --git a/st.c b/st.c
+index 0536b6f..948de40 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -532,6 +532,7 @@ static char *opt_line = NULL;
+ static char *opt_name = NULL;
+ static char *opt_title = NULL;
+ static int oldbutton = 3; /* button event on startup: 3 = release */
++static int bellon = 0; /* visual bell status */
+
+ static char *usedfont = NULL;
+ static double usedfontsize = 0;
+_AT_@ -2767,6 +2768,15 @@ tcontrolcode(uchar ascii)
+ xseturgency(1);
+ if (bellvolume)
+ XkbBell(xw.dpy, xw.win, bellvolume, (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);
++ }
+ }
+ break;
+ case '': /* ESC */
+_AT_@ -4303,7 +4313,12 @@ run(void)
+ (handler[ev.type])(&ev);
+ }
+
+- draw();
++ if (bellon) {
++ bellon = 0;
++ redraw();
++ }
++ else draw();
++
+ XFlush(xw.dpy);
+
+ if (xev && !FD_ISSET(xfd, &rfd))
diff --git a/st.suckless.org/patches/visualbell.md b/st.suckless.org/patches/visualbell.md
new file mode 100644
index 0000000..ab71853
--- /dev/null
+++ b/st.suckless.org/patches/visualbell.md
_AT_@ -0,0 +1,24 @@
+visualbell
+==========
+
+Description
+-----------
+
+Briefly inverts window content on terminal bell event.
+
+Notes
+-----
+
+In order to be noticeable you might have to reduce the `xfps`
+value in `config.h` to less than equal the refresh rate of your
+monitor.
+
+Download
+--------
+
+ * [st-git-20160209-visualbell.diff](st-git-20160209-visualbell.diff)
+
+Authors
+-------
+
+ * Matthias Schoth - mschoth_AT_gmail.com
Received on Tue Feb 09 2016 - 18:08:22 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 09 2016 - 18:12:13 CET