From 6ef77f53bd09a12cd63bbffd0c73b77c603224b3 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Wed, 7 Sep 2022 22:16:29 +0200 Subject: [PATCH] Add visualbell-patch --- patches/st-visualbell-0.8.4.diff | 48 ++++++++++++++++++++++++++++++++ x.c | 11 +++++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 patches/st-visualbell-0.8.4.diff diff --git a/patches/st-visualbell-0.8.4.diff b/patches/st-visualbell-0.8.4.diff new file mode 100644 index 0000000..e71628c --- /dev/null +++ b/patches/st-visualbell-0.8.4.diff @@ -0,0 +1,48 @@ +From b7f2e9e933710e3339b710e24e37c6f0b3befa34 Mon Sep 17 00:00:00 2001 +From: Matthias Schoth +Date: Fri, 24 Jul 2020 23:55:31 +0200 +Subject: [PATCH] visualbell + +--- + x.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/x.c b/x.c +index 210f184..bcf61f1 100644 +--- a/x.c ++++ b/x.c +@@ -259,6 +259,7 @@ static char *opt_name = NULL; + static char *opt_title = NULL; + ++static int bellon = 0; /* visual bell status */ + static uint buttons; /* bit field of pressed buttons */ + + void + clipcopy(const Arg *dummy) +@@ -1713,6 +1714,8 @@ xbell(void) + xseturgency(1); + if (bellvolume) + XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); ++ if (!bellon) /* turn visual bell on */ ++ bellon = 1; + } + + void +@@ -1958,7 +1961,13 @@ run(void) + } + } + +- draw(); ++ if (bellon) { ++ bellon++; ++ bellon %= 3; ++ MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); ++ redraw(); ++ } ++ else draw(); + XFlush(xw.dpy); + drawing = 0; + } +-- +2.27.0 + diff --git a/x.c b/x.c index cd26ea3..32cc146 100644 --- a/x.c +++ b/x.c @@ -258,6 +258,7 @@ static char *opt_line = NULL; static char *opt_name = NULL; static char *opt_title = NULL; +static int bellon = 0; /* visual bell status */ static uint buttons; /* bit field of pressed buttons */ void @@ -1890,6 +1891,8 @@ xbell(void) xseturgency(1); if (bellvolume) XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); + if (!bellon) /* turn visual bell on */ + bellon = 1; } void @@ -2135,7 +2138,13 @@ run(void) } } - draw(); + if (bellon) { + bellon++; + bellon %= 3; + MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); + redraw(); + } + else draw(); XFlush(xw.dpy); drawing = 0; }