mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
XMonad.Layout.Spacing: extreme compatibility
* Reintroduce the original 'ModifySpacing' type and constructor as deprecated; the new 'ModifySpacing' type was renamed to 'SpacingModifier'. Suggested by @LSLeary. * Types 'SpacingWithEdge', 'SmartSpacing', and 'SmartSpacingWithEdge' have been reintroduced as deprecated type synonyms of 'Spacing'. Work by @LSLeary. Also 'borderMap' is now exported; it might be useful.
This commit is contained in:
parent
2fde742e7a
commit
3e68036360
@ -21,7 +21,7 @@ module XMonad.Layout.Spacing
|
|||||||
-- $usage
|
-- $usage
|
||||||
Border (..)
|
Border (..)
|
||||||
, Spacing (..)
|
, Spacing (..)
|
||||||
, ModifySpacing (..)
|
, SpacingModifier (..)
|
||||||
, spacingRaw
|
, spacingRaw
|
||||||
, setSmartSpacing
|
, setSmartSpacing
|
||||||
, setScreenSpacing, setScreenSpacingEnabled
|
, setScreenSpacing, setScreenSpacingEnabled
|
||||||
@ -33,9 +33,12 @@ module XMonad.Layout.Spacing
|
|||||||
, incWindowSpacing, incScreenSpacing
|
, incWindowSpacing, incScreenSpacing
|
||||||
, decWindowSpacing, decScreenSpacing
|
, decWindowSpacing, decScreenSpacing
|
||||||
, incScreenWindowSpacing, decScreenWindowSpacing
|
, incScreenWindowSpacing, decScreenWindowSpacing
|
||||||
, borderIncrementBy
|
, borderMap, borderIncrementBy
|
||||||
-- * Backwards Compatibility
|
-- * Backwards Compatibility
|
||||||
-- $backwardsCompatibility
|
-- $backwardsCompatibility
|
||||||
|
, SpacingWithEdge
|
||||||
|
, SmartSpacing, SmartSpacingWithEdge
|
||||||
|
, ModifySpacing (..)
|
||||||
, spacing, spacingWithEdge
|
, spacing, spacingWithEdge
|
||||||
, smartSpacing, smartSpacingWithEdge
|
, smartSpacing, smartSpacingWithEdge
|
||||||
, setSpacing, incSpacing
|
, setSpacing, incSpacing
|
||||||
@ -178,6 +181,9 @@ instance Eq a => LayoutModifier Spacing a where
|
|||||||
= Just $ s { windowBorder = f wb }
|
= Just $ s { windowBorder = f wb }
|
||||||
| Just (ModifyWindowBorderEnabled f) <- fromMessage m
|
| Just (ModifyWindowBorderEnabled f) <- fromMessage m
|
||||||
= Just $ s { windowBorderEnabled = f wbe }
|
= Just $ s { windowBorderEnabled = f wbe }
|
||||||
|
| Just (ModifySpacing f) <- fromMessage m
|
||||||
|
= Just $ let f' = borderMap (fromIntegral . f . fromIntegral)
|
||||||
|
in s { screenBorder = f' sb, windowBorder = f' wb }
|
||||||
| otherwise
|
| otherwise
|
||||||
= Nothing
|
= Nothing
|
||||||
|
|
||||||
@ -196,7 +202,7 @@ spacingRaw b sb sbe wb wbe = ModifiedLayout (Spacing b sb sbe wb wbe)
|
|||||||
|
|
||||||
-- | Messages to alter the state of 'Spacing' using the endomorphic function
|
-- | Messages to alter the state of 'Spacing' using the endomorphic function
|
||||||
-- arguments.
|
-- arguments.
|
||||||
data ModifySpacing
|
data SpacingModifier
|
||||||
= ModifySmartBorder (Bool -> Bool)
|
= ModifySmartBorder (Bool -> Bool)
|
||||||
| ModifyScreenBorder (Border -> Border)
|
| ModifyScreenBorder (Border -> Border)
|
||||||
| ModifyScreenBorderEnabled (Bool -> Bool)
|
| ModifyScreenBorderEnabled (Bool -> Bool)
|
||||||
@ -204,7 +210,7 @@ data ModifySpacing
|
|||||||
| ModifyWindowBorderEnabled (Bool -> Bool)
|
| ModifyWindowBorderEnabled (Bool -> Bool)
|
||||||
deriving (Typeable)
|
deriving (Typeable)
|
||||||
|
|
||||||
instance Message ModifySpacing
|
instance Message SpacingModifier
|
||||||
|
|
||||||
-- | Set 'smartBorder' to the given 'Bool'.
|
-- | Set 'smartBorder' to the given 'Bool'.
|
||||||
setSmartSpacing :: Bool -> X ()
|
setSmartSpacing :: Bool -> X ()
|
||||||
@ -322,13 +328,30 @@ orderSelect o (lt,eq,gt) = case o of
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Backwards Compatibility:
|
-- Backwards Compatibility:
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
{-# DEPRECATED SpacingWithEdge, SmartSpacing, SmartSpacingWithEdge "Use Spacing instead." #-}
|
||||||
|
{-# DEPRECATED ModifySpacing "Use SpacingModifier instead, perhaps with sendMessages." #-}
|
||||||
{-# DEPRECATED spacing, spacingWithEdge, smartSpacing, smartSpacingWithEdge "Use spacingRaw instead." #-}
|
{-# DEPRECATED spacing, spacingWithEdge, smartSpacing, smartSpacingWithEdge "Use spacingRaw instead." #-}
|
||||||
{-# DEPRECATED setSpacing "Use setScreenWindowSpacing instead." #-}
|
{-# DEPRECATED setSpacing "Use setScreenWindowSpacing instead." #-}
|
||||||
{-# DEPRECATED incSpacing "Use incScreenWindowSpacing instead." #-}
|
{-# DEPRECATED incSpacing "Use incScreenWindowSpacing instead." #-}
|
||||||
|
|
||||||
-- $backwardsCompatibility
|
-- $backwardsCompatibility
|
||||||
-- The following functions exist solely for compatibility with pre-0.14
|
-- The following functions and types exist solely for compatibility with
|
||||||
-- releases.
|
-- pre-0.14 releases.
|
||||||
|
|
||||||
|
-- | A type synonym for the 'Spacing' 'LayoutModifier'.
|
||||||
|
type SpacingWithEdge = Spacing
|
||||||
|
|
||||||
|
-- | A type synonym for the 'Spacing' 'LayoutModifier'.
|
||||||
|
type SmartSpacing = Spacing
|
||||||
|
|
||||||
|
-- | A type synonym for the 'Spacing' 'LayoutModifier'.
|
||||||
|
type SmartSpacingWithEdge = Spacing
|
||||||
|
|
||||||
|
-- | Message to dynamically modify (e.g. increase\/decrease\/set) the size of
|
||||||
|
-- the screen spacing and window spacing. See 'SpacingModifier'.
|
||||||
|
data ModifySpacing = ModifySpacing (Int -> Int) deriving (Typeable)
|
||||||
|
|
||||||
|
instance Message ModifySpacing
|
||||||
|
|
||||||
-- | Surround all windows by a certain number of pixels of blank space. See
|
-- | Surround all windows by a certain number of pixels of blank space. See
|
||||||
-- 'spacingRaw'.
|
-- 'spacingRaw'.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user