From 90e6cd0407313858daef2eb6ecfd5cd04a2a72a8 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 20 Mar 2015 02:27:57 +0100 Subject: Fixes for vertical alignment and border drawing --- src/Xmobar.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Xmobar.hs') diff --git a/src/Xmobar.hs b/src/Xmobar.hs index 12dc1de..680dd89 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -306,7 +306,7 @@ drawInWin wr@(Rectangle _ _ wid ht) ~[left,center,right] = do printStrings p gc fs 1 L =<< strLn left printStrings p gc fs 1 R =<< strLn right printStrings p gc fs 1 C =<< strLn center - -- draw 1 pixel border if requested + -- draw border if requested io $ drawBorder (border c) (borderWidth c) d p gc bdcolor wid ht -- copy the pixmap with the new string to the window io $ copyArea d p w gc 0 0 wid ht 0 0 @@ -322,9 +322,8 @@ verticalOffset ht (Text t) fontst conf | textOffset conf > -1 = return $ fi (textOffset conf) | otherwise = do (as,ds) <- io $ textExtents fontst t - let bwidth = borderOffset (border conf) (borderWidth conf) - verticalMargin = fi ht - fi (as + ds) - 2 * fi (abs bwidth) - return $ fi ht - fi ds - (verticalMargin `div` 2) + bwidth - 1 + let margin = (fi ht - fi (as + ds)) `div` 2 + return $ fi ht - margin - fi ds - 1 verticalOffset ht (Icon _) _ conf | iconOffset conf > -1 = return $ fi (iconOffset conf) | otherwise = return $ fi (ht `div` 2) - 1 -- cgit v1.2.3