From b2d0d19c4b3d33ea336e78c62e7eddfa805281ac Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 10 Sep 2022 04:33:56 +0100 Subject: cairo: fonts, offsets, colors, actions --- src/Xmobar/X11/Draw.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Xmobar/X11/Draw.hs') diff --git a/src/Xmobar/X11/Draw.hs b/src/Xmobar/X11/Draw.hs index 6890fb1..ea7fa95 100644 --- a/src/Xmobar/X11/Draw.hs +++ b/src/Xmobar/X11/Draw.hs @@ -25,6 +25,7 @@ import Control.Monad.Reader import Graphics.X11.Xlib hiding (Segment) import Xmobar.Run.Parsers (Segment) +import Xmobar.Run.Actions (Action) import Xmobar.X11.Types #ifdef CAIRO @@ -34,8 +35,13 @@ import Xmobar.X11.XlibDraw #endif -- | Draws in and updates the window -drawInWin :: Rectangle -> [[Segment]] -> X () +#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 @@ -44,8 +50,9 @@ drawInWin (Rectangle _ _ wid ht) segments = do gc <- liftIO $ createGC d w liftIO $ setGraphicsExposures d gc False #ifdef CAIRO - drawInPixmap p wid ht segments + res <- drawInPixmap p wid ht segments #else + res <- liftIO $ updateActions conf bound segments drawInPixmap gc p wid ht segments #endif -- copy the pixmap with the new string to the window @@ -55,3 +62,4 @@ drawInWin (Rectangle _ _ wid ht) segments = do liftIO $ freePixmap d p -- resync (discard events, we don't read/process events from this display conn) liftIO $ sync d True + return res -- cgit v1.2.3