diff options
| author | jao <jao@gnu.org> | 2022-09-22 22:05:33 +0100 | 
|---|---|---|
| committer | jao <jao@gnu.org> | 2022-09-22 22:05:33 +0100 | 
| commit | 579b787c66124c1bc67dfa7a4ad00f3a8e3611cb (patch) | |
| tree | a415a00e1c03597a301d3d136bf588d1fb8b12e9 /src/Xmobar/X11/Text.hs | |
| parent | 832985aec801620baa08bc434def294da8ef3f44 (diff) | |
| download | xmobar-579b787c66124c1bc67dfa7a4ad00f3a8e3611cb.tar.gz xmobar-579b787c66124c1bc67dfa7a4ad00f3a8e3611cb.tar.bz2 | |
import clean-ups
Diffstat (limited to 'src/Xmobar/X11/Text.hs')
| -rw-r--r-- | src/Xmobar/X11/Text.hs | 38 | 
1 files changed, 19 insertions, 19 deletions
| diff --git a/src/Xmobar/X11/Text.hs b/src/Xmobar/X11/Text.hs index 6da96fa..357ee3c 100644 --- a/src/Xmobar/X11/Text.hs +++ b/src/Xmobar/X11/Text.hs @@ -20,16 +20,16 @@ module Xmobar.X11.Text      , textWidth      ) where -import Control.Exception (SomeException, handle) +import qualified Control.Exception as E +import qualified Foreign as F +import qualified System.Mem.Weak as W -import Foreign -import Graphics.X11.Xlib hiding (textExtents, textWidth) -import Graphics.X11.Xlib.Extras -import System.Mem.Weak ( addFinalizer ) +import qualified Graphics.X11.Xlib as X +import qualified Graphics.X11.Xlib.Extras as Xx -type XFont = FontSet +type XFont = Xx.FontSet -initFont :: Display -> String -> IO XFont +initFont :: X.Display -> String -> IO XFont  initFont = initUtf8Font  miscFixedFont :: String @@ -37,21 +37,21 @@ miscFixedFont = "-misc-fixed-*-*-*-*-*-*-*-*-*-*-*-*"  -- | Given a fontname returns the font structure. If the font name is  --  not valid the default font will be loaded and returned. -initUtf8Font :: Display -> String -> IO FontSet +initUtf8Font :: X.Display -> String -> IO Xx.FontSet  initUtf8Font d s = do -  (_,_,f) <- handle fallBack getIt -  addFinalizer f (freeFontSet d f) +  (_,_,f) <- E.handle fallBack getIt +  W.addFinalizer f (Xx.freeFontSet d f)    return f -      where getIt = createFontSet d s -            fallBack :: SomeException -> IO ([String], String, FontSet) -            fallBack = const $ createFontSet d miscFixedFont +      where getIt = Xx.createFontSet d s +            fallBack :: E.SomeException -> IO ([String], String, Xx.FontSet) +            fallBack = const $ Xx.createFontSet d miscFixedFont -textWidth :: Display -> XFont -> String -> IO Int -textWidth _   fs s = return $ fromIntegral $ wcTextEscapement fs s +textWidth :: X.Display -> XFont -> String -> IO Int +textWidth _   fs s = return $ fromIntegral $ Xx.wcTextEscapement fs s -textExtents :: XFont -> String -> IO (Int32,Int32) +textExtents :: XFont -> String -> IO (F.Int32, F.Int32)  textExtents fs s = do -  let (_,rl)  = wcTextExtents fs s -      ascent  = fromIntegral $ negate (rect_y rl) -      descent = fromIntegral $ rect_height rl + fromIntegral (rect_y rl) +  let (_,rl)  = Xx.wcTextExtents fs s +      ascent  = fromIntegral $ negate (X.rect_y rl) +      descent = fromIntegral $ X.rect_height rl + fromIntegral (X.rect_y rl)    return (ascent, descent) | 
