From 7f9e8fa6d9c36cf42430e5239fbdb8bcfdec3e00 Mon Sep 17 00:00:00 2001 From: Karsten Schoelzel Date: Mon, 10 Sep 2007 11:03:29 +0200 Subject: Fix float behaviour, add shiftWin. First, if float is called with window which is on a hidden workspace, then the window will remain on that hidden workspace. Now the focus should change more as expected: float w = (view current) . (shiftWin ws w) where current is the current screen/workspace shiftWin ws w is: - view the workspace w is on - set focus on w - shift ws - set focus back to window it was on that workspace unless w was focused shiftWin was add to StackSet.hs darcs-hash:20070910090329-eb3a1-ae150bf783b36fb4811e92d81b4917066c8733b7 --- tests/Properties.hs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/Properties.hs b/tests/Properties.hs index e11b448..3207f95 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -167,6 +167,9 @@ prop_swap_right_I (n :: NonNegative Int) (x :: T) = prop_shift_I (n :: NonNegative Int) (x :: T) = n `tagMember` x ==> invariant $ shift (fromIntegral n) x +prop_shift_win_I (n :: NonNegative Int) (w :: Char) (x :: T) = + n `tagMember` x && w `member` x ==> invariant $ shiftWin (fromIntegral n) w x + -- --------------------------------------------------------------------- -- 'new' @@ -493,6 +496,23 @@ prop_shift_reversible i (x :: T) = y = swapMaster x n = tag (workspace $ current y) +-- --------------------------------------------------------------------- +-- shiftWin + +-- shiftWin on current window is the same as shift +prop_shift_win_focus i (x :: T) = + i `tagMember` x ==> case peek x of + Nothing -> True + Just w -> shiftWin i w x == shift i x + +-- shiftWin leaves the current screen as it is, if neither i is the tag +-- of the current workspace nor w on the current workspace +prop_shift_win_fix_current i w (x :: T) = + i `tagMember` x && w `member` x && i /= n && findIndex w x /= Just n + ==> (current $ x) == (current $ shiftWin i w x) + where + n = tag (workspace $ current x) + ------------------------------------------------------------------------ -- some properties for layouts: @@ -611,6 +631,9 @@ main = do ,("shift: invariant" , mytest prop_shift_I) ,("shift is reversible" , mytest prop_shift_reversible) + ,("shiftWin: invariant" , mytest prop_shift_win_I) + ,("shiftWin is shift on focus" , mytest prop_shift_win_focus) + ,("shiftWin fix current" , mytest prop_shift_win_fix_current) {- ,("tile 1 window fullsize", mytest prop_tile_fullscreen) -- cgit v1.2.3