mod: handle shift and alt key events in adjustKeyEvents()

This commit is contained in:
Qingping Hou
2012-03-02 18:38:34 +08:00
parent 1713e2ab0b
commit 6614bbe33d
6 changed files with 34 additions and 70 deletions

View File

@@ -98,14 +98,10 @@ function InputBox:input(ypos, height, title, d_text)
end
local ev = input.waitForEvent()
ev.code = adjustKeyEvents(ev)
if ev.type == EV_KEY and ev.value == EVENT_VALUE_KEY_PRESS then
ev.code = adjustFWKey(ev.code)
--local secs, usecs = util.gettime()
if ev.code == KEY_SHIFT then
Keys.shiftmode = true
elseif ev.code == KEY_ALT then
Keys.altmode = true
elseif ev.code == KEY_FW_UP then
if ev.code == KEY_FW_UP then
elseif ev.code == KEY_FW_DOWN then
elseif ev.code == KEY_A then
self:addChar("a")
@@ -198,12 +194,6 @@ function InputBox:input(ypos, height, title, d_text)
--local nsecs, nusecs = util.gettime()
--local dur = (nsecs - secs) * 1000000 + nusecs - usecs
--print("E: T="..ev.type.." V="..ev.value.." C="..ev.code.." DUR="..dur)
elseif ev.type == EV_KEY and ev.value == EVENT_VALUE_KEY_RELEASE
and ev.code == KEY_SHIFT then
Keys.shiftmode = false
elseif ev.type == EV_KEY and ev.value == EVENT_VALUE_KEY_RELEASE
and ev.code == KEY_ALT then
Keys.altmode = false
end
end
end