X.L.Magnifier: Implement magnifier['] in term of magnifiercz[']

This commit is contained in:
slotThe
2021-03-24 09:52:41 +01:00
parent c3fa5138f9
commit 5fbfcaada0

View File

@@ -84,7 +84,7 @@ import XMonad.Util.XUtils
-- | Increase the size of the window that has focus
magnifier :: l a -> ModifiedLayout Magnifier l a
magnifier = ModifiedLayout (Mag 1 (1.5,1.5) On All)
magnifier = magnifiercz 1.5
-- | Change the size of the window that has focus by a custom zoom
magnifiercz :: Rational -> l a -> ModifiedLayout Magnifier l a
@@ -93,7 +93,12 @@ magnifiercz cz = ModifiedLayout (Mag 1 (fromRational cz, fromRational cz) On All
-- | Increase the size of the window that has focus, unless if it is one of the
-- master windows.
magnifier' :: l a -> ModifiedLayout Magnifier l a
magnifier' = ModifiedLayout (Mag 1 (1.5,1.5) On NoMaster)
magnifier' = magnifiercz' 1.5
-- | Increase the size of the window that has focus by a custom zoom,
-- unless if it is one of the the master windows.
magnifiercz' :: Rational -> l a -> ModifiedLayout Magnifier l a
magnifiercz' cz = ModifiedLayout (Mag 1 (fromRational cz, fromRational cz) On NoMaster)
-- | Magnifier that defaults to Off
magnifierOff :: l a -> ModifiedLayout Magnifier l a
@@ -103,11 +108,6 @@ magnifierOff = ModifiedLayout (Mag 1 (1.5,1.5) Off All)
maxMagnifierOff :: l a -> ModifiedLayout Magnifier l a
maxMagnifierOff = ModifiedLayout (Mag 1 (1000,1000) Off All)
-- | Increase the size of the window that has focus by a custom zoom,
-- unless if it is one of the the master windows.
magnifiercz' :: Rational -> l a -> ModifiedLayout Magnifier l a
magnifiercz' cz = ModifiedLayout (Mag 1 (fromRational cz, fromRational cz) On NoMaster)
-- | A magnifier that greatly magnifies just the vertical direction
maximizeVertical :: l a -> ModifiedLayout Magnifier l a
maximizeVertical = ModifiedLayout (Mag 1 (1,1000) Off All)
@@ -164,7 +164,7 @@ magnify (zoomx,zoomy) (Rectangle x y w h) = Rectangle x' y' w' h'
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)))
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