Fix crash when no root pixmap is set

This commit is contained in:
Matthias Schiffer 2011-07-22 11:42:22 +02:00
parent 227cf56f44
commit 906dc08d3e

View file

@ -252,6 +252,7 @@ updateRootImage disp = do
rootwin = defaultRootWindow disp
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
-- update surface size
@ -264,6 +265,8 @@ updateRootImage disp = do
modify $ \state -> state { phiRootImage = newBg }
bg <- gets phiRootImage
when (pixmap /= 0) $ do
rootSurface <- liftIO $ Util.createXlibSurface disp pixmap visual (fromIntegral rootWidth) (fromIntegral rootHeight)
renderWith bg $ withPatternForSurface rootSurface $ \pattern -> do