]> git.armaanb.net Git - st.git/commitdiff
Move window urgency handling entirely into x.c
authorDevin J. Pohly <djpohly@gmail.com>
Tue, 10 Oct 2017 17:01:18 +0000 (12:01 -0500)
committerDevin J. Pohly <djpohly@gmail.com>
Mon, 26 Feb 2018 03:53:24 +0000 (21:53 -0600)
This allows us to make xseturgency internal.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
config.def.h
st.c
st.h
win.h
x.c

index 877afabc66c772a5420be53f47d39626aa8dce33..dd94be23916a4dc283398d94fa4d84bb7ffdfc8c 100644 (file)
@@ -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 f1f7bc11e5bc15eb84cd52364d78a2daefa7845f..df43fac17186b0765a866ecbb3c98f22638071cd 100644 (file)
--- a/st.c
+++ b/st.c
@@ -2176,10 +2176,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 9ece72f487ccd5323914974e2f2943857a5a50ed..ad943517b2660891505b36c7d79334c60e86676b 100644 (file)
--- a/st.h
+++ b/st.h
@@ -246,6 +246,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 ea45e609604aa963c91d50588e8e27e81914d98c..dee0b7fc4281cda08916a48b2e6ad3495f8e9f27 100644 (file)
--- a/win.h
+++ b/win.h
@@ -8,7 +8,7 @@
 void draw(void);
 void drawregion(int, int, int, int);
 
-void xbell(int);
+void xbell(void);
 void xclipcopy(void);
 void xclippaste(void);
 void xhints(void);
@@ -16,7 +16,6 @@ void xloadcols(void);
 int xsetcolorname(int, const char *);
 void xsettitle(char *);
 void xsetpointermotion(int);
-void xseturgency(int);
 void xresize(int, int);
 void xselpaste(void);
 void xsetsel(char *, Time);
diff --git a/x.c b/x.c
index 426ca28b06abc90b605a1643abcb4d15bea16991..5b3c97b1db9ed9d8a9796df41a83271b71d68ac0 100644 (file)
--- a/x.c
+++ b/x.c
@@ -94,6 +94,7 @@ static void xloadfonts(char *, double);
 static void xunloadfont(Font *);
 static void xunloadfonts(void);
 static void xsetenv(void);
+static void xseturgency(int);
 
 static void expose(XEvent *);
 static void visibility(XEvent *);
@@ -1521,9 +1522,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);
 }
 
 void