infoshapes: Fix borders

This commit is contained in:
Emmanuel Lepage Vallee 2016-03-06 03:31:07 -05:00
parent b167117958
commit ac402846a3
1 changed files with 19 additions and 9 deletions

View File

@ -56,8 +56,8 @@ local function get_group_extents(self, group, height)
end end
-- Add the shape to the context -- Add the shape to the context
local function draw_shape2(self, cr, width, height, ...) local function draw_shape2(self, infoshape, cr, width, height, ...)
local shape = self.shape or default_shape local shape = infoshape.shape or self._default_shape or default_shape
if shape then if shape then
shape(cr, width, height, ...) shape(cr, width, height, ...)
@ -73,15 +73,15 @@ local function draw_shape(self, cr, width, height, infoshape)
local w,h = extents.width + 2*height, height - 2*padding local w,h = extents.width + 2*height, height - 2*padding
-- Draw the shape -- Draw the shape
draw_shape2(infoshape, cr, w, h) --TODO support padding, shape args draw_shape2(self, infoshape, cr, w, h) --TODO support padding, shape args
-- The border -- The border
local border_width = infoshape.border_width or self._shape_border_width or beautiful.infoshape_shape_border_width local border_width = infoshape.border_width or self._shape_border_width or beautiful.infoshape_shape_border_width
local border_color = infoshape.border_color or self._shape_border_color or beautiful.infoshape_shape_border_color local border_color = infoshape.border_color or self._shape_border_color or beautiful.infoshape_shape_border_color
if self._shape_border and border_color then if border_width and border_color then
cr:set_source(color()) cr:set_source(color(border_color))
cr:set_line_width(border_width) cr:set_line_width(border_width)
cr:srtoke_preserve() cr:stroke_preserve()
end end
-- The background -- The background
@ -262,9 +262,19 @@ function infoshape:set_infoshapes(args)
self:emit_signal("widget::redraw_needed") self:emit_signal("widget::redraw_needed")
end end
--TODO use beautiful --TODO fallback beautiful
function infoshape:set_default_shape(shape) function infoshape:set_shape(shape)
default_shape = shape self._default_shape = shape
end
--TODO fallback beautiful
function infoshape:set_shape_border_color(col)
self._shape_border_color = col
end
--TODO fallback beautiful
function infoshape:set_shape_border_width(col)
self._shape_border_width = col
end end
function infoshape:set_default_font_description(desc) function infoshape:set_default_font_description(desc)