Author: fmueller
Date: Mon Mar  1 01:59:03 2010
New Revision: 8603

URL: http://svn.slimdevices.com/jive?rev=8603&view=rev
Log:
Bug: 15557 
Description: Much better fix for the split scrolling issue (actually fixing the 
dirty area). Thanks Adrian. 

Modified:
    7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Group.lua
    7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua
    7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua
    7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
    7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_widget.c

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Group.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Group.lua?rev=8603&r1=8602&r2=8603&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Group.lua (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Group.lua Mon Mar  1 
01:59:03 2010
@@ -231,6 +231,13 @@
        return table.concat(str)
 end
 
+
+function setSmoothScrollingMenu(self, val)
+       for _,widget in pairs (self.widgets) do
+               widget:setSmoothScrollingMenu(val)
+       end
+end
+
 --[[
 
 =head1 LICENSE

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua?rev=8603&r1=8602&r2=8603&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua Mon Mar  1 
01:59:03 2010
@@ -48,6 +48,7 @@
 local NumberLetterAccel    = require("jive.ui.NumberLetterAccel")
 local Flick                = require("jive.ui.Flick")
 local Timer                = require("jive.ui.Timer")
+local System               = require("jive.System")
 
 local log                  = require("jive.utils.log").logger("squeezeplay.ui")
 
@@ -113,6 +114,9 @@
 local MOUSE_DRAG = 3
 local MOUSE_CHIRAL = 4
 
+-- touch hardware supports smooth scrolling and requires additional state to 
be maintained
+local TOUCH = System:hasTouch() or not System:isHardware()
+
 -- our class
 module(...)
 oo.class(_M, Widget)
@@ -1611,6 +1615,9 @@
                if widget then
                        if widget.parent ~= self then
                                widget.parent = self
+                               if TOUCH then
+                                       widget:setSmoothScrollingMenu(self)
+                               end
                                widget:dispatchNewEvent(EVENT_SHOW)
                        end
 
@@ -1622,6 +1629,9 @@
        for widget,i in pairs(lastWidgets) do
                widget:dispatchNewEvent(EVENT_HIDE)
                widget.parent = nil
+               if TOUCH then
+                       widget:setSmoothScrollingMenu(nil)
+               end
        end
 
        self.lastWidgets = nextWidgets

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua?rev=8603&r1=8602&r2=8603&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua Mon Mar  1 
01:59:03 2010
@@ -692,6 +692,11 @@
 end
 
 
+function setSmoothScrollingMenu(self, val)
+       self.smoothscroll = val
+end
+
+
 --[[
 
 =head1 LICENSE

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c?rev=8603&r1=8602&r2=8603&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c Mon Mar  1 
01:59:03 2010
@@ -126,7 +126,6 @@
        { SDLK_a,        0x7689609f }, /* add */
        { SDLK_UNKNOWN,  0x0        },
 };
-
 
 static int process_event(lua_State *L, SDL_Event *event);
 static void process_timers(lua_State *L);
@@ -544,6 +543,12 @@
                        lua_call(L, 3, 0);
                }
 
+#if 0
+               // show the dirty region for debug purposes:
+               jive_surface_rectangleColor(srf, jive_dirty_region.x, 
jive_dirty_region.y,
+                       jive_dirty_region.x + jive_dirty_region.w, 
jive_dirty_region.y + jive_dirty_region.h, 0xFFFFFFFF);
+#endif 
+
                /* clear the dirty region for non standalone draws */
                if (!standalone_draw) {
                        memcpy(&last_dirty_region, &jive_dirty_region, 
sizeof(last_dirty_region));

Modified: 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_widget.c
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_widget.c?rev=8603&r1=8602&r2=8603&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_widget.c (original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/src/ui/jive_widget.c Mon Mar  1 
01:59:03 2010
@@ -354,6 +354,7 @@
 
 int jiveL_widget_redraw(lua_State *L) {
        JiveWidget *peer;
+       int offset = 0;
 
        /* stack is:
         * 1: widget
@@ -365,7 +366,25 @@
                peer = lua_touserdata(L, -1);
 
                if (peer) {
-                       jive_redraw(&peer->bounds);
+                       /* if the widget is inside a menu using smooth 
scrolling, find the offset
+                        * and use it to adjust the dirty region reported by 
the widget */
+                       lua_getfield(L, 1, "smoothscroll");
+                       if (lua_istable(L, -1)) {
+                               lua_getfield(L, -1, "pixelOffsetY");
+                               offset = lua_tointeger(L, -1);
+                               lua_pop(L, 2);
+                       } else {
+                               lua_pop(L, 1);
+                       }
+                       
+                       if (!offset) {
+                               jive_redraw(&peer->bounds);
+                       } else {
+                               SDL_Rect r;
+                               memcpy(&r, &peer->bounds, sizeof(r));
+                               r.y += offset;
+                               jive_redraw(&r);
+                       }
                }
 
                lua_pop(L, 1);

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

Reply via email to