Author: richard
Date: Thu Feb 5 08:52:48 2009
New Revision: 4044
URL: http://svn.slimdevices.com?rev=4044&root=Jive&view=rev
Log:
Bug: N/A
Description:
Review event model changes, some (minor) cleanup.
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/BlankScreen/BlankScreenApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/BlankScreen/BlankScreenApplet.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/BlankScreen/BlankScreenApplet.lua?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/BlankScreen/BlankScreenApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/BlankScreen/BlankScreenApplet.lua
Thu Feb 5 08:52:48 2009
@@ -47,8 +47,7 @@
self.bgicon = Icon("background", self.bg)
self.window:addWidget(self.bgicon)
- self.window:addListener(
- EVENT_WINDOW_ACTIVE | EVENT_HIDE,
+ self.window:addListener(EVENT_WINDOW_ACTIVE | EVENT_HIDE,
function(event)
local type = event:getType()
if type == EVENT_WINDOW_ACTIVE then
@@ -65,8 +64,7 @@
true
)
- self.window:addListener(
- EVENT_MOTION,
+ self.window:addListener(EVENT_MOTION,
function()
self.window:hide()
return EVENT_CONSUME
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
(original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Clock/ClockApplet.lua
Thu Feb 5 08:52:48 2009
@@ -124,8 +124,7 @@
obj.window = Window("Clock")
obj:_createSurface()
- obj.window:addListener(
- EVENT_MOTION,
+ obj.window:addListener(EVENT_MOTION,
function()
obj.window:hide()
return EVENT_CONSUME
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
Thu Feb 5 08:52:48 2009
@@ -416,8 +416,7 @@
function _installListeners(self, window)
if windowStyle == 'browse' then
- window:addListener(
- EVENT_WINDOW_ACTIVE,
+ window:addListener(EVENT_WINDOW_ACTIVE,
function(event)
windowStyle = 'browse'
self:_updateAll(self[windowStyle])
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
Thu Feb 5 08:52:48 2009
@@ -63,8 +63,7 @@
self.timer:start()
-- listener to restart screensaver timer
- Framework:addListener(
- ACTION | EVENT_SCROLL | EVENT_MOUSE_ALL | EVENT_MOTION,
+ Framework:addListener(ACTION | EVENT_SCROLL | EVENT_MOUSE_ALL |
EVENT_MOTION,
function(event)
-- restart timer if it is running
self.timer:setInterval(self.timeout)
@@ -143,8 +142,7 @@
-- set the screensaver to activate 10 seconds after the window
-- is closed, assuming we still don't have any activity
if not Framework.windowStack[1]:canActivateScreensaver() then
- Framework.windowStack[1]:addListener(
- EVENT_WINDOW_INACTIVE,
+ Framework.windowStack[1]:addListener(EVENT_WINDOW_INACTIVE,
function()
if not self.timer:isRunning() then
self.timer:restart(10000)
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
Thu Feb 5 08:52:48 2009
@@ -2144,8 +2144,7 @@
log:debug("new step: " , step)
-- make sure closing our windows do keep the path alive!
- window:addListener(
- EVENT_WINDOW_POP,
+ window:addListener(EVENT_WINDOW_POP,
function(evt)
-- clear it if present, so we can start again the
textinput
if item then
@@ -2174,8 +2173,7 @@
return
end
- _playerKeyHandler = Framework:addListener(
- EVENT_KEY_DOWN | EVENT_KEY_PRESS | EVENT_KEY_HOLD,
+ _playerKeyHandler = Framework:addListener(EVENT_KEY_DOWN |
EVENT_KEY_PRESS | EVENT_KEY_HOLD,
function(event)
local type = event:getType()
Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua Thu Feb 5
08:52:48 2009
@@ -177,8 +177,8 @@
-- Singleton instances (locals)
_globalStrings = locale:readGlobalStringsFile()
- Framework:setInputToActionMap(_inputToActionMap)
- Framework:registerDefaultActions()
+ -- register the default actions
+ Framework:registerActions(_inputToActionMap)
-- create the main menu
jiveMain = oo.rawnew(self, HomeMenu(_globalStrings:str("HOME"), nil,
"hometitle"))
@@ -199,47 +199,8 @@
jiveMain:reloadSkin()
return EVENT_UNUSED
end,
- 10)
-
-
- -- action mapping listener, should be last listener in chain to allow
for direct access to keys/other input types if needed.
- --todo add other input types
- Framework:addListener(EVENT_KEY_ALL | EVENT_CHAR_PRESS ,
- function(event)
- return (Framework:convertInputToAction(event))
- end,
- 9999)
-
-
-
- --"Last Resort" action listener - provides backwords compatibility for
applets that only respond to KEY events
- -- This listeners says, "in no one has use an ACTION, send a key event
that matchs that action"
- -- This is needed, for instance, for keyboard shortcut input, which now
only creates action events
----- DOESN"T WORK! new action listeners will pick up the action events before
the old KEY style listeners will get a chance
--- Framework:addListener(ACTION,
--- function(actionEvent)
--- local sourceEvent =
getmetatable(actionEvent).sourceEvent
---
--- if (sourceEvent:getType() & EVENT_KEY_ALL) == 0 then
--- --Only do last resort key event if source event
was not a key event (key event s would cause infinite loop)
--- local action = actionEvent:getAction()
--- if not lastResortActionToKeyMap[action] then
--- return EVENT_UNUSED
--- end
---
--- local keyCode =
lastResortActionToKeyMap[action].keyCode
--- local keyEvent =
lastResortActionToKeyMap[action].event
--- log:debug("Pushing last resort key event for
unused action (", action, ")")
--- Framework:pushEvent(Event:new(keyEvent,
keyCode))
---
--- return EVENT_CONSUME
--- end
---
--- return EVENT_UNUSED
--- end,
--- 10000)
-
-
+ 10)
+
Framework:addActionListener("go_home", self, _goHomeAction, 10)
-- disconnect from player on press and hold left
Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua Thu Feb
5 08:52:48 2009
@@ -224,6 +224,19 @@
end
+function init(self)
+ -- initialize SDL
+ self:initSDL()
+
+ -- action mapping listener, should be last listener in chain to
+ -- allow for direct access to keys/other input types if needed.
+ self:addListener(jive.ui.EVENT_KEY_ALL | jive.ui.EVENT_CHAR_PRESS ,
+ function(event)
+ return self:convertInputToAction(event)
+ end,
+ 9999)
+end
+
--[[
@@ -628,7 +641,6 @@
--Bump as default (in case no one is handling this action)
self:addActionListener(actionName, self, bump, 9999)
-
end
@@ -646,16 +658,12 @@
end
return action
-
-end
-
-
-function setInputToActionMap(self, map)
+end
+
+
+function registerActions(self, map)
self.inputToActionMap = map
-end
-
-
-function registerDefaultActions(self)
+
for key, action in pairs(self.inputToActionMap.keyActionMappings.press)
do
self:registerAction(action)
end
@@ -665,7 +673,6 @@
for key, action in
pairs(self.inputToActionMap.charActionMappings.press) do
self:registerAction(action)
end
-
end
@@ -695,8 +702,8 @@
self:pushEvent(actionEvent)
return EVENT_CONSUME
-
-end
+end
+
--if the passed in actionName is not a registered action, an error is logged
and false is returned.
function assertActionName(self, actionName)
@@ -742,7 +749,6 @@
end,
priority
)
-
end
@@ -759,6 +765,7 @@
return false
end
+
--[[
Modified: 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c?rev=4044&root=Jive&r1=4043&r2=4044&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c Thu Feb 5
08:52:48 2009
@@ -116,7 +116,7 @@
}
-static int jiveL_init(lua_State *L) {
+static int jiveL_initSDL(lua_State *L) {
SDL_Rect r;
const SDL_VideoInfo *video_info;
JiveSurface *srf, *splash, *icon;
@@ -1268,7 +1268,7 @@
};
static const struct luaL_Reg core_methods[] = {
- { "init", jiveL_init },
+ { "initSDL", jiveL_initSDL },
{ "quit", jiveL_quit },
{ "processEvents", jiveL_process_events },
{ "setUpdateScreen", jiveL_set_update_screen },
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins