Author: titmuss
Date: Sun Jan 27 12:53:07 2008
New Revision: 1648

URL: http://svn.slimdevices.com?rev=1648&root=Jive&view=rev
Log:
Bug: 6419
Description:
Fix volume control when a popup (f.e. a show briefly) is displayed on the 
screen.
Fix volume control so that transport keys (f.e. pause) can be used while the 
volume is 
displayed on the screen.


Modified:
    branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/Volume.lua
    branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua

Modified: branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/Volume.lua
URL: 
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/Volume.lua?rev=1648&root=Jive&r1=1647&r2=1648&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/Volume.lua 
(original)
+++ branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/Volume.lua Sun Jan 
27 12:53:07 2008
@@ -59,7 +59,11 @@
        end
 
        -- we need a local copy of the volume
-       self.volume = self.player:getVolume() or 0
+       self.volume = self.player:getVolume()
+       if not self.volume then
+               -- don't show the popup if the player state is not loaded
+               return
+       end
 
        local popup = Popup("volumePopup")
        popup:setAutoHide(false)
@@ -189,17 +193,30 @@
        elseif type == EVENT_KEY_PRESS then
                local keycode = event:getKeycode()
 
-               if keycode == KEY_GO then
+               -- GO closes the volume popup
+               if keycode & KEY_GO ~= 0 then
                        self.popup:showBriefly(0)
                        return EVENT_CONSUME
                end
 
-               -- we're only interested in volume keys
-               if keycode & (KEY_VOLUME_UP|KEY_VOLUME_DOWN) ~= 
(KEY_VOLUME_UP|KEY_VOLUME_DOWN) then
-                       return EVENT_CONSUME
-               end
-
-               _updateVolume(self, self.volume >= 0)
+               -- volume + and - for mute
+               if keycode & (KEY_VOLUME_UP|KEY_VOLUME_DOWN) == 
(KEY_VOLUME_UP|KEY_VOLUME_DOWN) then
+                       _updateVolume(self, self.volume >= 0)
+                       return EVENT_CONSUME
+               end
+
+               -- any other keys forward to the lower window
+               if keycode & (KEY_VOLUME_UP|KEY_VOLUME_DOWN) == 0 then
+                       local lower = self.popup:getLowerWindow()
+                       if lower then
+                               Framework:dispatchEvent(lower, event)
+                       end
+
+                       self.popup:showBriefly(0)
+                       return EVENT_CONSUME
+               end
+
+               return EVENT_CONSUME
 
        else
                local keycode = event:getKeycode()

Modified: branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua?rev=1648&root=Jive&r1=1647&r2=1648&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua (original)
+++ branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua Sun Jan 27 
12:53:07 2008
@@ -52,7 +52,7 @@
 local debug          = require("jive.utils.debug")
 local log            = require("jive.utils.log").logger("player")
 
-local EVENT_KEY_PRESS  = jive.ui.EVENT_KEY_PRESS
+local EVENT_KEY_ALL    = jive.ui.EVENT_KEY_ALL
 local EVENT_SCROLL     = jive.ui.EVENT_SCROLL
 local EVENT_CONSUME    = jive.ui.EVENT_CONSUME
 
@@ -581,7 +581,7 @@
              })
 
        self.currentSong.window:addWidget(group)
-       self.currentSong.window:addListener(EVENT_KEY_PRESS | EVENT_SCROLL,
+       self.currentSong.window:addListener(EVENT_KEY_ALL | EVENT_SCROLL,
                function(event)
                        local prev = self.currentSong.window:getLowerWindow()
                        if prev then

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to