Operations.windows is responsible for setting initial properties, remove redundant code from Main

This commit is contained in:
Spencer Janssen 2007-10-01 17:06:28 +00:00
parent 8b8433a9e7
commit 8b3dc01e53

28
Main.hs
View File

@ -50,9 +50,11 @@ main = do
hSetBuffering stdout NoBuffering hSetBuffering stdout NoBuffering
args <- getArgs args <- getArgs
let winset | ("--resume" : s : _) <- args let initialWinset = new defaultLayout workspaces $ zipWith SD xinesc gaps
winset | ("--resume" : s : _) <- args
, [(x, "")] <- reads s = W.ensureTags defaultLayout workspaces x , [(x, "")] <- reads s = W.ensureTags defaultLayout workspaces x
| otherwise = new defaultLayout workspaces $ zipWith SD xinesc gaps | otherwise = initialWinset
gaps = take (length xinesc) $ defaultGaps ++ repeat (0,0,0,0) gaps = take (length xinesc) $ defaultGaps ++ repeat (0,0,0,0)
cf = XConf cf = XConf
@ -61,7 +63,7 @@ main = do
, normalBorder = nbc , normalBorder = nbc
, focusedBorder = fbc } , focusedBorder = fbc }
st = XState st = XState
{ windowset = winset { windowset = initialWinset
, mapped = S.empty , mapped = S.empty
, waitingUnmap = M.empty , waitingUnmap = M.empty
, dragging = Nothing } , dragging = Nothing }
@ -77,22 +79,18 @@ main = do
sync dpy False sync dpy False
ws <- scan dpy rootw -- on the resume case, will pick up new windows
allocaXEvent $ \e -> allocaXEvent $ \e ->
runX cf st $ do runX cf st $ do
-- walk workspace, resetting X states/mask for windows -- bootstrap the windowset, Operations.windows will identify all
-- TODO, general iterators for these lists. -- the windows in winset as new and set initial properties for
sequence_ [ setInitialProperties w >> reveal w -- those windows
| wk <- map W.workspace (W.current winset : W.visible winset) windows (const winset)
, w <- W.integrate' (W.stack wk) ]
sequence_ [ setInitialProperties w >> hide w -- scan for all top-level windows, add the unmanaged ones to the
| wk <- W.hidden winset -- windowset
, w <- W.integrate' (W.stack wk) ] ws <- io $ scan dpy rootw
mapM_ manage ws
mapM_ manage ws -- find new windows
refresh
-- main loop, for all you HOF/recursion fans out there. -- main loop, for all you HOF/recursion fans out there.
forever $ handle =<< io (nextEvent dpy e >> getEvent e) forever $ handle =<< io (nextEvent dpy e >> getEvent e)