This commit is contained in:
kepler155c@gmail.com 2017-08-02 09:52:41 -04:00
parent 982894a5f1
commit 252fb16853
4 changed files with 13 additions and 17 deletions

View File

@ -1,5 +1,3 @@
local Util = require('util')
local Event = {
uid = 1, -- unique id for handlers
routines = { }, -- coroutines
@ -26,10 +24,7 @@ end
function Routine:resume(event, ...)
if not self.co then
debug(event)
debug(self)
debug(getfenv(1))
error('Cannot resume a dead routine')
error('Cannot resume a dead routine\n' .. Util.tostring(self))
end
if not self.filter or self.filter == event or event == "terminate" then
@ -44,10 +39,7 @@ function Routine:resume(event, ...)
end
if not s and event ~= 'terminate' then
debug({s, m})
debug(self)
debug(getfenv(1))
error('\n' .. (m or 'Error processing event'))
error('\n' .. (m or 'Error processing event') .. '\n' .. Util.tostring(self))
end
return s, m
@ -101,6 +93,8 @@ local function addTimer(interval, recurring, fn)
end
end
end)
return handler
end
function Event.onInterval(interval, fn)
@ -176,9 +170,17 @@ local function processHandlers(event)
end
end
local function tokeys(t)
local keys = { }
for k in pairs(t) do
keys[#keys+1] = k
end
return keys
end
local function processRoutines(...)
local keys = Util.keys(Event.routines)
local keys = tokeys(Event.routines)
for _,key in ipairs(keys) do
local r = Event.routines[key]
if r then

View File

@ -349,9 +349,6 @@ function Manager:click(button, x, y)
button = 3
self.doubleClickTimer = nil
else
if self.doubleClickTimer then
debug(c - self.doubleClickTimer)
end
self.doubleClickTimer = c
self.doubleClickX = x
self.doubleClickY = y

View File

@ -321,7 +321,6 @@ function page:eventHandler(event)
elseif event.type == 'delete' then
local focused = page:getFocused()
debug(focused.app)
if focused.app then
focused.app.disabled = true
local filename = focused.app.filename or fs.combine(REGISTRY_DIR, focused.app.key)

View File

@ -158,8 +158,6 @@ end
function os.registerApp(app, key)
app.key = SHA1.sha1(key)
debug(fs.combine(REGISTRY_DIR, app.key))
debug(app)
Util.writeTable(fs.combine(REGISTRY_DIR, app.key), app)
os.queueEvent('os_register_app')
end