st-visualbell-0.8.3.diff (1145B)
1 From be009f16642dc460182fce800ba5868e70cc3956 Mon Sep 17 00:00:00 2001 2 From: Matthias Schoth <mschoth@gmail.com> 3 Date: Tue, 12 May 2020 18:27:29 +0200 4 Subject: [PATCH] visualbell 5 6 --- 7 x.c | 16 +++++++++++++++- 8 1 file changed, 15 insertions(+), 1 deletion(-) 9 10 diff --git a/x.c b/x.c 11 index e5f1737..4986374 100644 12 --- a/x.c 13 +++ b/x.c 14 @@ -253,6 +253,7 @@ static char *opt_name = NULL; 15 static char *opt_title = NULL; 16 17 static int oldbutton = 3; /* button event on startup: 3 = release */ 18 +static int bellon = 0; /* visual bell status */ 19 20 void 21 clipcopy(const Arg *dummy) 22 @@ -1713,6 +1714,15 @@ xbell(void) 23 xseturgency(1); 24 if (bellvolume) 25 XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); 26 + 27 + /* visual bell*/ 28 + if (!bellon) { 29 + bellon = 1; 30 + MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); 31 + redraw(); 32 + XFlush(xw.dpy); 33 + MODBIT(win.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); 34 + } 35 } 36 37 void 38 @@ -1943,7 +1953,11 @@ run(void) 39 (handler[ev.type])(&ev); 40 } 41 42 - draw(); 43 + if (bellon) { 44 + bellon = 0; 45 + redraw(); 46 + } 47 + else draw(); 48 XFlush(xw.dpy); 49 50 if (xev && !FD_ISSET(xfd, &rfd)) 51 -- 52 2.26.2 53