summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/X11/Draw.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-11 09:25:40 +0100
committerjao <jao@gnu.org>2022-09-11 09:25:40 +0100
commitd7299a0b80f0b15f820a1b7533549e306755441c (patch)
treed4c671e703ea87897f7da5ac921b31eb632a159a /src/Xmobar/X11/Draw.hs
parentd579c840a5038d45c4fecde84dc99d6b14677e20 (diff)
downloadxmobar-d7299a0b80f0b15f820a1b7533549e306755441c.tar.gz
xmobar-d7299a0b80f0b15f820a1b7533549e306755441c.tar.bz2
cairo: bitmaps
Diffstat (limited to 'src/Xmobar/X11/Draw.hs')
-rw-r--r--src/Xmobar/X11/Draw.hs27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/Xmobar/X11/Draw.hs b/src/Xmobar/X11/Draw.hs
index 2d61b67..7642afc 100644
--- a/src/Xmobar/X11/Draw.hs
+++ b/src/Xmobar/X11/Draw.hs
@@ -37,33 +37,28 @@ import Xmobar.X11.XlibDraw
#endif
-- | Draws in and updates the window
-#ifdef CAIRO
-drawInWin :: Rectangle -> [[Segment]] -> X [([Action], Position, Position)]
-drawInWin (Rectangle _ _ wid ht) segments = do
-#else
-drawInWin :: XConf -> Rectangle -> [[Segment]] -> X [([Action], Position, Position)]
-drawInWin conf bound@(Rectangle _ _ wid ht) segments = do
-#endif
- r <- ask
- let d = display r
- w = window r
-
+drawInWin :: [[Segment]] -> X [([Action], Position, Position)]
+drawInWin segments = do
+ xconf <- ask
+ let d = display xconf
+ w = window xconf
+ (Rectangle _ _ wid ht) = rect xconf
depth = defaultDepthOfScreen (defaultScreenOfDisplay d)
p <- liftIO $ createPixmap d w wid ht depth
gc <- liftIO $ createGC d w
liftIO $ setGraphicsExposures d gc False
#if defined(XFT) || defined(CAIRO)
- let xconf = config r
- alph = alpha xconf
+ let cconf = config xconf
+ alph = alpha cconf
when (alph < 255)
- (liftIO $ drawBackground d p (bgColor xconf) alph (Rectangle 0 0 wid ht))
+ (liftIO $ drawBackground d p (bgColor cconf) alph (Rectangle 0 0 wid ht))
#endif
#ifdef CAIRO
- res <- drawInPixmap p wid ht segments
+ res <- drawInPixmap gc p segments
#else
- res <- liftIO $ updateActions conf bound segments
+ res <- updateActions (rect xconf) segments
drawInPixmap gc p wid ht segments
#endif
-- copy the pixmap with the new string to the window