summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-04-11 10:07:47 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-04-11 10:07:47 +0200
commitdb66c05588a593c289576a871b4056cd214d0f91 (patch)
treee28d9b6f3f7ff1e530c3f86d7a3b389d4112aec3 /Operations.hs
parent6ddbbddbcaa88a5f70aca4f8bed6974fa3be25eb (diff)
downloadmetatile-db66c05588a593c289576a871b4056cd214d0f91.tar
metatile-db66c05588a593c289576a871b4056cd214d0f91.zip
clean up tiling code a teensy bit, and comment on the interaction between focus, master, and cycling direction between the modes
darcs-hash:20070411080747-9c5c1-0f6e9cc92481db8ba812976ee8d3cb0f7dde6626
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/Operations.hs b/Operations.hs
index 6118593..333ea19 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -6,6 +6,7 @@ import Data.Bits
import qualified Data.Map as M
import Control.Monad.State
+import Control.Arrow
import System.Posix.Process
import System.Environment
@@ -41,6 +42,7 @@ refresh = do
-- | tile. Compute the positions for windows in horizontal layout
-- mode.
+--
tile :: Rational -> Rectangle -> [Window] -> [(Window, Rectangle)]
tile _ _ [] = []
tile _ d [w] = [(w, d)]
@@ -54,16 +56,23 @@ tile r (Rectangle sx sy sw sh) (w:s)
-- | vtile. Tile vertically.
vtile :: Rational -> Rectangle -> [Window] -> [(Window, Rectangle)]
-vtile r rect ws = map (\(w, wr) -> (w, flipRect wr)) $ tile r (flipRect rect) ws
+vtile r rect = map (second flipRect) . tile r (flipRect rect)
+-- | Flip rectangles around
flipRect :: Rectangle -> Rectangle
-flipRect (Rectangle { rect_x = rx, rect_y = ry, rect_width = rw, rect_height = rh })
- = Rectangle { rect_x = ry, rect_y = rx, rect_width = rh, rect_height = rw }
+flipRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)
-- | switchLayout. Switch to another layout scheme. Switches the
--- current workspace.
+-- current workspace. By convention, a window set as master in Tall mode
+-- remains as master in Wide mode. When switching from full screen to a
+-- tiling mode, the currently focused window becomes a master. When
+-- switching back , the focused window is uppermost.
+--
+-- Note a current `feature' is that 'promote' cycles clockwise in Tall
+-- mode, and counter clockwise in wide mode. This is a feature.
+--
switchLayout :: X ()
-switchLayout = layout $ \fl -> fl { layoutType = rot (layoutType fl) }
+switchLayout = layout $ \fl -> fl { layoutType = rotateLayout (layoutType fl) }
-- | changeSplit. Changes the window split.
changeSplit :: Rational -> X ()