make TilePrime compile again

This commit is contained in:
l.mai 2007-11-05 23:32:18 +00:00
parent bd42371d9e
commit 8d5afd87d7
3 changed files with 14 additions and 12 deletions

View File

@ -77,7 +77,7 @@ import XMonad.SwapWorkspaces ()
import XMonad.Tabbed () import XMonad.Tabbed ()
import XMonad.TagWindows () import XMonad.TagWindows ()
import XMonad.ThreeColumns () import XMonad.ThreeColumns ()
-- import XMonad.TilePrime () import XMonad.TilePrime ()
import XMonad.ToggleLayouts () import XMonad.ToggleLayouts ()
import XMonad.TwoPane () import XMonad.TwoPane ()
import XMonad.XMonadPrompt () import XMonad.XMonadPrompt ()

View File

@ -21,13 +21,14 @@ module XMonad.Layout.TilePrime (
) where ) where
import Control.Monad (mplus) import Control.Monad (mplus)
import Control.Monad.Reader (asks)
import Data.List (mapAccumL) import Data.List (mapAccumL)
import Graphics.X11.Xlib import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras (getWMNormalHints) import Graphics.X11.Xlib.Extras (getWMNormalHints)
import XMonad.Operations import XMonad.Operations
import XMonad.Layouts
import XMonad hiding (trace) import XMonad hiding (trace)
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import {-#SOURCE#-} Config (borderWidth)
-- $usage -- $usage
-- You can use this module with the following in your Config.hs file: -- You can use this module with the following in your Config.hs file:
@ -61,6 +62,7 @@ instance LayoutClass TilePrime Window where
incmastern (IncMasterN d) = c { nmaster = max 0 $ nmaster c + d } incmastern (IncMasterN d) = c { nmaster = max 0 $ nmaster c + d }
doLayout TilePrime { frac = f, nmaster = m, flipped = flp } rect s = do doLayout TilePrime { frac = f, nmaster = m, flipped = flp } rect s = do
bW <- asks (borderWidth . config)
let xs = W.integrate s let xs = W.integrate s
hints <- withDisplay $ \ disp -> io (mapM (getWMNormalHints disp) xs) hints <- withDisplay $ \ disp -> io (mapM (getWMNormalHints disp) xs)
let xs' = zip xs hints let xs' = zip xs hints
@ -70,20 +72,20 @@ instance LayoutClass TilePrime Window where
| null leftXs = (Rectangle 0 0 0 0, rect) | null leftXs = (Rectangle 0 0 0 0, rect)
| flp = splitVerticallyBy f rect | flp = splitVerticallyBy f rect
| otherwise = splitHorizontallyBy f rect | otherwise = splitHorizontallyBy f rect
masters = fillWindows leftRect leftXs masters = fillWindows bW leftRect leftXs
slaves = fillWindows rightRect rightXs slaves = fillWindows bW rightRect rightXs
return (masters ++ slaves, Nothing) return (masters ++ slaves, Nothing)
where where
fillWindows r xs = snd $ mapAccumL aux (r,n) xs fillWindows bW r xs = snd $ mapAccumL (aux bW) (r,n) xs
where n = fromIntegral (length xs) :: Rational where n = fromIntegral (length xs) :: Rational
aux (r,n) (x,hint) = ((rest,n-1),(x,r')) aux bW (r,n) (x,hint) = ((rest,n-1),(x,r'))
where where
(allocated, _) | flp = splitHorizontallyBy (recip n) r (allocated, _) | flp = splitHorizontallyBy (recip n) r
| otherwise = splitVerticallyBy (recip n) r | otherwise = splitVerticallyBy (recip n) r
(w,h) = applySizeHints hint `underBorders` rect_D allocated (w,h) = underBorders bW (applySizeHints hint) (rect_D allocated)
r' = r { rect_width = w, rect_height = h } r' = r { rect_width = w, rect_height = h }
@ -96,9 +98,9 @@ rect_D :: Rectangle -> D
rect_D Rectangle { rect_width = w, rect_height = h } = (w,h) rect_D Rectangle { rect_width = w, rect_height = h } = (w,h)
-- | Transform a function on dimensions into one without regard for borders -- | Transform a function on dimensions into one without regard for borders
underBorders :: (D -> D) -> D -> D underBorders :: Dimension -> (D -> D) -> D -> D
underBorders f = adjBorders 1 . f . adjBorders (-1) underBorders bW f = adjBorders bW 1 . f . adjBorders bW (-1)
-- | Modify dimensions by a multiple of the current borders -- | Modify dimensions by a multiple of the current borders
adjBorders :: Dimension -> D -> D adjBorders :: Dimension -> Dimension -> D -> D
adjBorders mult (w,h) = (w+2*mult*borderWidth, h+2*mult*borderWidth) adjBorders bW mult (w,h) = (w+2*mult*bW, h+2*mult*bW)

View File

@ -81,7 +81,7 @@ library
-- XMonad.Layout.SwitchTrans -- XMonad.Layout.SwitchTrans
XMonad.Layout.Tabbed XMonad.Layout.Tabbed
XMonad.Layout.ThreeColumns XMonad.Layout.ThreeColumns
-- XMonad.Layout.TilePrime XMonad.Layout.TilePrime
XMonad.Layout.ToggleLayouts XMonad.Layout.ToggleLayouts
XMonad.Layout.TwoPane XMonad.Layout.TwoPane
XMonad.Layout.WindowNavigation XMonad.Layout.WindowNavigation