Merge branch 'master' of https://github.com/kindlycat/awesome
This commit is contained in:
commit
cb34144bf8
|
@ -59,7 +59,17 @@ local function do_redraw(self)
|
||||||
self._widget_geometries = {}
|
self._widget_geometries = {}
|
||||||
if self.widget and self.widget.visible then
|
if self.widget and self.widget.visible then
|
||||||
cr:set_source(self.foreground_color)
|
cr:set_source(self.foreground_color)
|
||||||
|
|
||||||
|
if self.widget.opacity ~= 1 then
|
||||||
|
cr:push_group()
|
||||||
|
end
|
||||||
self.widget:draw(self.widget_arg, cr, width, height)
|
self.widget:draw(self.widget_arg, cr, width, height)
|
||||||
|
if self.widget.opacity ~= 1 then
|
||||||
|
cr:pop_group_to_source()
|
||||||
|
cr.operator = cairo.Operator.OVER
|
||||||
|
cr:paint_with_alpha(self.widget.opacity)
|
||||||
|
end
|
||||||
|
|
||||||
self:widget_at(self.widget, 0, 0, width, height)
|
self:widget_at(self.widget, 0, 0, width, height)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ local pcall = pcall
|
||||||
local print = print
|
local print = print
|
||||||
local min = math.min
|
local min = math.min
|
||||||
local max = math.max
|
local max = math.max
|
||||||
|
local cairo = require("lgi").cairo
|
||||||
|
|
||||||
local base = {}
|
local base = {}
|
||||||
|
|
||||||
|
@ -66,8 +67,16 @@ function base.draw_widget(wibox, cr, widget, x, y, width, height)
|
||||||
cr:rectangle(0, 0, width, height)
|
cr:rectangle(0, 0, width, height)
|
||||||
cr:clip()
|
cr:clip()
|
||||||
|
|
||||||
|
if widget.opacity ~= 1 then
|
||||||
|
cr:push_group()
|
||||||
|
end
|
||||||
-- Let the widget draw itself
|
-- Let the widget draw itself
|
||||||
local success, msg = pcall(widget.draw, widget, wibox, cr, width, height)
|
local success, msg = pcall(widget.draw, widget, wibox, cr, width, height)
|
||||||
|
if widget.opacity ~= 1 then
|
||||||
|
cr:pop_group_to_source()
|
||||||
|
cr.operator = cairo.Operator.OVER
|
||||||
|
cr:paint_with_alpha(widget.opacity)
|
||||||
|
end
|
||||||
if not success then
|
if not success then
|
||||||
print("Error while drawing widget: " .. msg)
|
print("Error while drawing widget: " .. msg)
|
||||||
end
|
end
|
||||||
|
|
|
@ -116,6 +116,15 @@ function base.make_widget(proxy, widget_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Add opacity property and setter.
|
||||||
|
ret.opacity = 1
|
||||||
|
function ret:set_opacity(b)
|
||||||
|
if b ~= self.opacity then
|
||||||
|
self.opacity = b
|
||||||
|
self:emit_signal("widget::updated")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Add __tostring method to metatable.
|
-- Add __tostring method to metatable.
|
||||||
ret.widget_name = widget_name or object.modulename(3)
|
ret.widget_name = widget_name or object.modulename(3)
|
||||||
local mt = {}
|
local mt = {}
|
||||||
|
|
Loading…
Reference in New Issue