void
switchws(struct swm_region *r, union arg *args)
{
- int wsid = args->id;
+ int wsid = args->id, unmap_old = 0;
struct swm_region *this_r, *other_r;
struct ws_win *win;
struct workspace *new_ws, *old_ws;
if (old_ws->r != NULL)
old_ws->old_r = old_ws->r;
old_ws->r = NULL;
-
- TAILQ_FOREACH(win, &old_ws->winlist, entry)
- unmap_window(win);
+ unmap_old = 1;
} else {
other_r->ws = old_ws;
old_ws->r = other_r;
a.id = SWM_ARG_ID_FOCUSCUR;
focus(new_ws->r, &a);
bar_update();
+
+ /* unmap old windows */
+ if (unmap_old)
+ TAILQ_FOREACH(win, &old_ws->winlist, entry)
+ unmap_window(win);
}
void
}
done:
bar_extra_stop();
-
+ XFreeGC(display, bar_gc);
XCloseDisplay(display);
return (0);