mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-23 23:43:47 -07:00
Factor rational rect scaling into a separate function
This commit is contained in:
@@ -132,7 +132,7 @@ windows f = do
|
|||||||
tiled = (W.stack . W.workspace . W.current $ this)
|
tiled = (W.stack . W.workspace . W.current $ this)
|
||||||
>>= W.filter (`M.notMember` W.floating ws)
|
>>= W.filter (`M.notMember` W.floating ws)
|
||||||
>>= W.filter (`notElem` vis)
|
>>= W.filter (`notElem` vis)
|
||||||
viewrect@(Rectangle sx sy sw sh) = screenRect $ W.screenDetail w
|
viewrect = screenRect $ W.screenDetail w
|
||||||
|
|
||||||
-- just the tiled windows:
|
-- just the tiled windows:
|
||||||
-- now tile the windows on this workspace, modified by the gap
|
-- now tile the windows on this workspace, modified by the gap
|
||||||
@@ -144,10 +144,7 @@ windows f = do
|
|||||||
-- now the floating windows:
|
-- now the floating windows:
|
||||||
-- move/resize the floating windows, if there are any
|
-- move/resize the floating windows, if there are any
|
||||||
forM_ flt $ \fw -> whenJust (M.lookup fw (W.floating ws)) $
|
forM_ flt $ \fw -> whenJust (M.lookup fw (W.floating ws)) $
|
||||||
\(W.RationalRect rx ry rw rh) -> do
|
\r -> tileWindow fw $ scaleRationalRect viewrect r
|
||||||
tileWindow fw $ Rectangle
|
|
||||||
(sx + floor (toRational sw*rx)) (sy + floor (toRational sh*ry))
|
|
||||||
(floor (toRational sw*rw)) (floor (toRational sh*rh))
|
|
||||||
|
|
||||||
let vs = flt ++ map fst rs
|
let vs = flt ++ map fst rs
|
||||||
io $ restackWindows d vs
|
io $ restackWindows d vs
|
||||||
@@ -172,6 +169,12 @@ windows f = do
|
|||||||
isMouseFocused <- asks mouseFocused
|
isMouseFocused <- asks mouseFocused
|
||||||
unless isMouseFocused $ clearEvents enterWindowMask
|
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. set the WM_STATE property
|
||||||
setWMState :: Window -> Int -> X ()
|
setWMState :: Window -> Int -> X ()
|
||||||
setWMState w v = withDisplay $ \dpy -> do
|
setWMState w v = withDisplay $ \dpy -> do
|
||||||
|
Reference in New Issue
Block a user