From 832985aec801620baa08bc434def294da8ef3f44 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 21 Sep 2022 00:52:59 +0100 Subject: better abstracted icon drawing interface --- src/Xmobar/Draw/Types.hs | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/Xmobar/Draw/Types.hs') diff --git a/src/Xmobar/Draw/Types.hs b/src/Xmobar/Draw/Types.hs index 219a64b..75dd714 100644 --- a/src/Xmobar/Draw/Types.hs +++ b/src/Xmobar/Draw/Types.hs @@ -17,10 +17,6 @@ module Xmobar.Draw.Types where -import GHC.Word (Word32, Word64) - -import Data.Map (Map) - import Xmobar.Config.Types (Config) import Xmobar.Run.Actions (Action) import Xmobar.Run.Parsers (Segment) @@ -29,22 +25,11 @@ type Position = Double type ActionPos = ([Action], Position, Position) type Actions = [ActionPos] -type BitmapDrawer = Double -> Double -> String -> IO () - -data BitmapType = Mono Word64 | Poly - -data Bitmap = Bitmap { bWidth :: Word32 - , bHeight :: Word32 - , bPixmap :: Word64 - , bShapepixmap :: Maybe Word64 - , bBitmaptype :: BitmapType - } - -type BitmapCache = Map FilePath Bitmap - +type IconLookup = String -> (Double, Double) +type IconDrawer = Double -> Double -> String -> IO () -data DrawContext = DC { dcBitmapDrawer :: BitmapDrawer - , dcBitmapLookup :: String -> Maybe Bitmap +data DrawContext = DC { dcIconDrawer :: IconDrawer + , dcIconLookup :: IconLookup , dcConfig :: Config , dcWidth :: Double , dcHeight :: Double -- cgit v1.2.3