awful.widget.{graph,progressbar}: Un-local functions
This code accesses these functions via _M['set_height'], but if these are local functions they aren't available this way. Un-local-ing helps here. This was noticed by anrxc when he set a widget's height to 0.9. These functions should have caught this invalid height and ignore it, but because they weren't actually used this error checking was bypassed. Signed-off-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
cbaefeed9d
commit
1c57970dd9
|
@ -171,7 +171,7 @@ end
|
|||
--- Set the graph height.
|
||||
-- @param graph The graph.
|
||||
-- @param height The height to set.
|
||||
local function set_height(graph, height)
|
||||
function set_height(graph, height)
|
||||
if height >= 5 then
|
||||
data[graph].height = height
|
||||
update(graph)
|
||||
|
@ -182,7 +182,7 @@ end
|
|||
--- Set the graph width.
|
||||
-- @param graph The graph.
|
||||
-- @param width The width to set.
|
||||
local function set_width(graph, width)
|
||||
function set_width(graph, width)
|
||||
if width >= 5 then
|
||||
data[graph].width = width
|
||||
update(graph)
|
||||
|
|
|
@ -113,7 +113,7 @@ end
|
|||
-- Set the progressbar value.
|
||||
-- @param pbar The progress bar.
|
||||
-- @param value The progress bar value between 0 and 1.
|
||||
local function set_value(pbar, value)
|
||||
function set_value(pbar, value)
|
||||
local value = value or 0
|
||||
data[pbar].value = math.min(1, math.max(0, value))
|
||||
return pbar
|
||||
|
@ -122,7 +122,7 @@ end
|
|||
--- Set the progressbar height.
|
||||
-- @param progressbar The progressbar.
|
||||
-- @param height The height to set.
|
||||
local function set_height(progressbar, height)
|
||||
function set_height(progressbar, height)
|
||||
if height >= 5 then
|
||||
data[progressbar].height = height
|
||||
update(progressbar)
|
||||
|
@ -133,7 +133,7 @@ end
|
|||
--- Set the progressbar width.
|
||||
-- @param progressbar The progressbar.
|
||||
-- @param width The width to set.
|
||||
local function set_width(progressbar, width)
|
||||
function set_width(progressbar, width)
|
||||
if width >= 5 then
|
||||
data[progressbar].width = width
|
||||
update(progressbar)
|
||||
|
|
Loading…
Reference in New Issue