Refactor MouseResize, remove isDecoration and introduce isInStack, isVisible, isInvisible

This patch includes several changes, which are strictly related and
cannot be recorded separately:
- remove Decoraion.isDecoartion and introduce Decoration.isInStack
  (with the related change to LayoutHints)
- in Decoration introduce useful utilities: isVisible, isInvisible,
  isWithin and lookFor'
- MouseResize: - invisible inputOnly windows will not be created;
	       - fix a bug in the read instance which caused a failure
                 in the state deserialization.
This commit is contained in:
Andrea Rossato
2008-02-18 10:57:26 +00:00
parent cb3f424823
commit 651acdbc3e
3 changed files with 69 additions and 34 deletions

View File

@@ -13,15 +13,17 @@
-- Make layouts respect size hints.
-----------------------------------------------------------------------------
module XMonad.Layout.LayoutHints (
-- * usage
-- $usage
layoutHints,
LayoutHints) where
module XMonad.Layout.LayoutHints
( -- * usage
-- $usage
layoutHints
, LayoutHints
) where
import XMonad hiding ( trace )
import XMonad.Layout.LayoutModifier
import XMonad.Layout.Decoration ( isDecoration )
import XMonad.Layout.Decoration ( isInStack )
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
@@ -49,14 +51,13 @@ data LayoutHints a = LayoutHints deriving (Read, Show)
instance LayoutModifier LayoutHints Window where
modifierDescription _ = "Hinted"
redoLayout _ _ _ xs = do
redoLayout _ _ s xs = do
bW <- asks (borderWidth . config)
xs' <- mapM (applyHint bW) xs
return (xs', Nothing)
where
applyHint bW (w,r@(Rectangle a b c d)) =
withDisplay $ \disp -> do
isd <- isDecoration w
sh <- io $ getWMNormalHints disp w
let (c',d') = adjBorders 1 bW . applySizeHints sh . adjBorders bW (-1) $ (c,d)
return (w, if isd then r else Rectangle a b c' d')
return (w, if isInStack s w then r else Rectangle a b c' d')