Merge pull request #3513 from necauqua/fix-timer
Signalled error: bad argument #3 to 'timeout_add' (number has no integer representation)
This commit is contained in:
commit
1413f0c4b9
|
@ -61,6 +61,7 @@ local glib = require("lgi").GLib
|
||||||
local object = require("gears.object")
|
local object = require("gears.object")
|
||||||
local protected_call = require("gears.protected_call")
|
local protected_call = require("gears.protected_call")
|
||||||
local gdebug = require("gears.debug")
|
local gdebug = require("gears.debug")
|
||||||
|
local gmath = require("gears.math")
|
||||||
|
|
||||||
--- Timer objects. This type of object is useful when triggering events repeatedly.
|
--- Timer objects. This type of object is useful when triggering events repeatedly.
|
||||||
--
|
--
|
||||||
|
@ -96,7 +97,8 @@ function timer:start()
|
||||||
gdebug.print_error(traceback("timer already started"))
|
gdebug.print_error(traceback("timer already started"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.data.source_id = glib.timeout_add(glib.PRIORITY_DEFAULT, self.data.timeout * 1000, function()
|
local timeout_ms = gmath.round(self.data.timeout * 1000)
|
||||||
|
self.data.source_id = glib.timeout_add(glib.PRIORITY_DEFAULT, timeout_ms, function()
|
||||||
protected_call(self.emit_signal, self, "timeout")
|
protected_call(self.emit_signal, self, "timeout")
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -172,6 +172,10 @@ function hierarchy_update(self, context, widget, width, height, region, matrix_t
|
||||||
-- Are there any children which were removed? Their area needs a redraw.
|
-- Are there any children which were removed? Their area needs a redraw.
|
||||||
for _, child in ipairs(old_children) do
|
for _, child in ipairs(old_children) do
|
||||||
local x, y, w, h = matrix.transform_rectangle(child._matrix_to_device, child:get_draw_extents())
|
local x, y, w, h = matrix.transform_rectangle(child._matrix_to_device, child:get_draw_extents())
|
||||||
|
x = math.floor(x)
|
||||||
|
y = math.floor(y)
|
||||||
|
w = math.ceil(w)
|
||||||
|
h = math.ceil(h)
|
||||||
region:union_rectangle(cairo.RectangleInt{
|
region:union_rectangle(cairo.RectangleInt{
|
||||||
x = x, y = y, width = w, height = h
|
x = x, y = y, width = w, height = h
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue