move fake event handling to ui.lua

inputevent.lua now only forwards events
This commit is contained in:
Qingping Hou
2013-01-10 14:18:33 +08:00
parent 68cc9b9cf4
commit 55b2813b32
2 changed files with 14 additions and 13 deletions

View File

@@ -390,18 +390,9 @@ function Input:waitEvent(timeout_us, timeout_s)
keycode = self.rotation_map[self.rotation][keycode]
end
if keycode == "IntoSS" then
Device:intoScreenSaver()
return
elseif keycode == "OutOfSS" then
Device:outofScreenSaver()
return
elseif keycode == "Charging" then
Device:usbPlugIn()
return
elseif keycode == "NotCharging" then
Device:usbPlugOut()
return
if keycode == "IntoSS" or keycode == "OutOfSS"
or keycode == "Charging" or keycode == "NotCharging" then
return keycode
end
-- handle modifier keys

View File

@@ -205,7 +205,17 @@ function UIManager:run()
-- delegate input_event to handler
if input_event then
DEBUG(input_event)
self:sendEvent(input_event)
if input_event == "IntoSS" then
Device:intoScreenSaver()
elseif input_event == "OutOfSS" then
Device:outofScreenSaver()
elseif input_event == "Charging" then
Device:usbPlugIn()
elseif input_event == "NotCharging" then
Device:usbPlugOut()
else
self:sendEvent(input_event)
end
end
end
end