From: Daniel Déchelotte <[email protected]>
When changing workspace, mapped windows are unmapped from top to bottom
(referring to their stacking order), causing mapped but obscured windows
to briefly appear when the obscuring window is unmapped and until they
are themselves unmapped. [This might not be visible on recent hardware].
The fix is to unmap windows in reverse stacking order when changing
workspace.
---
src/workspace.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/workspace.c b/src/workspace.c
index 491452b..2fd3925 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -462,6 +462,8 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount)
void wWorkspaceForceChange(WScreen * scr, int workspace)
{
WWindow *tmp, *foc = NULL, *foc2 = NULL;
+ WWindow **toUnmap;
+ int toUnmapSize, toUnmapCount;
if (workspace >= MAX_WORKSPACES || workspace < 0)
return;
@@ -480,6 +482,10 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
+ toUnmapSize = 16;
+ toUnmapCount = 0;
+ toUnmap = wmalloc(toUnmapSize * sizeof(WWindow *));
+
if ((tmp = scr->focused_window) != NULL) {
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped ||
tmp->flags.shaded) &&
!WFLAGP(tmp, no_focusable)) ||
tmp->flags.changing_workspace) {
@@ -494,7 +500,12 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
/* unmap windows not on this workspace */
if ((tmp->flags.mapped || tmp->flags.shaded) &&
!IS_OMNIPRESENT(tmp) &&
!tmp->flags.changing_workspace) {
- wWindowUnmap(tmp);
+ if (toUnmapCount == toUnmapSize)
+ {
+ toUnmapSize *= 2;
+ toUnmap = wrealloc(toUnmap,
toUnmapSize * sizeof(WWindow *));
+ }
+ toUnmap[toUnmapCount++] = tmp;
}
/* also unmap miniwindows not on this workspace
*/
if (!wPreferences.sticky_icons &&
tmp->flags.miniaturized &&
@@ -543,6 +554,12 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
tmp = tmp->prev;
}
+ while (toUnmapCount > 0)
+ {
+ wWindowUnmap(toUnmap[--toUnmapCount]);
+ }
+ wfree(toUnmap);
+
/* Gobble up events unleashed by our mapping & unmapping.
* These may trigger various grab-initiated focus &
* crossing events. However, we don't care about them,
--
1.7.10.4
--
To unsubscribe, send mail to [email protected].