diff options
author | Adam Vogt <vogt.adam@gmail.com> | 2009-09-30 23:21:10 +0200 |
---|---|---|
committer | Adam Vogt <vogt.adam@gmail.com> | 2009-09-30 23:21:10 +0200 |
commit | c564db8c132b45147002fd29322e10dbb71e5280 (patch) | |
tree | a31bc5667c10faf8af6ed7a15a1bf00d2ca950e3 | |
parent | 6b814c405e0432391e3dff2bfeac6ef8efffaaba (diff) | |
download | XMonadContrib-c564db8c132b45147002fd29322e10dbb71e5280.tar.gz XMonadContrib-c564db8c132b45147002fd29322e10dbb71e5280.tar.xz XMonadContrib-c564db8c132b45147002fd29322e10dbb71e5280.zip |
Remove redundant parentheses from L.MouseResizableTile
Ignore-this: 1853cde69ec03ce5b88726b4de05f2b0
darcs-hash:20090930212110-1499c-a1c23b6c2dc4003773556e66ae9eaf5e1d03c86c.gz
-rw-r--r-- | XMonad/Layout/MouseResizableTile.hs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/XMonad/Layout/MouseResizableTile.hs b/XMonad/Layout/MouseResizableTile.hs index 05a60cc..e8e69f6 100644 --- a/XMonad/Layout/MouseResizableTile.hs +++ b/XMonad/Layout/MouseResizableTile.hs @@ -106,8 +106,8 @@ instance LayoutClass MouseResizableTile a where num = length wins sr' = mirrorAdjust sr (mirrorRect sr) (rects, preparedDraggers) = tile (nmaster state) (masterFrac state) - ((leftFracs state) ++ repeat mrtFraction) - ((rightFracs state) ++ repeat mrtFraction) sr' num + (leftFracs state ++ repeat mrtFraction) + (rightFracs state ++ repeat mrtFraction) sr' num rects' = map (mirrorAdjust id mirrorRect . sanitizeRectangle sr') rects in do mapM_ deleteDragger $ draggers state @@ -123,9 +123,9 @@ instance LayoutClass MouseResizableTile a where handleMessage state m | Just (IncMasterN d) <- fromMessage m = return $ Just $ state { nmaster = max 0 (nmaster state + d) } - | Just (Shrink) <- fromMessage m = + | Just Shrink <- fromMessage m = return $ Just $ state { masterFrac = max 0 (masterFrac state - mrtDelta) } - | Just (Expand) <- fromMessage m = + | Just Expand <- fromMessage m = return $ Just $ state { masterFrac = min 1 (masterFrac state + mrtDelta) } | Just ShrinkSlave <- fromMessage m = return $ Just $ modifySlave state (-mrtDelta) @@ -196,7 +196,7 @@ tile :: Int -> Rational -> [Rational] -> [Rational] -> Rectangle -> Int -> ([Rec tile nmaster' masterFrac' leftFracs' rightFracs' sr num | num <= nmaster' = splitVertically (take (num - 1) leftFracs') sr True 0 | nmaster' == 0 = splitVertically (take (num - 1) rightFracs') sr False 0 - | otherwise = (leftRects ++ rightRects, [masterDragger] ++ leftDraggers ++ rightDraggers) + | otherwise = (leftRects ++ rightRects, masterDragger : leftDraggers ++ rightDraggers) where ((sr1, sr2), masterDragger) = splitHorizontallyBy masterFrac' sr (leftRects, leftDraggers) = splitVertically (take (nmaster' - 1) leftFracs') sr1 True 0 (rightRects, rightDraggers) = splitVertically (take (num - nmaster' - 1) rightFracs') sr2 False 0 @@ -204,10 +204,10 @@ tile nmaster' masterFrac' leftFracs' rightFracs' sr num splitVertically :: RealFrac r => [r] -> Rectangle -> Bool -> Int -> ([Rectangle], [DraggerWithRect]) splitVertically [] r _ _ = ([r], []) splitVertically (f:fx) (Rectangle sx sy sw sh) isLeft num = - let nextRect = Rectangle sx sy sw (smallh - (div mrtDraggerSize 2)) + let nextRect = Rectangle sx sy sw $ smallh - div mrtDraggerSize 2 (otherRects, otherDragger) = splitVertically fx (Rectangle sx (sy + fromIntegral smallh + mrtDraggerOffset) - sw (sh - smallh - (div mrtDraggerSize 2))) + sw (sh - smallh - div mrtDraggerSize 2)) isLeft (num + 1) draggerRect = Rectangle sx (sy + fromIntegral smallh - mrtDraggerOffset) sw mrtDraggerSize draggerInfo = if isLeft @@ -220,9 +220,9 @@ splitVertically (f:fx) (Rectangle sx sy sw sh) isLeft num = splitHorizontallyBy :: RealFrac r => r -> Rectangle -> ((Rectangle, Rectangle), DraggerWithRect) splitHorizontallyBy f (Rectangle sx sy sw sh) = ((leftHalf, rightHalf), (draggerRect, mrtHDoubleArrow, draggerInfo)) where leftw = floor $ fromIntegral sw * f - leftHalf = Rectangle sx sy (leftw - (div mrtDraggerSize 2)) sh + leftHalf = Rectangle sx sy (leftw - mrtDraggerSize `div` 2) sh rightHalf = Rectangle (sx + fromIntegral leftw + mrtDraggerOffset) sy - (sw - fromIntegral leftw - (div mrtDraggerSize 2)) sh + (sw - fromIntegral leftw - mrtDraggerSize `div` 2) sh draggerRect = Rectangle (sx + fromIntegral leftw - mrtDraggerOffset) sy mrtDraggerSize sh draggerInfo = MasterDragger sx (fromIntegral sw) @@ -234,7 +234,6 @@ createDragger sr (draggerRect, draggerCursor, draggerInfo) = do deleteDragger :: DraggerWithWin -> X () deleteDragger (draggerWin, _) = deleteWindow draggerWin - handleResize :: [DraggerWithWin] -> Bool -> Event -> X () handleResize draggers' isM ButtonEvent { ev_window = ew, ev_event_type = et } | et == buttonPress, Just x <- lookup ew draggers' = case x of |