mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.L.Fullscreen: 'FullscreenFull' hides all windows
The 'FullscreenFull' layout modifier hides all windows fully covered by the fullscreen area, even when no fullscreen windows are present. Fix this, closing #278. Also switch to 'X.U.Rectangle'.
This commit is contained in:
parent
337ca60f76
commit
8ec1efd472
@ -30,17 +30,19 @@ module XMonad.Layout.Fullscreen
|
|||||||
,FullscreenFloat, FullscreenFocus, FullscreenFull
|
,FullscreenFloat, FullscreenFocus, FullscreenFull
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.Layout.LayoutModifier
|
import XMonad.Layout.LayoutModifier
|
||||||
import XMonad.Util.WindowProperties
|
import XMonad.Hooks.ManageHelpers (isFullscreen)
|
||||||
import XMonad.Hooks.ManageHelpers (isFullscreen)
|
import XMonad.Util.WindowProperties
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.Util.Rectangle as R
|
||||||
import Data.List
|
import qualified XMonad.StackSet as W
|
||||||
import Data.Maybe
|
|
||||||
import Data.Monoid
|
import Data.List
|
||||||
import qualified Data.Map as M
|
import Data.Maybe
|
||||||
import Control.Monad
|
import Data.Monoid
|
||||||
import Control.Arrow (second)
|
import qualified Data.Map as M
|
||||||
|
import Control.Monad
|
||||||
|
import Control.Arrow (second)
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- Provides a ManageHook and an EventHook that sends layout messages
|
-- Provides a ManageHook and an EventHook that sends layout messages
|
||||||
@ -107,9 +109,12 @@ instance LayoutModifier FullscreenFull Window where
|
|||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
pureModifier (FullscreenFull frect fulls) rect _ list =
|
pureModifier (FullscreenFull frect fulls) rect _ list =
|
||||||
(map (flip (,) rect') visfulls ++ rest, Nothing)
|
(visfulls' ++ rest', Nothing)
|
||||||
where visfulls = intersect fulls $ map fst list
|
where (visfulls,rest) = partition (flip elem fulls . fst) list
|
||||||
rest = filter (not . (flip elem visfulls `orP` covers rect')) list
|
visfulls' = map (second $ const rect') visfulls
|
||||||
|
rest' = if null visfulls'
|
||||||
|
then rest
|
||||||
|
else filter (not . R.supersetOf rect' . snd) rest
|
||||||
rect' = scaleRationalRect rect frect
|
rect' = scaleRationalRect rect frect
|
||||||
|
|
||||||
instance LayoutModifier FullscreenFocus Window where
|
instance LayoutModifier FullscreenFocus Window where
|
||||||
@ -122,7 +127,7 @@ instance LayoutModifier FullscreenFocus Window where
|
|||||||
pureModifier (FullscreenFocus frect fulls) rect (Just (W.Stack {W.focus = f})) list
|
pureModifier (FullscreenFocus frect fulls) rect (Just (W.Stack {W.focus = f})) list
|
||||||
| f `elem` fulls = ((f, rect') : rest, Nothing)
|
| f `elem` fulls = ((f, rect') : rest, Nothing)
|
||||||
| otherwise = (list, Nothing)
|
| otherwise = (list, Nothing)
|
||||||
where rest = filter (not . ((== f) `orP` covers rect')) list
|
where rest = filter (not . orP (== f) (R.supersetOf rect')) list
|
||||||
rect' = scaleRationalRect rect frect
|
rect' = scaleRationalRect rect frect
|
||||||
pureModifier _ _ Nothing list = (list, Nothing)
|
pureModifier _ _ Nothing list = (list, Nothing)
|
||||||
|
|
||||||
@ -240,15 +245,6 @@ fullscreenManageHook' isFull = isFull --> do
|
|||||||
sendMessageWithNoRefresh FullscreenChanged cw
|
sendMessageWithNoRefresh FullscreenChanged cw
|
||||||
idHook
|
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 ||.
|
-- | Applies a pair of predicates to a pair of operands, combining them with ||.
|
||||||
orP :: (a -> Bool) -> (b -> Bool) -> (a, b) -> Bool
|
orP :: (a -> Bool) -> (b -> Bool) -> (a, b) -> Bool
|
||||||
orP f g (x, y) = f x || g y
|
orP f g (x, y) = f x || g y
|
||||||
|
Loading…
x
Reference in New Issue
Block a user