summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Bitmap.hs1
-rw-r--r--src/Parsers.hs3
-rw-r--r--src/XUtil.hsc24
-rw-r--r--src/Xmobar.hs16
4 files changed, 4 insertions, 40 deletions
diff --git a/src/Bitmap.hs b/src/Bitmap.hs
index 8a86f92..6e4eed5 100644
--- a/src/Bitmap.hs
+++ b/src/Bitmap.hs
@@ -6,7 +6,6 @@ module Bitmap
import Control.Monad
import Data.Map hiding (foldr, map, filter)
import Graphics.X11.Xlib
-import Graphics.X11.Xlib.Extras
import System.Directory (doesFileExist)
import System.Mem.Weak ( addFinalizer )
import XGraphic
diff --git a/src/Parsers.hs b/src/Parsers.hs
index 4703733..9872a63 100644
--- a/src/Parsers.hs
+++ b/src/Parsers.hs
@@ -21,7 +21,6 @@ module Parsers
) where
import Config
-import Types
import Runnable
import Commands
@@ -29,6 +28,8 @@ import qualified Data.Map as Map
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Perm
+data Widget = Icon String | Text String
+
type ColorString = String
-- | Runs the string parser
diff --git a/src/XUtil.hsc b/src/XUtil.hsc
index 720e895..164a309 100644
--- a/src/XUtil.hsc
+++ b/src/XUtil.hsc
@@ -17,8 +17,6 @@ module XUtil
, initFont
, initCoreFont
, initUtf8Font
- , loadBitmap
- , drawBitmap
, textExtents
, textWidth
, printString
@@ -41,10 +39,7 @@ import qualified Graphics.X11.Xlib as Xlib (textExtents, textWidth)
import Graphics.X11.Xlib.Extras
import System.Mem.Weak ( addFinalizer )
import System.Posix.Types (Fd(..))
-import System.Directory (doesFileExist)
import System.IO
-import XGraphic
-import Types
#if defined XFT || defined UTF8
# if __GLASGOW_HASKELL__ < 612
@@ -158,25 +153,6 @@ textExtents (Xft xftfont) _ = do
return (ascent, descent)
#endif
-loadBitmap :: Display -> Drawable -> FilePath -> IO (Maybe Bitmap)
-loadBitmap d w p = do
- exist <- doesFileExist p
- if exist
- then do
- (bw, bh, bp, _, _) <- readBitmapFile d w p
- addFinalizer bp (freePixmap d bp)
- return $ Just $ Bitmap bw bh bp
- else
- return Nothing
-
-drawBitmap :: Display -> Drawable -> XFont -> GC -> String -> String
- -> Position -> Position -> Bitmap -> IO ()
-drawBitmap d p _ gc fc bc x y i = do
- withColors d [fc, bc] $ \[fc', bc'] -> do
- setForeground d gc fc'
- setBackground d gc bc'
- io $ copyPlane d (pixmap i) p gc 0 0 (width i) (height i) x (y - (fi $ height i)) 1
-
printString :: Display -> Drawable -> XFont -> GC -> String -> String
-> Position -> Position -> String -> IO ()
printString d p (Core fs) gc fc bc x y s = do
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index b7355c4..04f0770 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -43,12 +43,12 @@ import Control.Exception (handle, SomeException(..))
import Data.Bits
import Data.Map hiding (foldr, map, filter)
+import Bitmap
import Config
import Parsers
import Commands
import Runnable
import Signal
-import Types
import Window
import XUtil
import ColorCache
@@ -230,18 +230,6 @@ updateString conf v = do
let l:c:r:_ = s ++ repeat ""
io $ mapM (parseString conf) [l, c, r]
-updateCache :: Display -> Window -> Map FilePath Bitmap -> [[(Widget, String)]] -> IO (Map FilePath Bitmap)
-updateCache dpy win cache ps = do
- let paths = map (\(Icon p, _) -> p) . concatMap (filter icons) $ ps
- icons (Icon _, _) = True
- icons _ = False
- foldM (\m path -> if member path m
- then return m
- else do bitmap <- io $ loadBitmap dpy win path
- case bitmap of
- Nothing -> return m
- Just bmap -> return $ insert path bmap m) cache paths
-
-- $print
-- | Draws in and updates the window
@@ -299,5 +287,5 @@ printStrings dr gc fontst offs a sl@((s,c,l):xs) = do
(f, _) -> (f, bgColor conf)
case s of
(Text t) -> io $ printString d dr fontst gc fc bc offset valign t
- (Icon p) -> io $ maybe (return ()) (drawBitmap d dr fontst gc fc bc offset valign) (lookup p (iconS r))
+ (Icon p) -> io $ maybe (return ()) (drawBitmap d dr gc fc bc offset valign) (lookup p (iconS r))
printStrings dr gc fontst (offs + l) a xs