mirror of
https://github.com/kepler155c/opus
synced 2024-12-25 16:10:26 +00:00
cleanup
This commit is contained in:
parent
982894a5f1
commit
252fb16853
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user