drawable: Support for true transparency (FS#1210)

This makes the drawable paint the wallpaper in the background
(i.e. pseudo transparency) only if there is not a composite manager running,
as reported by the value of awesome.composite_manager_running.

In other words: drawables can now make use of true transparency.

Signed-off-by: Björn Åström <bjoast@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Björn Åström 2014-02-23 00:02:57 +01:00 committed by Uli Schlachter
parent 360e1a5f92
commit c6365fa2f6
1 changed files with 11 additions and 6 deletions

View File

@ -28,15 +28,20 @@ local function do_redraw(self)
-- Draw the background
cr:save()
-- This is pseudo-transparency: We draw the wallpaper in the background
local wallpaper = surface(capi.root.wallpaper())
if wallpaper then
if not capi.awesome.composite_manager_running then
-- This is pseudo-transparency: We draw the wallpaper in the background
local wallpaper = surface(capi.root.wallpaper())
if wallpaper then
cr.operator = cairo.Operator.SOURCE
cr:set_source_surface(wallpaper, -x, -y)
cr:paint()
end
cr.operator = cairo.Operator.OVER
else
cr.operator = cairo.Operator.SOURCE
cr:set_source_surface(wallpaper, -x, -y)
cr:paint()
end
cr.operator = cairo.Operator.OVER
cr:set_source(self.background_color)
cr:paint()
cr:restore()