summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/X11/Draw.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-10 04:33:56 +0100
committerjao <jao@gnu.org>2022-09-10 04:33:56 +0100
commitb2d0d19c4b3d33ea336e78c62e7eddfa805281ac (patch)
tree2b42db25b82ffa3e23f702bb0bbb9d19673ff541 /src/Xmobar/X11/Draw.hs
parentf81a7cfef463907ba4b68cb1352a869960350685 (diff)
downloadxmobar-b2d0d19c4b3d33ea336e78c62e7eddfa805281ac.tar.gz
xmobar-b2d0d19c4b3d33ea336e78c62e7eddfa805281ac.tar.bz2
cairo: fonts, offsets, colors, actions
Diffstat (limited to 'src/Xmobar/X11/Draw.hs')
-rw-r--r--src/Xmobar/X11/Draw.hs12
1 files changed, 10 insertions, 2 deletions
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