diff options
author | Jose A Ortega Ruiz <jao@gnu.org> | 2010-06-24 20:27:24 +0200 |
---|---|---|
committer | Jose A Ortega Ruiz <jao@gnu.org> | 2010-06-24 20:27:24 +0200 |
commit | 961b6664453d73ea4d25ca91ef0870935fd340e1 (patch) | |
tree | abfd149d025ead1546f526e1ed863a894ee364c4 /Xmobar.hs | |
parent | 1af9aa0016ec0f233cfeaae1869def4d4c513194 (diff) | |
download | xmobar-961b6664453d73ea4d25ca91ef0870935fd340e1.tar.gz xmobar-961b6664453d73ea4d25ca91ef0870935fd340e1.tar.bz2 |
Configurable border margins
Ignore-this: 18fcf93df84c7e8b6a263f3301a1666e
darcs-hash:20100624182724-748be-0b7c8d41243587bab906b4ea9739eca78aa1a21c.gz
Diffstat (limited to 'Xmobar.hs')
-rw-r--r-- | Xmobar.hs | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -252,7 +252,7 @@ drawInWin (Rectangle _ _ wid ht) ~[left,center,right] = do io $ setForeground d gc bgcolor io $ fillRectangle d p gc 0 0 wid ht -- draw 1 pixel border if requested - io $ drawBorder (border c) d p gc bdcolor (wid - 1) (ht - 1) + io $ drawBorder (border c) d p gc bdcolor wid ht -- write to the pixmap the new string printStrings p gc fs 1 L =<< strLn left printStrings p gc fs 1 R =<< strLn right @@ -267,12 +267,18 @@ drawInWin (Rectangle _ _ wid ht) ~[left,center,right] = do drawBorder :: Border -> Display -> Drawable -> GC -> Pixel -> Dimension -> Dimension -> IO () -drawBorder b d p gc c w h = case b of +drawBorder b d p gc c wi ht = case b of NoBorder -> return () - TopB -> sf >> drawLine d p gc 0 0 (fi w) 0 - BottomB -> sf >> drawLine d p gc 0 (fi h) (fi w) (fi h) - FullB -> sf >> drawRectangle d p gc 0 0 w h + TopB -> drawBorder (TopBM 0) d p gc c w h + BottomB -> drawBorder (BottomBM 0) d p gc c w h + FullB -> drawBorder (FullBM 0) d p gc c w h + TopBM m -> sf >> drawLine d p gc 0 (fi m) (fi w) 0 + BottomBM m -> let rw = (fi h) - (fi m) in + sf >> drawLine d p gc 0 rw (fi w) rw + FullBM m -> let rm = fi m; mp = fi m in + sf >> drawRectangle d p gc mp mp (w - rm) (h - rm) where sf = setForeground d gc c + (w, h) = (wi - 1, ht - 1) -- | An easy way to print the stuff we need to print printStrings :: Drawable -> GC -> XFont -> Position |