Fix crash when no root pixmap is set
This commit is contained in:
parent
227cf56f44
commit
906dc08d3e
1 changed files with 9 additions and 6 deletions
|
@ -252,6 +252,7 @@ updateRootImage disp = do
|
||||||
rootwin = defaultRootWindow disp
|
rootwin = defaultRootWindow disp
|
||||||
pixmap <- liftM (fromIntegral . fromMaybe 0 . listToMaybe . join . catMaybes) $ forM [atom_XROOTPMAP_ID atoms, atom_XROOTMAP_ID atoms] $
|
pixmap <- liftM (fromIntegral . fromMaybe 0 . listToMaybe . join . catMaybes) $ forM [atom_XROOTPMAP_ID atoms, atom_XROOTMAP_ID atoms] $
|
||||||
\atom -> liftIO $ getWindowProperty32 disp atom rootwin
|
\atom -> liftIO $ getWindowProperty32 disp atom rootwin
|
||||||
|
|
||||||
(_, _, _, rootWidth, rootHeight, _, _) <- liftIO $ getGeometry disp rootwin
|
(_, _, _, rootWidth, rootHeight, _, _) <- liftIO $ getGeometry disp rootwin
|
||||||
|
|
||||||
-- update surface size
|
-- update surface size
|
||||||
|
@ -264,13 +265,15 @@ updateRootImage disp = do
|
||||||
modify $ \state -> state { phiRootImage = newBg }
|
modify $ \state -> state { phiRootImage = newBg }
|
||||||
|
|
||||||
bg <- gets phiRootImage
|
bg <- gets phiRootImage
|
||||||
rootSurface <- liftIO $ Util.createXlibSurface disp pixmap visual (fromIntegral rootWidth) (fromIntegral rootHeight)
|
|
||||||
|
|
||||||
renderWith bg $ withPatternForSurface rootSurface $ \pattern -> do
|
when (pixmap /= 0) $ do
|
||||||
setSource pattern
|
rootSurface <- liftIO $ Util.createXlibSurface disp pixmap visual (fromIntegral rootWidth) (fromIntegral rootHeight)
|
||||||
paint
|
|
||||||
|
renderWith bg $ withPatternForSurface rootSurface $ \pattern -> do
|
||||||
surfaceFinish rootSurface
|
setSource pattern
|
||||||
|
paint
|
||||||
|
|
||||||
|
surfaceFinish rootSurface
|
||||||
|
|
||||||
|
|
||||||
createPanel :: Display -> Window -> [Widget.WidgetState] -> Rectangle -> PhiX PanelState
|
createPanel :: Display -> Window -> [Widget.WidgetState] -> Rectangle -> PhiX PanelState
|
||||||
|
|
Reference in a new issue