diff options
Diffstat (limited to 'x.c')
| -rw-r--r-- | x.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -55,6 +55,7 @@ static void clipcopy(const Arg *); static void clippaste(const Arg *); static void numlock(const Arg *); static void selpaste(const Arg *); +static void changealpha(const Arg *); static void zoom(const Arg *); static void zoomabs(const Arg *); static void zoomreset(const Arg *); @@ -166,6 +167,7 @@ static void xsetenv(void); static void xseturgency(int); static int evcol(XEvent *); static int evrow(XEvent *); +static float clamp(float, float, float); static void expose(XEvent *); static void visibility(XEvent *); @@ -299,6 +301,18 @@ numlock(const Arg *dummy) } void +changealpha(const Arg *arg) +{ + if((alpha > 0 && arg->f < 0) || (alpha < 1 && arg->f > 0)) + alpha += arg->f; + alpha = clamp(alpha, 0.0, 1.0); + alphaUnfocused = clamp(alpha-alphaOffset, 0.0, 1.0); + + xloadcols(); + redraw(); +} + +void zoom(const Arg *arg) { Arg larg; @@ -351,6 +365,15 @@ evrow(XEvent *e) return y / win.ch; } +float +clamp(float value, float lower, float upper) { + if(value < lower) + return lower; + if(value > upper) + return upper; + return value; +} + void mousesel(XEvent *e, int done) { @@ -2228,6 +2251,7 @@ run: cols = MAX(cols, 1); rows = MAX(rows, 1); defaultbg = MAX(LEN(colorname), 256); + alphaUnfocused = alpha-alphaOffset; tnew(cols, rows); xinit(cols, rows); xsetenv(); |
