Make checkbox resize correctly on retina display

This commit is contained in:
Emmanuel LEpage Vallee 2014-01-20 23:50:35 -05:00
parent bd1558ca9c
commit 34e0836e5e
2 changed files with 4 additions and 3 deletions

View File

@ -39,6 +39,8 @@ end
local function new(widget,text, args) local function new(widget,text, args)
local args,data = args or {},{} local args,data = args or {},{}
data.text = text
local function hide_tooltip() local function hide_tooltip()
if data.wibox then if data.wibox then
data.wibox.visible = false data.wibox.visible = false
@ -57,7 +59,7 @@ local function new(widget,text, args)
if not data.wibox then if not data.wibox then
local vertical,textw = (args.direction == "left") or (args.direction == "right"),wibox.widget.textbox() local vertical,textw = (args.direction == "left") or (args.direction == "right"),wibox.widget.textbox()
textw.align = "center" textw.align = "center"
textw:set_markup("<b>".. text .."</b>") textw:set_markup("<b>".. data.text .."</b>")
local w,extents = wibox({position="free"}),textw._layout:get_pixel_extents() local w,extents = wibox({position="free"}),textw._layout:get_pixel_extents()
extents.width = extents.width + 60 extents.width = extents.width + 60
w.visible = false w.visible = false
@ -127,7 +129,6 @@ local function new(widget,text, args)
data.drawable:connect_signal("mouse::leave",hide_tooltip) data.drawable:connect_signal("mouse::leave",hide_tooltip)
end end
end end
data.text = text
end end
widget:connect_signal("mouse::enter" , function(widget,geometry) data:showToolTip( true , {parent=geometry}) end) widget:connect_signal("mouse::enter" , function(widget,geometry) data:showToolTip( true , {parent=geometry}) end)
widget:connect_signal("mouse::leave" , hide_tooltip) widget:connect_signal("mouse::leave" , hide_tooltip)

View File

@ -23,7 +23,7 @@ local function init()
cr2:paint() cr2:paint()
cr:set_operator(cairo.Operator.SOURCE) cr:set_operator(cairo.Operator.SOURCE)
cr2:set_operator(cairo.Operator.SOURCE) cr2:set_operator(cairo.Operator.SOURCE)
local sp = 2.5 local sp = size*0.15
local rs = size - (2*sp) local rs = size - (2*sp)
cr:set_source(color(beautiful.fg_normal)) cr:set_source(color(beautiful.fg_normal))
cr2:set_source(color(beautiful.fg_normal)) cr2:set_source(color(beautiful.fg_normal))