struct ws_win *focus; /* may be NULL */
struct ws_win *focus_prev; /* may be NULL */
struct swm_region *r; /* may be NULL */
+ struct swm_region *old_r; /* may be NULL */
struct ws_win_list winlist; /* list of windows in ws */
/* stacker state */
other_r = new_ws->r;
if (other_r == NULL) {
/* if the other workspace is hidden, switch windows */
- /* map new window first to prevent ugly blinking */
+ if (old_ws->r != NULL)
+ old_ws->old_r = old_ws->r;
old_ws->r = NULL;
old_ws->restack = 1;
- TAILQ_FOREACH(win, &new_ws->winlist, entry)
- XMapRaised(display, win->id);
+ /*
+ * Map new windows first if they were here before
+ * to minimize ugly blinking.
+ */
+ if (new_ws->old_r == this_r)
+ TAILQ_FOREACH(win, &new_ws->winlist, entry)
+ XMapRaised(display, win->id);
TAILQ_FOREACH(win, &old_ws->winlist, entry)
XUnmapWindow(display, win->id);
/* remove any old regions */
while ((r = TAILQ_FIRST(&screens[i].rl)) != NULL) {
- r->ws->r = NULL;
+ r->ws->old_r = r->ws->r = NULL;
XDestroyWindow(display, r->bar_window);
TAILQ_REMOVE(&screens[i].rl, r, entry);
TAILQ_INSERT_TAIL(&screens[i].orl, r, entry);
ws->restack = 1;
ws->focus = NULL;
ws->r = NULL;
+ ws->old_r = NULL;
TAILQ_INIT(&ws->winlist);
for (k = 0; layouts[k].l_stack != NULL; k++)