summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorUnoqwy <julien.qwy@gmail.com>2020-08-01 10:02:31 +0200
committerUnoqwy <julien.qwy@gmail.com>2020-08-07 19:49:34 +0200
commit4d7c7bc343040be6d3dba51e00336a00412a4a23 (patch)
tree852747c225cbabb3343bf578695f73795fb884f1 /src
parent599c06f942d549e8260de7c6735dc03a013ed92e (diff)
downloadxmobar-4d7c7bc343040be6d3dba51e00336a00412a4a23.tar.gz
xmobar-4d7c7bc343040be6d3dba51e00336a00412a4a23.tar.bz2
fix line width for boxes
Diffstat (limited to 'src')
-rw-r--r--src/Xmobar/X11/Draw.hs33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/Xmobar/X11/Draw.hs b/src/Xmobar/X11/Draw.hs
index b28ca30..0e07573 100644
--- a/src/Xmobar/X11/Draw.hs
+++ b/src/Xmobar/X11/Draw.hs
@@ -172,32 +172,37 @@ drawBoxes :: Display -> Drawable -> GC -> Position -> [((Position, Position), Bo
drawBoxes _ _ _ _ [] = return ()
drawBoxes d dr gc ht (b:bs) = do
let (xx, Box pos alg offset lineWidth fc) = b
+ lw = fromIntegral lineWidth :: Position
withColors d [fc] $ \[fc'] -> do
setForeground d gc fc'
setLineAttributes d gc lineWidth lineSolid capNotLast joinMiter
case pos of
BBVBoth -> do
- drawBoxBorder d dr gc BBTop alg offset ht xx
- drawBoxBorder d dr gc BBBottom alg offset ht xx
+ drawBoxBorder d dr gc BBTop alg offset ht xx lw
+ drawBoxBorder d dr gc BBBottom alg offset ht xx lw
BBHBoth -> do
- drawBoxBorder d dr gc BBLeft alg offset ht xx
- drawBoxBorder d dr gc BBRight alg offset ht xx
+ drawBoxBorder d dr gc BBLeft alg offset ht xx lw
+ drawBoxBorder d dr gc BBRight alg offset ht xx lw
BBFull -> do
- drawBoxBorder d dr gc BBTop alg offset ht xx
- drawBoxBorder d dr gc BBBottom alg offset ht xx
- drawBoxBorder d dr gc BBLeft alg offset ht xx
- drawBoxBorder d dr gc BBRight alg offset ht xx
- _ -> drawBoxBorder d dr gc pos alg offset ht xx
+ drawBoxBorder d dr gc BBTop alg offset ht xx lw
+ drawBoxBorder d dr gc BBBottom alg offset ht xx lw
+ drawBoxBorder d dr gc BBLeft alg offset ht xx lw
+ drawBoxBorder d dr gc BBRight alg offset ht xx lw
+ _ -> drawBoxBorder d dr gc pos alg offset ht xx lw
drawBoxes d dr gc ht bs
-drawBoxBorder :: Display -> Drawable -> GC -> BoxBorder -> Align -> Position -> Position -> (Position, Position) -> IO ()
-drawBoxBorder d dr gc pos alg offset ht (x1,x2) = do
+drawBoxBorder :: Display -> Drawable -> GC -> BoxBorder -> Align -> Position -> Position
+ -> (Position, Position) -> Position -> IO ()
+drawBoxBorder d dr gc pos alg offset ht (x1,x2) lw = do
let (p1,p2) = case alg of
L -> (0, -offset)
C -> (offset, -offset)
R -> (offset, 0 )
+ lc = lw `div` 2
case pos of
- BBTop -> drawLine d dr gc (x1 + p1) 0 (x2 + p2) 0
- BBBottom -> drawLine d dr gc (x1 + p1) (ht - 1) (x2 + p2) (ht - 1)
+ BBTop -> drawLine d dr gc (x1 + p1) lc (x2 + p2) lc
+ BBBottom -> do
+ let lc' = max lc 1
+ drawLine d dr gc (x1 + p1) (ht - lc') (x2 + p2) (ht - lc')
BBLeft -> drawLine d dr gc (x1 - 1) p1 (x1 - 1) (ht + p2)
- BBRight -> drawLine d dr gc (x2 - 1) p1 (x2 - 1) (ht + p2)
+ BBRight -> drawLine d dr gc (x2 + lc - 1) p1 (x2 + lc - 1) (ht + p2)