fix: move shiftmode and altmode to global

now shiftmode and altmode is recoreded in Keys module.  So all the UIs
are sharing these two mode instead of remembering their own. These fix
the bug in UI switchings.

For instance, you use combo 'Alt'+'b' to fire up some menu in pdfreader,
the altmode is set, but the alt key was released after the menu show
up. Then the key release event will only be captured by the menu. So
after you exit from the menu, the altmode is still set in pdfreader,
which is not what we want.
This commit is contained in:
Qingping Hou
2012-03-02 13:46:15 +08:00
parent e42f4ae38e
commit 53d4016c64
6 changed files with 73 additions and 27 deletions

View File

@@ -102,9 +102,9 @@ function InputBox:input(ypos, height, title, d_text)
ev.code = adjustFWKey(ev.code)
--local secs, usecs = util.gettime()
if ev.code == KEY_SHIFT then
self.shiftmode = true
Keys.shiftmode = true
elseif ev.code == KEY_ALT then
self.altmode = true
Keys.altmode = true
elseif ev.code == KEY_FW_UP then
elseif ev.code == KEY_FW_DOWN then
elseif ev.code == KEY_A then
@@ -200,10 +200,10 @@ function InputBox:input(ypos, height, title, d_text)
--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
self.shiftmode = false
Keys.shiftmode = false
elseif ev.type == EV_KEY and ev.value == EVENT_VALUE_KEY_RELEASE
and ev.code == KEY_ALT then
self.altmode = false
Keys.altmode = false
end
end
end