diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-08-21 21:39:26 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-08-21 21:39:26 +0200 |
commit | 8222c6041d2e2ed5258aa0f9188d2011a17285c9 (patch) | |
tree | 263f36b511eadacb15cdd775377aafbb495d9632 /lib/Phi/Widgets/Systray.hs | |
parent | 42c14fa1ca9d47ae32766aaa2aa995c684b7e9cb (diff) | |
download | phi-8222c6041d2e2ed5258aa0f9188d2011a17285c9.tar phi-8222c6041d2e2ed5258aa0f9188d2011a17285c9.zip |
Add a lot of caching framework
Diffstat (limited to 'lib/Phi/Widgets/Systray.hs')
-rw-r--r-- | lib/Phi/Widgets/Systray.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Phi/Widgets/Systray.hs b/lib/Phi/Widgets/Systray.hs index 662c6a7..7e7ec63 100644 --- a/lib/Phi/Widgets/Systray.hs +++ b/lib/Phi/Widgets/Systray.hs @@ -55,6 +55,8 @@ instance Widget Systray SystrayState () where lastReset <- newIORef 0 return $ SystrayState phi (head . getScreens $ dispvar) 0 lastReset [] + initCache _ = () + minSize _ (SystrayState _ systrayScreen _ _ icons) height screen = case True of _ | screen == systrayScreen -> max 0 $ (length icons)*(height+2)-1 | otherwise -> 0 @@ -63,13 +65,13 @@ instance Widget Systray SystrayState () where render Systray (SystrayState phi systrayScreen reset lastResetRef icons) x y w h screen = do when (screen == systrayScreen) $ do - lastReset <- readIORef lastResetRef - writeIORef lastResetRef reset + lastReset <- liftIO $ readIORef lastResetRef + liftIO $ writeIORef lastResetRef reset forM_ (zip [0..] icons) $ \(i, SystrayIconState midParent window) -> do let x' = x + i*(h+2) sendMessage phi $ RenderIcon midParent window x' y h h (lastReset /= reset) - surface <- createImageSurface FormatARGB32 w h + surface <- liftIO $ createImageSurface FormatARGB32 w h renderWith surface $ do setOperator OperatorClear paint |