summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2014-12-30 01:12:09 +0100
committerjao <jao@gnu.org>2014-12-30 01:12:09 +0100
commit584ff68d9ede856b36b75467b0ca2eb6d9e03ab4 (patch)
tree8f927996f3504c26d5cc0200be47c93594d56137
parentc52603a75f0d7c8ff4201d511b938ae8f6516e38 (diff)
downloadxmobar-584ff68d9ede856b36b75467b0ca2eb6d9e03ab4.tar.gz
xmobar-584ff68d9ede856b36b75467b0ca2eb6d9e03ab4.tar.bz2
Fix: use the right background area in transparency
-rw-r--r--src/Xmobar.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index 3016f75..069c7a6 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -277,7 +277,7 @@ updateActions conf (Rectangle _ _ wid _) ~[left,center,right] = do
-- | Draws in and updates the window
drawInWin :: Rectangle -> [[(Widget, String, Maybe [Action])]] -> X ()
-drawInWin (Rectangle _ _ wid ht) ~[left,center,right] = do
+drawInWin (Rectangle x y wid ht) ~[left,center,right] = do
r <- ask
let (c,d ) = (config &&& display) r
(w,fs) = (window &&& fontS ) r
@@ -285,6 +285,9 @@ drawInWin (Rectangle _ _ wid ht) ~[left,center,right] = do
iconW i = maybe 0 Bitmap.width (lookup i $ iconS r)
getWidth (Text s,cl,_) = textWidth d fs s >>= \tw -> return (Text s,cl,fi tw)
getWidth (Icon s,cl,_) = return (Icon s,cl,fi $ iconW s)
+ render opt bg pic m =
+ xRenderComposite d opt bg m pic (fromIntegral x) (fromIntegral y)
+ 0 0 0 0 (fromIntegral wid) (fromIntegral ht)
withColors d [borderColor c] $ \[bdcolor] -> do
gc <- io $ createGC d w
@@ -299,8 +302,9 @@ drawInWin (Rectangle _ _ wid ht) ~[left,center,right] = do
-- just bgcolor' (putting in the mask alpha directly has strange
-- results. I wish someone had better docs on how
-- XRenderComposite worked...)
- withRenderFill d (XRenderColor 0 0 0 (257 * alpha c)) $ \m ->
- xRenderComposite d pictOpSrc bgfill m pic 0 0 0 0 0 0 (fromIntegral wid) (fromIntegral ht)
+ withRenderFill d
+ (XRenderColor 0 0 0 (257 * alpha c))
+ (render pictOpSrc bgfill pic)
-- Handle transparency
internAtom d "_XROOTPMAP_ID" False >>= \xid ->
let xroot = defaultRootWindow d in
@@ -315,8 +319,9 @@ drawInWin (Rectangle _ _ wid ht) ~[left,center,right] = do
rootbg <- peek (castPtr prop) :: IO Pixmap
xFree prop
withRenderPicture d rootbg $ \bgpic ->
- withRenderFill d (XRenderColor 0 0 0 (0xFFFF - 257 * alpha c)) $ \m ->
- xRenderComposite d pictOpAdd bgpic m pic 0 0 0 0 0 0 (fromIntegral wid) (fromIntegral ht)
+ withRenderFill d
+ (XRenderColor 0 0 0 (0xFFFF - 257 * alpha c))
+ (render pictOpAdd bgpic pic)
-- write to the pixmap the new string
printStrings p gc fs 1 L =<< strLn left
printStrings p gc fs 1 R =<< strLn right