Fix background update race, speed up rendering!

This commit is contained in:
Matthias Schiffer 2011-07-22 22:36:43 +02:00
parent 906dc08d3e
commit de1dc32b33

View file

@ -208,18 +208,23 @@ updatePanels dispvar = do
let screen = defaultScreen disp let screen = defaultScreen disp
visual = defaultVisual disp screen visual = defaultVisual disp screen
buffer <- liftIO $ withDimension area $ Util.createXlibSurface disp pixmap visual xbuffer <- liftIO $ withDimension area $ Util.createXlibSurface disp pixmap visual
renderWith buffer $ do liftIO $ (withDimension area $ withSimilarSurface xbuffer ContentColor) $ \buffer -> do
withPatternForSurface rootImage $ \pattern -> do renderWith buffer $ do
save withPatternForSurface rootImage $ \pattern -> do
translate (-(fromIntegral $ rect_x area)) (-(fromIntegral $ rect_y area)) save
setSource pattern translate (-(fromIntegral $ rect_x area)) (-(fromIntegral $ rect_y area))
paint setSource pattern
restore paint
Widget.renderWidgets layoutedWidgets $ panelScreenArea panel restore
Widget.renderWidgets layoutedWidgets $ panelScreenArea panel
renderWith xbuffer $ do
withPatternForSurface buffer $ \pattern -> do
setSource pattern
paint
surfaceFinish buffer surfaceFinish xbuffer
-- copy buffer to window -- copy buffer to window
liftIO $ do liftIO $ do
@ -266,14 +271,19 @@ updateRootImage disp = do
bg <- gets phiRootImage bg <- gets phiRootImage
when (pixmap /= 0) $ do case pixmap of
rootSurface <- liftIO $ Util.createXlibSurface disp pixmap visual (fromIntegral rootWidth) (fromIntegral rootHeight) 0 -> do
renderWith bg $ do
renderWith bg $ withPatternForSurface rootSurface $ \pattern -> do setSourceRGB 0 0 0
setSource pattern paint
paint _ -> do
rootSurface <- liftIO $ Util.createXlibSurface disp pixmap visual (fromIntegral rootWidth) (fromIntegral rootHeight)
surfaceFinish rootSurface
renderWith bg $ withPatternForSurface rootSurface $ \pattern -> do
setSource pattern
paint
surfaceFinish rootSurface
createPanel :: Display -> Window -> [Widget.WidgetState] -> Rectangle -> PhiX PanelState createPanel :: Display -> Window -> [Widget.WidgetState] -> Rectangle -> PhiX PanelState