From e48e3a6fe01b63d693eb33260c26505f891f21a6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 29 Aug 2011 09:32:31 +0200 Subject: Correctly render tiled background pixmaps --- lib/Phi/X11.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/Phi/X11.hs b/lib/Phi/X11.hs index 818a9db..971be37 100644 --- a/lib/Phi/X11.hs +++ b/lib/Phi/X11.hs @@ -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 -- cgit v1.2.3