summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Draw
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-11-13 18:15:08 +0000
committerjao <jao@gnu.org>2022-11-13 18:15:08 +0000
commite98f9a76ec75c21e0f8abb3e0145cceb5141582f (patch)
tree55db6847e1d49d9705a2726657083f44fc1e5a7f /src/Xmobar/Draw
parent7fcebc1b39d88cea08f78affcca62a80189c0d5a (diff)
downloadxmobar-e98f9a76ec75c21e0f8abb3e0145cceb5141582f.tar.gz
xmobar-e98f9a76ec75c21e0f8abb3e0145cceb5141582f.tar.bz2
center segment drawn in the center of the bar
should make things better for #650 and #655
Diffstat (limited to 'src/Xmobar/Draw')
-rw-r--r--src/Xmobar/Draw/Cairo.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Xmobar/Draw/Cairo.hs b/src/Xmobar/Draw/Cairo.hs
index cd85580..af48133 100644
--- a/src/Xmobar/Draw/Cairo.hs
+++ b/src/Xmobar/Draw/Cairo.hs
@@ -177,13 +177,12 @@ drawSegments dctx surf = do
#ifndef XRENDER
drawCairoBackground dctx surf
#endif
- (lend, as, bx) <- foldM (drawSegment dctx surf dw) (0, [], []) llyts
- let rw = sWidth rlyts
- rstart = max (lend + 1) (dw - rw - 1)
- cmax = rstart - 1
- cw = sWidth clyts
- cstart = lend + 1 + max 0 (dw - rw - lend - cw) / 2.0
- (_, as', bx') <- foldM (drawSegment dctx surf cmax) (cstart, as, bx) clyts
+ (_, as, bx) <- foldM (drawSegment dctx surf dw) (0, [], []) llyts
+ let [rw, cw] = map sWidth [rlyts, clyts]
+ cstart = (dw - cw) / 2.0
+ (cend, as', bx') <- foldM (drawSegment dctx surf dw) (cstart, as, bx) clyts
+ let rstart' = dw - rw - 1
+ rstart = if cw > 0 then max rstart' (cend + 1) else rstart'
(_, as'', bx'') <- foldM (drawSegment dctx surf dw) (rstart, as', bx') rlyts
drawBoxes dctx surf (reverse bx'')
when (C.borderWidth conf > 0) (drawBorder conf dw dh surf)