summaryrefslogtreecommitdiffhomepage
path: root/Xmobar.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-20 13:39:17 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-20 13:39:17 +0200
commit5483ea4be08b7609e71eb5f1168f2746dcbe2d8f (patch)
treeae70f15fb7f46b0ff904d7ea4783c6f682004146 /Xmobar.hs
parent737ecd4101cd40e64f576e71a99286ab8127179f (diff)
downloadxmobar-5483ea4be08b7609e71eb5f1168f2746dcbe2d8f.tar.gz
xmobar-5483ea4be08b7609e71eb5f1168f2746dcbe2d8f.tar.bz2
X code cleanup
darcs-hash:20070720113917-d6583-cabe8d1a6d1d52da01b421099e4d74c1a0fb539e.gz
Diffstat (limited to 'Xmobar.hs')
-rw-r--r--Xmobar.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/Xmobar.hs b/Xmobar.hs
index 13109b0..853017d 100644
--- a/Xmobar.hs
+++ b/Xmobar.hs
@@ -154,13 +154,13 @@ drawInWin str =
(fi $ height config)
-- write to the pixmap the new string
let strWithLenth = map (\(s,c) -> (s,c,textWidth fontst s)) str
- p' <- printStrings p gc fontst 1 strWithLenth
+ printStrings p gc fontst 1 strWithLenth
-- copy the pixmap with the new string to the window
- io $ copyArea dpy p' win gc 0 0 (fi (width config)) (fi (height config)) 0 0
+ io $ copyArea dpy p win gc 0 0 (fi (width config)) (fi (height config)) 0 0
-- free up everything (we do not want to leak memory!)
io $ freeFont dpy fontst
io $ freeGC dpy gc
- io $ freePixmap dpy p'
+ io $ freePixmap dpy p
-- resync
io $ sync dpy True
@@ -170,9 +170,9 @@ printStrings :: Drawable
-> FontStruct
-> Position
-> [(String, String, Position)]
- -> Xbar Pixmap
-printStrings p _ _ _ [] = return p
-printStrings p gc fontst offs sl@((s,c,l):xs) =
+ -> Xbar ()
+printStrings _ _ _ _ [] = return ()
+printStrings d gc fontst offs sl@((s,c,l):xs) =
do config <- ask
st <- get
let (_,asc,_,_) = textExtents fontst s
@@ -188,9 +188,8 @@ printStrings p gc fontst offs sl@((s,c,l):xs) =
bgcolor <- io $ initColor (display st) (bgColor config)
io $ setForeground (display st) gc fgcolor
io $ setBackground (display st) gc bgcolor
- io $ drawImageString (display st) p gc offset valign s
- p' <- printStrings p gc fontst (offs + l) xs
- return p'
+ io $ drawImageString (display st) d gc offset valign s
+ printStrings d gc fontst (offs + l) xs
-- $commands