aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout
diff options
context:
space:
mode:
authorBrent Yorgey <byorgey@gmail.com>2008-03-03 21:46:19 +0100
committerBrent Yorgey <byorgey@gmail.com>2008-03-03 21:46:19 +0100
commite3fa27b9f3abaf43ffd39aa9f44e3b207d557224 (patch)
treef62e494d5ca7daee6717e99aef59baf9cc1f6cc3 /XMonad/Layout
parent5d9f59c7c082122d2708cb9590b4027eb6312bc2 (diff)
downloadXMonadContrib-e3fa27b9f3abaf43ffd39aa9f44e3b207d557224.tar.gz
XMonadContrib-e3fa27b9f3abaf43ffd39aa9f44e3b207d557224.tar.xz
XMonadContrib-e3fa27b9f3abaf43ffd39aa9f44e3b207d557224.zip
Magnifier: fix behavior for windows on the bottom + right of the screen. Now all magnified windows will be the same size, possibly shifted in order to fit completely on the screen.
darcs-hash:20080303204619-bd4d7-a8b06481a66d9ca146a4a5b0edd6f0d3728f6889.gz
Diffstat (limited to 'XMonad/Layout')
-rw-r--r--XMonad/Layout/Magnifier.hs17
1 files changed, 10 insertions, 7 deletions
diff --git a/XMonad/Layout/Magnifier.hs b/XMonad/Layout/Magnifier.hs
index 8ab9bb3..b163fe4 100644
--- a/XMonad/Layout/Magnifier.hs
+++ b/XMonad/Layout/Magnifier.hs
@@ -123,7 +123,7 @@ unlessMaster mainmod r s wrs = if null (up s) then return (wrs, Nothing)
applyMagnifier :: Double -> Rectangle -> t -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe a)
applyMagnifier z r _ wrs = do focused <- withWindowSet (return . peek)
- let mag (w,wr) ws | focused == Just w = ws ++ [(w, shrink r $ magnify z wr)]
+ let mag (w,wr) ws | focused == Just w = ws ++ [(w, fit r $ magnify z wr)]
| otherwise = (w,wr) : ws
return (reverse $ foldr mag [] wrs, Nothing)
@@ -134,9 +134,12 @@ magnify zoom (Rectangle x y w h) = Rectangle x' y' w' h'
w' = round $ fromIntegral w * zoom
h' = round $ fromIntegral h * zoom
-shrink :: Rectangle -> Rectangle -> Rectangle
-shrink (Rectangle sx sy sw sh) (Rectangle x y w h) = Rectangle x' y' w' h'
- where x' = max sx x
- y' = max sy y
- w' = min w (fromIntegral sx + sw - fromIntegral x')
- h' = min h (fromIntegral sy + sh - fromIntegral y')
+fit :: Rectangle -> Rectangle -> Rectangle
+fit (Rectangle sx sy sw sh) (Rectangle x y w h) = Rectangle x' y' w' h'
+ where x' = max sx (x - (max 0 (x + fi w - sx - fi sw)))
+ y' = max sy (y - (max 0 (y + fi h - sy - fi sh)))
+ w' = min sw w
+ h' = min sh h
+
+fi :: (Num b, Integral a) => a -> b
+fi = fromIntegral \ No newline at end of file