Correctly render tiled background pixmaps
This commit is contained in:
parent
7ed869fcf1
commit
e48e3a6fe0
1 changed files with 8 additions and 5 deletions
|
@ -218,7 +218,9 @@ updatePanels dispvar = do
|
|||
renderWith buffer $ do
|
||||
save
|
||||
translate (-(fromIntegral $ rect_x area)) (-(fromIntegral $ rect_y area))
|
||||
withPatternForSurface rootImage setSource
|
||||
withPatternForSurface rootImage $ \pattern -> do
|
||||
patternSetExtend pattern ExtendRepeat
|
||||
setSource pattern
|
||||
paint
|
||||
restore
|
||||
|
||||
|
@ -238,6 +240,7 @@ updatePanels dispvar = do
|
|||
-- copy buffer to window
|
||||
liftIO $ do
|
||||
(withDimension area $ clearArea disp (panelWindow panel) 0 0) True
|
||||
--(withDimension area $ copyArea disp (panelPixmap panel) (panelWindow panel) (defaultGC disp $ defaultScreen disp) 0 0) 0 0
|
||||
sync disp False
|
||||
|
||||
return $ panel { panelWidgetState = layoutedWidget, panelWidgetCache = cache' }
|
||||
|
@ -268,15 +271,15 @@ updateRootImage disp = do
|
|||
pixmap <- liftM (fromIntegral . fromMaybe 0 . listToMaybe . join . catMaybes) $ forM [atom_XROOTPMAP_ID atoms, atom_XROOTMAP_ID atoms] $
|
||||
\atom -> liftIO $ getWindowProperty32 disp atom rootwin
|
||||
|
||||
(_, _, _, rootWidth, rootHeight, _, _) <- liftIO $ getGeometry disp rootwin
|
||||
(_, _, _, pixmapWidth, pixmapHeight, _, _) <- liftIO $ getGeometry disp pixmap
|
||||
|
||||
-- update surface size
|
||||
oldBg <- gets phiRootImage
|
||||
imageWidth <- liftM fromIntegral $ imageSurfaceGetWidth oldBg
|
||||
imageHeight <- liftM fromIntegral $ imageSurfaceGetHeight oldBg
|
||||
when (imageWidth /= rootWidth || imageHeight /= rootHeight) $ do
|
||||
when (imageWidth /= pixmapWidth || imageHeight /= pixmapHeight) $ do
|
||||
surfaceFinish oldBg
|
||||
newBg <- liftIO $ createImageSurface FormatRGB24 (fromIntegral rootWidth) (fromIntegral rootHeight)
|
||||
newBg <- liftIO $ createImageSurface FormatRGB24 (fromIntegral pixmapWidth) (fromIntegral pixmapHeight)
|
||||
modify $ \state -> state { phiRootImage = newBg }
|
||||
|
||||
bg <- gets phiRootImage
|
||||
|
@ -287,7 +290,7 @@ updateRootImage disp = do
|
|||
setSourceRGB 0 0 0
|
||||
paint
|
||||
_ -> do
|
||||
rootSurface <- liftIO $ Util.createXlibSurface disp pixmap visual (fromIntegral rootWidth) (fromIntegral rootHeight)
|
||||
rootSurface <- liftIO $ Util.createXlibSurface disp pixmap visual (fromIntegral pixmapWidth) (fromIntegral pixmapHeight)
|
||||
|
||||
renderWith bg $ withPatternForSurface rootSurface $ \pattern -> do
|
||||
setSource pattern
|
||||
|
|
Reference in a new issue