keyboard accelerators

This commit is contained in:
airstruck
2015-10-29 13:52:34 -04:00
parent 0d8a01b405
commit 1c491335f5
4 changed files with 51 additions and 20 deletions

View File

@@ -7,11 +7,7 @@ local Event = Base:extend({ name = 'Event' })
function Event:emit (target, data, defaultAction)
local callbacks = self.registry[target]
if not callbacks then
if defaultAction then defaultAction() end
return
end
local result = callbacks(data or {})
local result = callbacks and callbacks(data or {})
if result ~= nil then return result end
if defaultAction then defaultAction() end
end
@@ -22,7 +18,7 @@ function Event:bind (target, callback)
end
local eventNames = {
'Reshape', 'Display', 'Keyboard', 'TextInput', 'Motion',
'Reshape', 'Display', 'KeyPress', 'KeyRelease', 'TextInput', 'Motion',
'Enter', 'Leave', 'PressEnter', 'PressLeave',
'PressStart', 'PressEnd', 'PressDrag', 'PressMove', 'Press',
}