From 5478ba895bb5ad811836384953e96e3209038122 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 23 Oct 2018 00:55:41 -0700 Subject: window: vwm_win_focus_next() skip shelf unmap/map When the shelf isn't the currently focused context but the focus next is relative to the focus context the mapping manipulation shouldn't be performed. This would cause unexpected appearance of shelved windows in a virtual desktop should a shelved window become invisibly unmanaged. Simple way to repro is to shelf an mplayer window. When the movie finishes, if you're on a desktop, out of nowhere the next shelved window appears but you're not supposed to be looking at the shelf. A simple visit to the shelf then back to the desktop would undo the anomaly, but it's trivial to fix - hell there was already a FIXME/TODO sitting there. --- src/window.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/window.c b/src/window.c index bffbfe5..2596cca 100644 --- a/src/window.c +++ b/src/window.c @@ -301,19 +301,16 @@ _retry: if (vwin->shelved) { if (next != vwm->focused_shelf) { - /* shelf switch, unmap the focused shelf and take it over */ - /* TODO FIXME: this makes assumptions about the shelf being focused calling unmap/map directly.. */ - vwm_win_unmap(vwm, vwm->focused_shelf); - - XFlush(VWM_XDISPLAY(vwm)); - - vwm_win_map(vwm, next); + if (vwm->focused_context == VWM_CONTEXT_SHELF) { + vwm_win_unmap(vwm, vwm->focused_shelf); + XFlush(VWM_XDISPLAY(vwm)); + vwm_win_map(vwm, next); + } vwm->focused_shelf = next; vwm_win_focus(vwm, next); } } else { if (next != next->desktop->focused_window) { - /* focus the changed window */ vwm_win_focus(vwm, next); XRaiseWindow(VWM_XDISPLAY(vwm), next->xwindow->id); } -- cgit v1.2.3