mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Update to safer initColor api
This commit is contained in:
parent
7b022b9981
commit
0675af2b53
@ -463,8 +463,8 @@ drawWin = do
|
|||||||
wh = widthOfScreen scr
|
wh = widthOfScreen scr
|
||||||
ht = height c
|
ht = height c
|
||||||
bw = promptBorderWidth c
|
bw = promptBorderWidth c
|
||||||
bgcolor <- io $ initColor d (bgColor c)
|
Just bgcolor <- io $ initColor d (bgColor c)
|
||||||
border <- io $ initColor d (borderColor c)
|
Just border <- io $ initColor d (borderColor c)
|
||||||
p <- io $ createPixmap d w wh ht
|
p <- io $ createPixmap d w wh ht
|
||||||
(defaultDepthOfScreen scr)
|
(defaultDepthOfScreen scr)
|
||||||
io $ fillDrawable d p gc border bgcolor (fi bw) wh ht
|
io $ fillDrawable d p gc border bgcolor (fi bw) wh ht
|
||||||
@ -569,8 +569,8 @@ drawComplWin w compl = do
|
|||||||
scr = defaultScreenOfDisplay d
|
scr = defaultScreenOfDisplay d
|
||||||
bw = promptBorderWidth c
|
bw = promptBorderWidth c
|
||||||
gc = gcon st
|
gc = gcon st
|
||||||
bgcolor <- io $ initColor d (bgColor c)
|
Just bgcolor <- io $ initColor d (bgColor c)
|
||||||
border <- io $ initColor d (borderColor c)
|
Just border <- io $ initColor d (borderColor c)
|
||||||
|
|
||||||
(_,_,wh,ht,xx,yy) <- getComplWinDim compl
|
(_,_,wh,ht,xx,yy) <- getComplWinDim compl
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ module XMonad.Util.Font (
|
|||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import Foreign
|
import Foreign
|
||||||
|
import Control.Applicative
|
||||||
|
import Data.Maybe
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
import Data.List
|
import Data.List
|
||||||
@ -49,10 +51,10 @@ data XMonadFont = Core FontStruct
|
|||||||
|
|
||||||
-- | Get the Pixel value for a named color: if an invalid name is
|
-- | Get the Pixel value for a named color: if an invalid name is
|
||||||
-- given the black pixel will be returned.
|
-- given the black pixel will be returned.
|
||||||
stringToPixel :: MonadIO m => Display -> String -> m Pixel
|
stringToPixel :: (Functor m, MonadIO m) => Display -> String -> m Pixel
|
||||||
stringToPixel d s = liftIO $ catch getIt fallBack
|
stringToPixel d s = fromMaybe fallBack <$> liftIO getIt
|
||||||
where getIt = initColor d s
|
where getIt = initColor d s
|
||||||
fallBack = const $ return $ blackPixel d (defaultScreen d)
|
fallBack = blackPixel d (defaultScreen d)
|
||||||
|
|
||||||
|
|
||||||
-- | Given a fontname returns the font structure. If the font name is
|
-- | Given a fontname returns the font structure. If the font name is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user