Rework smart walk, fix #247

This commit is contained in:
Eduardo Bart
2013-01-26 18:10:30 -02:00
parent 4f8f02acad
commit 2fd3c643c4
12 changed files with 97 additions and 94 deletions

View File

@@ -74,7 +74,7 @@ local function onWidgetKeyDown(widget, keyCode, keyboardModifiers)
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
local callback = widget.boundKeyDownCombos[keyComboDesc]
if callback then
callback()
callback(widget, keyCode)
return true
end
return false
@@ -85,7 +85,7 @@ local function onWidgetKeyUp(widget, keyCode, keyboardModifiers)
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
local callback = widget.boundKeyUpCombos[keyComboDesc]
if callback then
callback()
callback(widget, keyCode)
return true
end
return false
@@ -96,7 +96,7 @@ local function onWidgetKeyPress(widget, keyCode, keyboardModifiers, autoRepeatTi
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
local comboConf = widget.boundKeyPressCombos[keyComboDesc]
if comboConf and (autoRepeatTicks >= comboConf.autoRepeatDelay or autoRepeatTicks == 0) and comboConf.callback then
comboConf.callback()
comboConf.callback(widget, keyCode)
return true
end
return false

View File

@@ -81,6 +81,20 @@ function table.removevalue(t, value)
end
end
function table.popvalue(value)
local index = nil
for k,v in pairs(t) do
if v == value or not value then
index = k
end
end
if index then
table.remove(t, index)
return true
end
return false
end
function table.compare(t, other)
if #t ~= #other then return false end
for k,v in pairs(t) do