Merge pull request #770 from Elv13/background_clip
wibox.background: Add shape clip support
This commit is contained in:
commit
b2fabfeea1
|
@ -72,6 +72,12 @@ function background:before_draw_children(_, cr)
|
|||
if self.foreground then
|
||||
cr:set_source(self.foreground)
|
||||
end
|
||||
|
||||
-- Clip the shape
|
||||
if self._path and self._shape_clip then
|
||||
cr:append_path(self._path)
|
||||
cr:clip()
|
||||
end
|
||||
end
|
||||
|
||||
--- Layout this widget
|
||||
|
@ -155,6 +161,13 @@ function background:set_shape_border_color(fg)
|
|||
self:emit_signal("widget::redraw_needed")
|
||||
end
|
||||
|
||||
--- When a `shape` is set, make sure nothing is drawn outside of it.
|
||||
-- @tparam boolean value If the shape clip is enable
|
||||
function background:set_shape_clip(value)
|
||||
self._shape_clip = value
|
||||
self:emit_signal("widget::redraw_needed")
|
||||
end
|
||||
|
||||
--- Set the background image to use
|
||||
-- If `image` is a function, it will be called with `(context, cr, width, height)`
|
||||
-- as arguments. Any other arguments passed to this method will be appended.
|
||||
|
|
Loading…
Reference in New Issue