From 899a2c3a6950dc5acfca2c532cac0086fb098b0b Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Mon, 9 Jul 2007 02:12:03 +0200 Subject: comments only darcs-hash:20070709001203-d6583-885a1e12b59937b9e4c8543d13edb7281f91ea81.gz --- XMobar.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'XMobar.hs') diff --git a/XMobar.hs b/XMobar.hs index 0c9b65c..6e9b142 100644 --- a/XMobar.hs +++ b/XMobar.hs @@ -111,19 +111,20 @@ drawInWin str = --let's get the fonts fontst <- io $ loadQueryFont dpy (font config) io $ setFont dpy gc (fontFromFontStruct fontst) - -- create a pixmap to write to and fill it with a rectangle: + -- create a pixmap to write to and fill it with a rectangle p <- io $ createPixmap dpy win (fi (width config)) (fi (height config)) - (defaultDepthOfScreen (defaultScreenOfDisplay dpy)) + (defaultDepthOfScreen (defaultScreenOfDisplay dpy)) + -- the fgcolor of the rectangle will be the bgcolor of the window io $ setForeground dpy gc bgcolor io $ fillRectangle dpy p gc 0 0 (fi $ width config) (fi $ height config) - -- write to the pixmap the new string: + -- 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 - -- copy the pixmap with the new string to the window. + -- 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 -- free up everything (we do not want to leak memory!) io $ freeFont dpy fontst @@ -138,8 +139,8 @@ printStrings :: Drawable -> FontStruct -> Position -> [(String, String, Position)] - -> Xbar Pixmap --() -printStrings p _ _ _ [] = return p --() + -> Xbar Pixmap +printStrings p _ _ _ [] = return p printStrings p gc fontst offs sl@((s,c,l):xs) = do config <- ask st <- get -- cgit v1.2.3