st/patches/st-visualbell-0.8.4.diff

49 lines
999 B
Diff
Raw Normal View History

2022-09-07 22:16:29 +02:00
From b7f2e9e933710e3339b710e24e37c6f0b3befa34 Mon Sep 17 00:00:00 2001
From: Matthias Schoth <mschoth@gmail.com>
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