diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2007-12-28 13:59:13 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2007-12-28 13:59:13 +0100 |
commit | ddb291c94fbb1d051b34d281d70151f2ee9d45ae (patch) | |
tree | 921b91a6932594203f07151107286782338095c4 | |
parent | 609f68f80a50cfcfd3744fab9b72549a7782ca2a (diff) | |
download | XMonadContrib-ddb291c94fbb1d051b34d281d70151f2ee9d45ae.tar.gz XMonadContrib-ddb291c94fbb1d051b34d281d70151f2ee9d45ae.tar.xz XMonadContrib-ddb291c94fbb1d051b34d281d70151f2ee9d45ae.zip |
textExtentsXMF doesn't require the display
darcs-hash:20071228125913-32816-e6193e40cb78fed678761c550644a7c64062cb56.gz
Diffstat (limited to '')
-rw-r--r-- | XMonad/Prompt.hs | 4 | ||||
-rw-r--r-- | XMonad/Util/Font.cpphs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs index 41ff787..3459db7 100644 --- a/XMonad/Prompt.hs +++ b/XMonad/Prompt.hs @@ -454,7 +454,7 @@ printPrompt drw = do ht = height c fsl <- io $ textWidthXMF (dpy st) fs f psl <- io $ textWidthXMF (dpy st) fs p - (_,asc,desc,_) <- io $ textExtentsXMF (dpy st) fs str + (_,asc,desc,_) <- io $ textExtentsXMF fs str let y = fi $ ((ht - fi (asc + desc)) `div` 2) + fi asc x = (asc + desc) `div` 2 @@ -521,7 +521,7 @@ getComplWinDim compl = do (x,y) = case position c of Top -> (0,ht) Bottom -> (0, (0 + rem_height - actual_height)) - (_,asc,desc,_) <- io $ textExtentsXMF (dpy st) fs $ head compl + (_,asc,desc,_) <- io $ textExtentsXMF fs $ head compl let yp = fi $ (ht + fi (asc - desc)) `div` 2 xp = (asc + desc) `div` 2 yy = map fi . take (fi actual_rows) $ [yp,(yp + ht)..] diff --git a/XMonad/Util/Font.cpphs b/XMonad/Util/Font.cpphs index d3ee154..dd232f1 100644 --- a/XMonad/Util/Font.cpphs +++ b/XMonad/Util/Font.cpphs @@ -102,10 +102,10 @@ textWidthXMF dpy (Xft xftdraw) s = liftIO $ do return $ xglyphinfo_width gi #endif -textExtentsXMF :: MonadIO m => Display -> XMonadFont -> String -> m (FontDirection,Int32,Int32,CharStruct) -textExtentsXMF _ (Core fs) s = return $ textExtents fs s +textExtentsXMF :: MonadIO m => XMonadFont -> String -> m (FontDirection,Int32,Int32,CharStruct) +textExtentsXMF (Core fs) s = return $ textExtents fs s #ifdef XFT -textExtentsXMF _ (Xft xftfont) _ = liftIO $ do +textExtentsXMF (Xft xftfont) _ = liftIO $ do ascent <- xftfont_ascent xftfont descent <- xftfont_descent xftfont return (error "Font direction touched", fi ascent, fi descent, error "Font overall size touched") @@ -120,7 +120,7 @@ stringPosition :: XMonadFont -> Rectangle -> Align -> String -> X (Position,Posi stringPosition fs (Rectangle _ _ w h) al s = do dpy <- asks display width <- io $ textWidthXMF dpy fs s - (_,a,d,_) <- io $ textExtentsXMF dpy fs s + (_,a,d,_) <- io $ textExtentsXMF fs s let y = fi $ ((h - fi (a + d)) `div` 2) + fi a; x = case al of AlignCenter -> fi (w `div` 2) - fi (width `div` 2) |