[hackers] [st][PATCH 02/23] Move bell/urgent hints into x.c

From: Devin J. Pohly <djpohly_AT_gmail.com>
Date: Sun, 24 Sep 2017 16:11:24 -0500

xseturgency is now internal to x.c
---
 config.def.h | 2 +-
 st.c         | 5 +----
 st.h         | 1 +
 win.h        | 3 +--
 x.c          | 8 ++++++--
 5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/config.def.h b/config.def.h
index 877afab..dd94be2 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -60,7 +60,7 @@ unsigned int cursorthickness = 2;
  * bell volume. It must be a value between -100 and 100. Use 0 for disabling
  * it
  */
-static int bellvolume = 0;
+int bellvolume = 0;
 
 /* default TERM value */
 char termname[] = "st-256color";
diff --git a/st.c b/st.c
index f1227ea..7ae864e 100644
--- a/st.c
+++ b/st.c
_AT_@ -2183,10 +2183,7 @@ tcontrolcode(uchar ascii)
 			/* backwards compatibility to xterm */
 			strhandle();
 		} else {
-			if (!(win.state & WIN_FOCUSED))
-				xseturgency(1);
-			if (bellvolume)
-				xbell(bellvolume);
+			xbell();
 		}
 		break;
 	case '\033': /* ESC */
diff --git a/st.h b/st.h
index 28a751d..e4328fc 100644
--- a/st.h
+++ b/st.h
_AT_@ -245,6 +245,7 @@ extern int allowaltscreen;
 extern unsigned int xfps;
 extern unsigned int actionfps;
 extern unsigned int cursorthickness;
+extern int bellvolume;
 extern unsigned int blinktimeout;
 extern char termname[];
 extern const char *colorname[];
diff --git a/win.h b/win.h
index 7b614eb..e6e4448 100644
--- a/win.h
+++ b/win.h
_AT_@ -10,7 +10,7 @@ typedef XftGlyphFontSpec GlyphFontSpec;
 void draw(void);
 void drawregion(int, int, int, int);
 
-void xbell(int);
+void xbell(void);
 void xclipcopy(void);
 void xclippaste(void);
 void xhints(void);
_AT_@ -20,7 +20,6 @@ void xloadfonts(char *, double);
 void xsetenv(void);
 void xsettitle(char *);
 void xsetpointermotion(int);
-void xseturgency(int);
 void xunloadfonts(void);
 void xresize(int, int);
 void xselpaste(void);
diff --git a/x.c b/x.c
index d68261c..b5cc58e 100644
--- a/x.c
+++ b/x.c
_AT_@ -91,6 +91,7 @@ static int xgeommasktogravity(int);
 static int xloadfont(Font *, FcPattern *);
 static void xunloadfont(Font *);
 static void xinit(void);
+static void xseturgency(int);
 
 static void expose(XEvent *);
 static void visibility(XEvent *);
_AT_@ -1484,9 +1485,12 @@ xseturgency(int add)
 }
 
 void
-xbell(int vol)
+xbell(void)
 {
-	XkbBell(xw.dpy, xw.win, vol, (Atom)NULL);
+	if (!(win.state & WIN_FOCUSED))
+		xseturgency(1);
+	if (bellvolume)
+		XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL);
 }
 
 unsigned long
-- 
2.14.1
Received on Sun Sep 24 2017 - 23:11:24 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 24 2017 - 23:24:31 CEST