aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2007-06-11 02:54:07 +0200
committerStefan O'Rear <stefanor@cox.net>2007-06-11 02:54:07 +0200
commita37c5f895fa6c04fc2d5572aa9d2d335cd5b40d4 (patch)
treef92ee0fafb2cfb325de614319debd8d1d39ba796
parent3c2deb25cd3021fcebddf31c1783bf2a6a0dc425 (diff)
downloadXMonadContrib-a37c5f895fa6c04fc2d5572aa9d2d335cd5b40d4.tar.gz
XMonadContrib-a37c5f895fa6c04fc2d5572aa9d2d335cd5b40d4.tar.xz
XMonadContrib-a37c5f895fa6c04fc2d5572aa9d2d335cd5b40d4.zip
Fix LayoutHints in the presence of nonzero border widths
darcs-hash:20070611005407-e3110-c5445ef9ad2a263be70e06b82208df53cac3e52d.gz
-rw-r--r--LayoutHints.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/LayoutHints.hs b/LayoutHints.hs
index 4c998fd..bcc38d9 100644
--- a/LayoutHints.hs
+++ b/LayoutHints.hs
@@ -3,11 +3,17 @@ module XMonadContrib.LayoutHints ( layoutHints ) where
-- to use:
-- defaultLayouts = [ layoutHints tiled, layoutHints $ mirror tiled , full ]
-import Operations ( applySizeHints )
+import Operations ( applySizeHints, D )
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras ( getWMNormalHints )
+import {-#SOURCE#-} Config (borderWidth)
import XMonad hiding ( trace )
+-- | Expand a size by the given multiple of the border width. The
+-- multiple is most commonly 1 or -1.
+adjBorders :: Dimension -> D -> D
+adjBorders mult (w,h) = (w+2*mult*borderWidth, h+2*mult*borderWidth)
+
layoutHints :: Layout -> Layout
layoutHints l = l { doLayout = \r x -> doLayout l r x >>= applyHints
, modifyLayout = \x -> fmap layoutHints `fmap` modifyLayout l x }
@@ -17,5 +23,5 @@ applyHints xs = mapM applyHint xs
where applyHint (w,Rectangle a b c d) =
withDisplay $ \disp ->
do sh <- io $ getWMNormalHints disp w
- let (c',d') = applySizeHints sh (c,d)
+ let (c',d') = adjBorders 1 . applySizeHints sh . adjBorders (-1) $ (c,d)
return (w, Rectangle a b c' d')