Author: titmuss
Date: Tue Nov 18 02:02:56 2008
New Revision: 3395
URL: http://svn.slimdevices.com?rev=3395&root=Jive&view=rev
Log:
Bug: 9925
Description:
Handle mouse events correctly, by returning the event status.
In Window allow child widgets to process an event before the window listeners.
Don't close the screensaver on mouse motion.
Tidy up registering event listeners in Now Playing applet.
Modified:
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_window.c
Modified:
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua?rev=3395&root=Jive&r1=3394&r2=3395&view=diff
==============================================================================
---
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
(original)
+++
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
Tue Nov 18 02:02:56 2008
@@ -187,7 +187,6 @@
local window = _createUI(self)
if self[windowStyle].window then
window:replace(self[windowStyle].window,
Window.transitionFadeIn)
- self:_installListeners(window)
end
self[windowStyle].window = window
@@ -421,8 +420,7 @@
function _installListeners(self, window)
- self[windowStyle].listeners = {}
- self[windowStyle].listeners[1] = window:addListener(
+ window:addListener(
EVENT_WINDOW_ACTIVE,
function(event)
local stack = Framework.windowStack
@@ -440,8 +438,8 @@
local playlistSize = self.player and self.player:getPlaylistSize()
- self[windowStyle].listeners[2] = window:addListener(
- EVENT_KEY_PRESS | EVENT_KEY_HOLD,
+ window:addListener(
+ EVENT_KEY_ALL | EVENT_KEY_PRESS | EVENT_KEY_HOLD,
function(event)
local type = event:getType()
local keyPress = event:getKeycode()
@@ -600,6 +598,9 @@
local manager = appletManager:getAppletInstance("ScreenSavers")
manager:screensaverWindow(window)
end
+
+ -- install some listeners to the window
+ self:_installListeners(window)
return window
end
@@ -763,8 +764,6 @@
-- Initialize with current data from Player
self[windowStyle].window:show(transitionOn)
- -- install some listeners to the window after it's shown
- self:_installListeners(self[windowStyle].window)
self:_updateAll(self[windowStyle])
end
Modified:
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua?rev=3395&root=Jive&r1=3394&r2=3395&view=diff
==============================================================================
---
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
(original)
+++
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/ScreenSavers/ScreenSaversApplet.lua
Tue Nov 18 02:02:56 2008
@@ -215,7 +215,7 @@
end)
-- key or scroll events quit the screensaver
- window:addListener(EVENT_CHAR_PRESS | EVENT_KEY_PRESS | EVENT_KEY_HOLD
| EVENT_SCROLL | EVENT_MOUSE_ALL,
+ window:addListener(EVENT_CHAR_PRESS | EVENT_KEY_PRESS | EVENT_KEY_HOLD
| EVENT_SCROLL | EVENT_MOUSE_PRESS | EVENT_MOUSE_HOLD,
function(event)
-- close all screensaver windows
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua?rev=3395&root=Jive&r1=3394&r2=3395&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua Tue Nov 18
02:02:56 2008
@@ -152,11 +152,6 @@
})
)
end
-
- obj:addListener(EVENT_ALL,
- function(event)
- return obj:_eventHandler(event)
- end)
return obj
end
@@ -1279,6 +1274,14 @@
end
+function _event(self, event)
+ local r = self:_eventHandler(event)
+
+ if r & EVENT_CONSUME == 0 then
+ Widget._event(self, event)
+ end
+end
+
--[[ C optimized:
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_window.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_window.c?rev=3395&root=Jive&r1=3394&r2=3395&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_window.c (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_window.c Tue Nov 18
02:02:56 2008
@@ -127,6 +127,8 @@
int jiveL_window_iterate(lua_State *L) {
+ int r = 0;
+
/* stack is:
* 1: widget
* 2: closure
@@ -141,9 +143,10 @@
while (lua_next(L, -2) != 0) {
lua_pushvalue(L, 2);
lua_pushvalue(L, -2);
- lua_call(L, 1, 0);
+ lua_call(L, 1, 1);
- lua_pop(L, 1);
+ r = r | luaL_optinteger(L, -1, 0);
+ lua_pop(L, 2);
}
lua_pop(L, 2);
}
@@ -155,13 +158,15 @@
while (lua_next(L, -2) != 0) {
lua_pushvalue(L, 2);
lua_pushvalue(L, -2);
- lua_call(L, 1, 0);
-
- lua_pop(L, 1);
+ lua_call(L, 1, 1);
+
+ r = r | luaL_optinteger(L, -1, 0);
+ lua_pop(L, 2);
}
lua_pop(L, 1);
- return 0;
+ lua_pushinteger(L, r);
+ return 1;
}
@@ -313,9 +318,8 @@
lua_pushvalue(L, 1); /* widget */
lua_pushvalue(L, lua_upvalueindex(1)); /* event */
lua_call(L, 2, 1);
-
- // FIXME return value
- lua_pop(L, 1);
+
+ return 1;
}
}
@@ -368,11 +372,11 @@
lua_pushvalue(L, 2); // event
lua_pushcclosure(L, mouse_closure, 1);
- lua_call(L, 2, 0);
- }
- // FIXME r
-
- lua_pushinteger(L, r);
+ lua_call(L, 2, 1);
+ }
+ else {
+ lua_pushinteger(L, r);
+ }
return 1;
case JIVE_EVENT_WINDOW_ACTIVE:
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins