diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-09 02:12:03 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-09 02:12:03 +0200 |
commit | 899a2c3a6950dc5acfca2c532cac0086fb098b0b (patch) | |
tree | dce3eb4f99d59766339353d08b1a1efa37634415 /XMobar.hs | |
parent | 7fe909257403714f6f6b24afbdce30e29c5605bf (diff) | |
download | xmobar-899a2c3a6950dc5acfca2c532cac0086fb098b0b.tar.gz xmobar-899a2c3a6950dc5acfca2c532cac0086fb098b0b.tar.bz2 |
comments only
darcs-hash:20070709001203-d6583-885a1e12b59937b9e4c8543d13edb7281f91ea81.gz
Diffstat (limited to 'XMobar.hs')
-rw-r--r-- | XMobar.hs | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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 |