summaryrefslogtreecommitdiffstats
path: root/lib/Phi/X11.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Phi/X11.hs')
-rw-r--r--lib/Phi/X11.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Phi/X11.hs b/lib/Phi/X11.hs
index 110e9d4..818a9db 100644
--- a/lib/Phi/X11.hs
+++ b/lib/Phi/X11.hs
@@ -18,7 +18,7 @@ import Data.Char
import Control.Concurrent
import Control.Concurrent.MVar
-import Control.Monad.State
+import Control.Monad.State.Strict
import Control.Monad.Reader
import Control.Monad.Trans
@@ -51,7 +51,7 @@ data PanelState w s c = (Widget.Widget w s c) => PanelState { panelWindow
, panelScreenArea :: !Rectangle
, panelWidget :: !w
, panelWidgetState :: !s
- , panelWidgetCache :: !(Maybe c)
+ , panelWidgetCache :: !c
}
data PhiConfig = PhiConfig { phiPhi :: !Phi
@@ -205,7 +205,8 @@ updatePanels dispvar = do
area = panelArea panel
let layoutedWidget = (withDimension area $ Widget.layout (panelWidget panel) (panelWidgetState panel)) $ panelScreenArea panel
- panelSurfaces <- liftIO $ (withDimension area $ Widget.render (panelWidget panel) layoutedWidget 0 0) (panelScreenArea panel)
+ (panelSurfaces, cache') <- liftIO $ flip runStateT (panelWidgetCache panel) $
+ (withDimension area $ Widget.render (panelWidget panel) layoutedWidget 0 0) (panelScreenArea panel)
Widget.withDisplay dispvar $ \disp -> do
let screen = defaultScreen disp
@@ -239,7 +240,7 @@ updatePanels dispvar = do
(withDimension area $ clearArea disp (panelWindow panel) 0 0) True
sync disp False
- return $ panel { panelWidgetState = layoutedWidget }
+ return $ panel { panelWidgetState = layoutedWidget, panelWidgetCache = cache' }
modify $ \state -> state { phiPanels = panels' }
@@ -311,7 +312,7 @@ createPanel disp win w s screenRect = do
, panelScreenArea = screenRect
, panelWidget = w
, panelWidgetState = s
- , panelWidgetCache = Nothing
+ , panelWidgetCache = initCache w
}
createPanelWindow :: Display -> Rectangle -> PhiX w s c Window