From b465bbffb9d15dd76cd9d0c46e098ee60ace4f20 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 4 Jun 2012 02:37:26 +0200 Subject: Added --with_threaded configuration flag Fixes #36 --- src/XUtil.hsc | 7 ++++--- src/Xmobar.hs | 10 +++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3