summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Draw/Cairo.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2024-03-30 18:26:01 +0000
committerjao <jao@gnu.org>2024-03-30 18:26:01 +0000
commit30d226ba5eca8847775d03403367dee1f1e3dcfc (patch)
treeb62d0f7f176f9f2b58d66866c3c6afb581334bd6 /src/Xmobar/Draw/Cairo.hs
parent3f4ae1034fe7575df05c59dd0c357fd448198594 (diff)
downloadxmobar-30d226ba5eca8847775d03403367dee1f1e3dcfc.tar.gz
xmobar-30d226ba5eca8847775d03403367dee1f1e3dcfc.tar.bz2
fix for unmet pattern matches warnings (clean build)
Diffstat (limited to 'src/Xmobar/Draw/Cairo.hs')
-rw-r--r--src/Xmobar/Draw/Cairo.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Xmobar/Draw/Cairo.hs b/src/Xmobar/Draw/Cairo.hs
index 8dcda5d..2338b10 100644
--- a/src/Xmobar/Draw/Cairo.hs
+++ b/src/Xmobar/Draw/Cairo.hs
@@ -2,7 +2,7 @@
------------------------------------------------------------------------------
-- |
-- Module: Xmobar.X11.Cairo
--- Copyright: (c) 2022, 2023 Jose Antonio Ortega Ruiz
+-- Copyright: (c) 2022, 2023, 2024 Jose Antonio Ortega Ruiz
-- License: BSD3-style (see LICENSE)
--
-- Maintainer: jao@gnu.org
@@ -169,21 +169,22 @@ drawCairoBackground dctx surf = do
drawSegments :: T.DrawContext -> Surface -> IO T.Actions
drawSegments dctx surf = do
- let [left, center, right] = take 3 $ T.dcSegments dctx ++ repeat []
+ let segs = take 3 $ T.dcSegments dctx ++ repeat []
dh = T.dcHeight dctx
dw = T.dcWidth dctx
conf = T.dcConfig dctx
sWidth = foldl (\a (_,_,w) -> a + w) 0
ctx <- Pango.cairoCreateContext Nothing
Pango.cairoContextSetResolution ctx $ C.dpi conf
- llyts <- mapM (withRenderinfo ctx dctx) left
- rlyts <- mapM (withRenderinfo ctx dctx) right
- clyts <- mapM (withRenderinfo ctx dctx) center
+ llyts <- mapM (withRenderinfo ctx dctx) (head segs)
+ rlyts <- mapM (withRenderinfo ctx dctx) (segs !! 2)
+ clyts <- mapM (withRenderinfo ctx dctx) (segs !! 1)
#ifndef XRENDER
drawCairoBackground dctx surf
#endif
(lend, as, bx) <- foldM (drawSegment dctx surf dw) (0, [], []) llyts
- let [rw, cw] = map sWidth [rlyts, clyts]
+ let rw = sWidth rlyts
+ cw = sWidth clyts
rstart = max lend (dw - rw)
cstart = if lend > 1 || rw == 0 then max lend ((dw - cw) / 2.0) else lend
(_, as', bx') <- if cw > 0