mirror of
https://github.com/kepler155c/opus
synced 2025-01-12 16:51:05 +00:00
cleanup
This commit is contained in:
parent
982894a5f1
commit
252fb16853
@ -1,5 +1,3 @@
|
|||||||
local Util = require('util')
|
|
||||||
|
|
||||||
local Event = {
|
local Event = {
|
||||||
uid = 1, -- unique id for handlers
|
uid = 1, -- unique id for handlers
|
||||||
routines = { }, -- coroutines
|
routines = { }, -- coroutines
|
||||||
@ -26,10 +24,7 @@ end
|
|||||||
function Routine:resume(event, ...)
|
function Routine:resume(event, ...)
|
||||||
|
|
||||||
if not self.co then
|
if not self.co then
|
||||||
debug(event)
|
error('Cannot resume a dead routine\n' .. Util.tostring(self))
|
||||||
debug(self)
|
|
||||||
debug(getfenv(1))
|
|
||||||
error('Cannot resume a dead routine')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if not self.filter or self.filter == event or event == "terminate" then
|
if not self.filter or self.filter == event or event == "terminate" then
|
||||||
@ -44,10 +39,7 @@ function Routine:resume(event, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not s and event ~= 'terminate' then
|
if not s and event ~= 'terminate' then
|
||||||
debug({s, m})
|
error('\n' .. (m or 'Error processing event') .. '\n' .. Util.tostring(self))
|
||||||
debug(self)
|
|
||||||
debug(getfenv(1))
|
|
||||||
error('\n' .. (m or 'Error processing event'))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return s, m
|
return s, m
|
||||||
@ -101,6 +93,8 @@ local function addTimer(interval, recurring, fn)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
return handler
|
||||||
end
|
end
|
||||||
|
|
||||||
function Event.onInterval(interval, fn)
|
function Event.onInterval(interval, fn)
|
||||||
@ -176,9 +170,17 @@ local function processHandlers(event)
|
|||||||
end
|
end
|
||||||
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 function processRoutines(...)
|
||||||
|
|
||||||
local keys = Util.keys(Event.routines)
|
local keys = tokeys(Event.routines)
|
||||||
for _,key in ipairs(keys) do
|
for _,key in ipairs(keys) do
|
||||||
local r = Event.routines[key]
|
local r = Event.routines[key]
|
||||||
if r then
|
if r then
|
||||||
|
@ -349,9 +349,6 @@ function Manager:click(button, x, y)
|
|||||||
button = 3
|
button = 3
|
||||||
self.doubleClickTimer = nil
|
self.doubleClickTimer = nil
|
||||||
else
|
else
|
||||||
if self.doubleClickTimer then
|
|
||||||
debug(c - self.doubleClickTimer)
|
|
||||||
end
|
|
||||||
self.doubleClickTimer = c
|
self.doubleClickTimer = c
|
||||||
self.doubleClickX = x
|
self.doubleClickX = x
|
||||||
self.doubleClickY = y
|
self.doubleClickY = y
|
||||||
|
@ -321,7 +321,6 @@ function page:eventHandler(event)
|
|||||||
|
|
||||||
elseif event.type == 'delete' then
|
elseif event.type == 'delete' then
|
||||||
local focused = page:getFocused()
|
local focused = page:getFocused()
|
||||||
debug(focused.app)
|
|
||||||
if focused.app then
|
if focused.app then
|
||||||
focused.app.disabled = true
|
focused.app.disabled = true
|
||||||
local filename = focused.app.filename or fs.combine(REGISTRY_DIR, focused.app.key)
|
local filename = focused.app.filename or fs.combine(REGISTRY_DIR, focused.app.key)
|
||||||
|
@ -158,8 +158,6 @@ end
|
|||||||
function os.registerApp(app, key)
|
function os.registerApp(app, key)
|
||||||
|
|
||||||
app.key = SHA1.sha1(key)
|
app.key = SHA1.sha1(key)
|
||||||
debug(fs.combine(REGISTRY_DIR, app.key))
|
|
||||||
debug(app)
|
|
||||||
Util.writeTable(fs.combine(REGISTRY_DIR, app.key), app)
|
Util.writeTable(fs.combine(REGISTRY_DIR, app.key), app)
|
||||||
os.queueEvent('os_register_app')
|
os.queueEvent('os_register_app')
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user