aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-06-28 19:47:11 +0300
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-06-28 19:47:14 +0300
commit573818ebc33b316b65533c8be4df37452058dbc3 (patch)
treed1ed23caba80ab6ba48d82b6b772d259af7a6eed
parent80be270dbbef3188e09811f455337d99872c0973 (diff)
rework change_desktop function - no need for prevdeskidx
prevdeskidx is only needed when last_desktop function is introduced. no need to keep yet another global variable that remains unused.
-rw-r--r--monsterwm.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/monsterwm.c b/monsterwm.c
index 5ee39f8..855ec99 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -150,7 +150,7 @@ static int xerrorstart();
#include "config.h"
static Bool running = True;
-static int prevdeskidx = 0, currdeskidx = 0;
+static int currdeskidx = 0;
static int screen, wh, ww, mode = DEFAULT_MODE;
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0, win_unfocus, win_focus;
@@ -213,11 +213,8 @@ void buttonpress(XEvent *e) {
* first all others then the current */
void change_desktop(const Arg *arg) {
if (arg->i == currdeskidx) return;
- prevdeskidx = currdeskidx;
- selectdesktop(arg->i);
- if (curr) XMapWindow(dis, curr->win);
- for (Client *c=head; c; c=c->next) XMapWindow(dis, c->win);
- selectdesktop(prevdeskidx);
+ if (desktops[arg->i].curr) XMapWindow(dis, desktops[arg->i].curr->win);
+ for (Client *c=desktops[arg->i].head; c; c=c->next) XMapWindow(dis, c->win);
for (Client *c=head; c; c=c->next) if (c != curr) XUnmapWindow(dis, c->win);
if (curr) XUnmapWindow(dis, curr->win);
selectdesktop(arg->i);