aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-06-04 20:31:43 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-06-04 20:31:43 +0200
commit98a1e3c862dd5321d1cb5f203e44ab95f3696539 (patch)
tree6fac32492dc205aab5a9b1a384b69f91a949630e
parentee21ee2e74b4184e5c51de0e2b96c1c19aecf556 (diff)
downloadxmonad-98a1e3c862dd5321d1cb5f203e44ab95f3696539.tar.gz
xmonad-98a1e3c862dd5321d1cb5f203e44ab95f3696539.tar.xz
xmonad-98a1e3c862dd5321d1cb5f203e44ab95f3696539.zip
focusUp/Down are the same, in reversed order
darcs-hash:20070604183143-a5988-9b9325a10eee13bb6bd96d20ca3b15c12c368883.gz
-rw-r--r--StackSet.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/StackSet.hs b/StackSet.hs
index 8f8c4e3..d1fe054 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -271,13 +271,12 @@ index = with [] integrate
-- the current stack.
--
focusUp, focusDown, swapUp, swapDown :: StackSet i a s -> StackSet i a s
-focusUp = modify Empty $ \c -> case c of
- Node t (l:ls) rs -> Node l ls (t:rs)
- Node t [] rs -> Node x xs [] where (x:xs) = reverse (t:rs)
+focusUp = modify Empty focusUp'
-focusDown = modify Empty $ \c -> case c of
- Node t ls (r:rs) -> Node r (t:ls) rs
- Node t ls [] -> Node x [] xs where (x:xs) = reverse (t:ls)
+focusUp' (Node t (l:ls) rs) = Node l ls (t:rs)
+focusUp' (Node t [] rs) = Node x xs [] where (x:xs) = reverse (t:rs)
+
+focusDown = modify Empty (reverseStack . focusUp' . reverseStack)
swapUp = modify Empty $ \c -> case c of
Node _ [] [] -> c
@@ -289,6 +288,10 @@ swapDown = modify Empty $ \c -> case c of
Node t ls (r:rs) -> Node t (r:ls) rs
Node t ls [] -> Node t [] (reverse ls)
+-- reverse a stack: up becomes down and down becomes up.
+reverseStack (Node t ls rs) = Node t rs ls
+reverseStack x = x
+
--
-- | /O(1) on current window, O(n) in general/. Focus the window 'w',
-- and set its workspace as current.