diff options
author | Spencer Janssen <spencerjanssen@gmail.com> | 2008-11-18 08:28:49 +0100 |
---|---|---|
committer | Spencer Janssen <spencerjanssen@gmail.com> | 2008-11-18 08:28:49 +0100 |
commit | 699980621be39057f6eaeb2440c4794a89b35eb4 (patch) | |
tree | 48cae42e1353a33f531a17910f1b6273ff1d7025 /XMonad | |
parent | 6a033ebd9a2fa56edb676323cc947337678feca2 (diff) | |
download | metatile-699980621be39057f6eaeb2440c4794a89b35eb4.tar metatile-699980621be39057f6eaeb2440c4794a89b35eb4.zip |
Factor rational rect scaling into a separate function
darcs-hash:20081118072849-25a6b-a0f2fd04fc8be6f50bcec28136be7dc57fa4d07a
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Operations.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs index d98311c..6d6b04c 100644 --- a/XMonad/Operations.hs +++ b/XMonad/Operations.hs @@ -132,7 +132,7 @@ windows f = do tiled = (W.stack . W.workspace . W.current $ this) >>= W.filter (`M.notMember` W.floating ws) >>= W.filter (`notElem` vis) - viewrect@(Rectangle sx sy sw sh) = screenRect $ W.screenDetail w + viewrect = screenRect $ W.screenDetail w -- just the tiled windows: -- now tile the windows on this workspace, modified by the gap @@ -144,10 +144,7 @@ windows f = do -- now the floating windows: -- move/resize the floating windows, if there are any forM_ flt $ \fw -> whenJust (M.lookup fw (W.floating ws)) $ - \(W.RationalRect rx ry rw rh) -> do - tileWindow fw $ Rectangle - (sx + floor (toRational sw*rx)) (sy + floor (toRational sh*ry)) - (floor (toRational sw*rw)) (floor (toRational sh*rh)) + \r -> tileWindow fw $ scaleRationalRect viewrect r let vs = flt ++ map fst rs io $ restackWindows d vs @@ -172,6 +169,12 @@ windows f = do isMouseFocused <- asks mouseFocused unless isMouseFocused $ clearEvents enterWindowMask +-- | Produce the actual rectangle from a screen and a ratio on that screen. +scaleRationalRect :: Rectangle -> W.RationalRect -> Rectangle +scaleRationalRect (Rectangle sx sy sw sh) (W.RationalRect rx ry rw rh) + = Rectangle (sx + scale sw rx) (sy + scale sh ry) (scale sw rw) (scale sh rh) + where scale s r = floor (toRational s * r) + -- | setWMState. set the WM_STATE property setWMState :: Window -> Int -> X () setWMState w v = withDisplay $ \dpy -> do |