diff options
author | Martin Perner <martin@perner.cc> | 2011-09-07 13:09:52 +0200 |
---|---|---|
committer | Martin Perner <martin@perner.cc> | 2011-09-09 21:07:46 +0200 |
commit | dbf4ea77dc318f5d3b68651eabc562cd6cefec51 (patch) | |
tree | 75baccb9efee2febac4837c8dfd5aa8df323f68f /src/Main.hs | |
parent | 4fe99635e87c4f2262a27bf91c1ab6c7e3ee0988 (diff) | |
download | xmobar-dbf4ea77dc318f5d3b68651eabc562cd6cefec51.tar.gz xmobar-dbf4ea77dc318f5d3b68651eabc562cd6cefec51.tar.bz2 |
complete reword of the eventLoop
*) replaced window destroy and create with a reposition
*) replaced the exception for redraw with an MVar
*) put nextEvent into an own thread, communication over the MVar
*) signal handlers for repositioning and screen swap
Notes:
*) getScreenInfo is a parameter of eventLoop because it blocks when there
is an nextEvent waiting for an new event
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Main.hs b/src/Main.hs index 941a844..34a298d 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -41,8 +41,8 @@ import Control.Monad (unless) -- | The main entry point main :: IO () main = do + initThreads d <- openDisplay "" - d' <- openDisplay "" args <- getArgs (o,file) <- getOpts args (c,defaultings) <- case file of @@ -52,17 +52,13 @@ main = do unless (null defaultings) $ putStrLn $ "Fields missing from config defaulted: " ++ intercalate "," defaultings - -- listen for ConfigureEvents on the root window, for xrandr support: - rootw <- rootWindow d (defaultScreen d) - selectInput d rootw structureNotifyMask - conf <- doOpts c o fs <- initFont d (font conf) cls <- mapM (parseTemplate conf) (splitTemplate conf) vars <- mapM (mapM startCommand) cls - (r,w) <- createWin d fs conf - _ <- enableXRandrEventListen d' - eventLoop (XConf d d' r w fs conf) vars + (r,w, srs) <- createWin d fs conf + sig <- setupSignalHandler + eventLoop (XConf d r w fs conf) vars sig srs -- | Splits the template in its parts splitTemplate :: Config -> [String] |