From 1e6d66f8ec3c31c1fa5b812827fab8e804ab67ea Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Fri, 19 Feb 2016 03:29:40 -0500 Subject: [PATCH] Fix compatibility with LGI 0.9 Also add a 1px padding for checkboxes --- widgets/checkbox.lua | 5 ++++- widgets/piechart.lua | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/widgets/checkbox.lua b/widgets/checkbox.lua index 3216117..665dd7d 100644 --- a/widgets/checkbox.lua +++ b/widgets/checkbox.lua @@ -47,11 +47,14 @@ local function init() end local function holo() - local size = beautiful.menu_height or 16 + local size = beautiful.menu_height - 2 or 16 notcheckedI = cairo.ImageSurface(cairo.Format.ARGB32, size,size) checkedI = cairo.ImageSurface(cairo.Format.ARGB32, size,size) local cr2 = cairo.Context(notcheckedI) local cr = cairo.Context(checkedI) + cr:translate(1,1) + cr2:translate(1,1) + size = size - 2 cr:set_operator(cairo.Operator.CLEAR) cr2:set_operator(cairo.Operator.CLEAR) cr:paint() diff --git a/widgets/piechart.lua b/widgets/piechart.lua index aeadfee..0503a3b 100644 --- a/widgets/piechart.lua +++ b/widgets/piechart.lua @@ -13,7 +13,8 @@ local function draw_label(cr,angle,radius,center_x,center_y,text) cr:line_to(center_x+(1.5*radius)*math.cos(angle),center_y+(1.5*radius)*math.sin(angle)) local x,y = cr:get_current_point() cr:line_to(x+(x>center_x and radius/2 or -radius/2),y) - cr:move_to(x+(x>center_x and radius/2 + 5 or (-radius/2 - cr:text_extents(text).width - 5)),y+(cr.font_extents.height/4)) + local extents = cr:font_extents() + cr:move_to(x+(x>center_x and radius/2 + 5 or (-radius/2 - cr:text_extents(text).width - 5)),y+(extents.height/4)) cr:show_text(text) cr:stroke() cr:arc(center_x+(radius/2)*math.cos(angle),center_y+(radius/2)*math.sin(angle),2,0,2*math.pi)