summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar.hs
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-04-11 18:25:56 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-04-11 18:25:56 +0200
commitae71122da6a475563c2fed228542b33325c96ae5 (patch)
treeaf1d34a624b34c4d543694c915f1460566105a51 /src/Xmobar.hs
parent247e5b85bb53ba229b444082fd2d6b7261617014 (diff)
parentf794954a1c582328a43c6674d76e15b05fee5bb5 (diff)
downloadxmobar-ae71122da6a475563c2fed228542b33325c96ae5.tar.gz
xmobar-ae71122da6a475563c2fed228542b33325c96ae5.tar.bz2
Merge branch 'dev/use-x11-xrandr-support' of https://github.com/mathstuf/xmobar into mathstuf-dev/use-x11-xrandr-support
Diffstat (limited to 'src/Xmobar.hs')
-rw-r--r--src/Xmobar.hs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index dc671fe..3083087 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -33,6 +33,7 @@ import Prelude hiding (catch)
import Graphics.X11.Xlib hiding (textExtents, textWidth)
import Graphics.X11.Xlib.Extras
import Graphics.X11.Xinerama
+import Graphics.X11.Xrandr
import Control.Arrow ((&&&))
import Control.Monad.Reader
@@ -88,28 +89,20 @@ startLoop xcfg@(XConf _ _ w _ _) vs = do
where
-- Reacts on events from X
eventer signal =
- alloca $ \ptrEventBase ->
- alloca $ \ptrErrorBase ->
allocaXEvent $ \e -> do
dpy <- openDisplay ""
- -- keyPressMask is the same value as RRScreenChangeNotifyMask
- xrrSelectInput dpy (defaultRootWindow dpy) keyPressMask
+ xrrSelectInput dpy (defaultRootWindow dpy) rrScreenChangeNotifyMask
selectInput dpy w (exposureMask .|. structureNotifyMask)
- _ <- xrrQueryExtension dpy ptrEventBase ptrErrorBase
- xrrEventBase <- peek ptrEventBase
-
forever $ do
nextEvent' dpy e
ev <- getEvent e
case ev of
ConfigureEvent {} -> putMVar signal Reposition
ExposeEvent {} -> putMVar signal Wakeup
- _ ->
- -- 0 is the value of RRScreenChangeNotify
- when ( (fromIntegral (ev_event_type ev) - xrrEventBase) == 0)
- $ putMVar signal Reposition
+ RRScreenChangeNotifyEvent {} -> putMVar signal Reposition
+ _ -> return ()
-- | Send signal to eventLoop every time a var is updated
checker :: TVar [String] -> [String] -> [[(Maybe ThreadId, TVar String)]] -> MVar SignalType -> IO ()