aboutsummaryrefslogtreecommitdiff
path: root/monsterwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'monsterwm.c')
-rw-r--r--monsterwm.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/monsterwm.c b/monsterwm.c
index 1022476..121c2d6 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -646,12 +646,10 @@ void update_current(void) {
client* wintoclient(Window w) {
client *c = NULL;
Bool found = False;
- int cd = current_desktop;
- save_desktop(cd);
- for (int d=0; d<DESKTOPS && !found; d++) {
- select_desktop(d);
+ int d, cd;
+ save_desktop(cd = current_desktop);
+ for (select_desktop(d=0); d<DESKTOPS && !found; select_desktop(++d))
for (c=head; c; c=c->next) if ((found = (w == c->win))) break;
- }
select_desktop(cd);
return c;
}