mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Fullscreen.hs: don't lay out windows obscured by fullscreen
There's no reason to return a rectangle for any window that is totally obscured by a full-screen window, and not doing so has the nice property that when hidden windows' borders overlap with a full-screen window's, the user will not be confused by overlapping partially-drawn borders. It also makes the Fullscreen modifiers combine much better with smartBorders.
This commit is contained in:
parent
09426e9d71
commit
d338e11110
@ -135,6 +135,11 @@
|
||||
Added `sideNavigation` and a parameterised variant, providing a navigation
|
||||
strategy with fewer quirks for tiled layouts using X.L.Spacing.
|
||||
|
||||
* `XMonad.Layout.Fullscreen`
|
||||
|
||||
The fullscreen layouts will now not render any window that is totally
|
||||
obscured by fullscreen windows.
|
||||
|
||||
* `XMonad.Layout.Gaps`
|
||||
|
||||
Extended the sendMessage interface with `ModifyGaps` to allow arbitrary
|
||||
|
@ -109,7 +109,7 @@ instance LayoutModifier FullscreenFull Window where
|
||||
pureModifier (FullscreenFull frect fulls) rect _ list =
|
||||
(map (flip (,) rect') visfulls ++ rest, Nothing)
|
||||
where visfulls = intersect fulls $ map fst list
|
||||
rest = filter (flip notElem visfulls . fst) list
|
||||
rest = filter (not . (flip elem visfulls `orP` covers rect')) list
|
||||
rect' = scaleRationalRect rect frect
|
||||
|
||||
instance LayoutModifier FullscreenFocus Window where
|
||||
@ -122,7 +122,7 @@ instance LayoutModifier FullscreenFocus Window where
|
||||
pureModifier (FullscreenFocus frect fulls) rect (Just (W.Stack {W.focus = f})) list
|
||||
| f `elem` fulls = ((f, rect') : rest, Nothing)
|
||||
| otherwise = (list, Nothing)
|
||||
where rest = filter ((/= f) . fst) list
|
||||
where rest = filter (not . ((== f) `orP` covers rect')) list
|
||||
rect' = scaleRationalRect rect frect
|
||||
pureModifier _ _ Nothing list = (list, Nothing)
|
||||
|
||||
@ -240,3 +240,15 @@ fullscreenManageHook' isFull = isFull --> do
|
||||
sendMessageWithNoRefresh FullscreenChanged cw
|
||||
idHook
|
||||
|
||||
-- | True iff one rectangle completely contains another.
|
||||
covers :: Rectangle -> Rectangle -> Bool
|
||||
(Rectangle x1 y1 w1 h1) `covers` (Rectangle x2 y2 w2 h2) =
|
||||
let fi = fromIntegral
|
||||
in x1 <= x2 &&
|
||||
y1 <= y2 &&
|
||||
x1 + fi w1 >= x2 + fi w2 &&
|
||||
y1 + fi h1 >= y2 + fi h2
|
||||
|
||||
-- | Applies a pair of predicates to a pair of operands, combining them with ||.
|
||||
orP :: (a -> Bool) -> (b -> Bool) -> (a, b) -> Bool
|
||||
orP f g (x, y) = f x || g y
|
||||
|
Loading…
x
Reference in New Issue
Block a user