From 55b2813b32a9f85246f2128dd0ad2e77319bf7e8 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Thu, 10 Jan 2013 14:18:33 +0800 Subject: [PATCH] move fake event handling to ui.lua inputevent.lua now only forwards events --- frontend/ui/inputevent.lua | 15 +++------------ frontend/ui/ui.lua | 12 +++++++++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/frontend/ui/inputevent.lua b/frontend/ui/inputevent.lua index 4c5712d0a..87a941e7d 100644 --- a/frontend/ui/inputevent.lua +++ b/frontend/ui/inputevent.lua @@ -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 diff --git a/frontend/ui/ui.lua b/frontend/ui/ui.lua index f795f79d0..cc258fc96 100644 --- a/frontend/ui/ui.lua +++ b/frontend/ui/ui.lua @@ -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