summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-06-04 02:37:26 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-06-04 02:37:26 +0200
commitb465bbffb9d15dd76cd9d0c46e098ee60ace4f20 (patch)
tree9b74716c616ec4d477d15c6c0c370b6da2755440 /src
parentc87df01f1d1eef7ccd5fb1d03282c6cdb341ce5b (diff)
downloadxmobar-b465bbffb9d15dd76cd9d0c46e098ee60ace4f20.tar.gz
xmobar-b465bbffb9d15dd76cd9d0c46e098ee60ace4f20.tar.bz2
Added --with_threaded configuration flag
Fixes #36
Diffstat (limited to 'src')
-rw-r--r--src/XUtil.hsc7
-rw-r--r--src/Xmobar.hs10
2 files changed, 13 insertions, 4 deletions
diff --git a/src/XUtil.hsc b/src/XUtil.hsc
index 558a4c5..b736c9c 100644
--- a/src/XUtil.hsc
+++ b/src/XUtil.hsc
@@ -2,10 +2,11 @@
-----------------------------------------------------------------------------
-- |
-- Module : XUtil
--- Copyright : (C) 2007, 2011 Andrea Rossato
+-- Copyright : (C) 2007 Andrea Rossato
+-- (C) 2011, 2012 Jose Antonio Ortega Ruiz
-- License : BSD3
--
--- Maintainer : andrea.rossato@unitn.it
+-- Maintainer : jao@gnu.org
-- Stability : unstable
-- Portability : unportable
--
@@ -34,7 +35,7 @@ import Control.Concurrent
import Control.Monad.Trans
import Data.IORef
import Foreign
-import Foreign.C.Types
+-- import Foreign.C.Types
import Graphics.X11.Xlib hiding (textExtents, textWidth)
import qualified Graphics.X11.Xlib as Xlib (textExtents, textWidth)
import Graphics.X11.Xlib.Extras
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index 2358a20..c348f99 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable, CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Xmobar
@@ -84,7 +84,11 @@ startLoop xcfg@(XConf _ _ w _ _) vs = do
sig <- setupSignalHandler
_ <- forkIO (checker tv [] vs sig `catch`
\(SomeException _) -> void (putStrLn "Thread checker failed"))
+#ifdef THREADED_RUNTIME
+ _ <- forkOS (eventer sig `catch`
+#else
_ <- forkIO (eventer sig `catch`
+#endif
\(SomeException _) -> void (putStrLn "Thread eventer failed"))
eventLoop tv xcfg sig
where
@@ -97,7 +101,11 @@ startLoop xcfg@(XConf _ _ w _ _) vs = do
selectInput dpy w (exposureMask .|. structureNotifyMask)
forever $ do
+#ifdef THREADED_RUNTIME
+ nextEvent dpy e
+#else
nextEvent' dpy e
+#endif
ev <- getEvent e
case ev of
ConfigureEvent {} -> putMVar signal Reposition