aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-07-09 22:36:13 +0300
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-07-20 18:52:17 +0300
commiteaedf7026248b353409a1da6bed201fc0e8ff3bc (patch)
tree5bf27829b4039a2d9a71706bc12d3f9425fb0117
parent1390645281b2efed42c401ea069a6c054947b41c (diff)
rework change_desktop function - check bounds
-rw-r--r--monsterwm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/monsterwm.c b/monsterwm.c
index bbee69c..8fbf554 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -213,7 +213,7 @@ void buttonpress(XEvent *e) {
* then unmap the old windows
* first all others then the current */
void change_desktop(const Arg *arg) {
- if (arg->i == currdeskidx) return;
+ if (arg->i == currdeskidx || arg->i < 0 || arg->i >= DESKTOPS) return;
Desktop *d = &desktops[currdeskidx], *n = &desktops[(currdeskidx = arg->i)];
if (n->curr) XMapWindow(dis, n->curr->win);
for (Client *c = n->head; c; c = c->next) XMapWindow(dis, c->win);