Author: titmuss
Date: Fri Apr  4 05:32:13 2008
New Revision: 2168

URL: http://svn.slimdevices.com?rev=2168&root=Jive&view=rev
Log:
Bug: 7555
Description:
Improve scroll wheel selection.
Don't require a mouse for SDL to run on fbcon.

This requires the following squeezeos kernel checkin to work.


Modified:
    trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
    trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c

Modified: trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
URL: 
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c?rev=2168&root=Jive&r1=2167&r2=2168&view=diff
==============================================================================
--- trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c (original)
+++ trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c Fri Apr  4 
05:32:13 2008
@@ -128,6 +128,9 @@
        screen_w = r.w;
        screen_h = r.h;
 
+       /* linux fbcon does not need a mouse */
+       SDL_putenv("SDL_NOMOUSE=1");
+
        /* initialise SDL */
        if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
                fprintf(stderr, "SDL_Init(V|T|A): %s\n", SDL_GetError());

Modified: trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c
URL: 
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c?rev=2168&root=Jive&r1=2167&r2=2168&view=diff
==============================================================================
--- trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c (original)
+++ trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c Fri Apr  4 05:32:13 
2008
@@ -119,7 +119,7 @@
        struct input_event ev[64];
        size_t rd;
        int i;
-       Sint16 scroll = 0;
+       Sint16 scroll = 0, last_value = 0;
 
        rd = read(fd, ev, sizeof(struct input_event) * 64);
 
@@ -128,19 +128,32 @@
                return -1;
        }
 
+       event.type = (JiveEventType) JIVE_EVENT_SCROLL;
+
        for (i = 0; i < rd / sizeof(struct input_event); i++) {
                if (ev[i].type == EV_SYN) {
                        event.ticks = TIMEVAL_TO_TICKS(ev[0].time);
+
+                       /* changed direction? */
+                       if (scroll != 0 && abs(scroll) != abs(last_value)) {
+                               event.u.scroll.rel = scroll;
+                               jive_queue_event(&event);
+
+                               scroll = 0;
+                       }
+
+                       scroll += last_value;
+                       last_value = 0;
                }
                else if (ev[i].type == EV_REL) {
-                       scroll += ev[i].value;
-               }
-       }
-
-       event.type = (JiveEventType) JIVE_EVENT_SCROLL;
-
-       event.u.scroll.rel = scroll;
-       jive_queue_event(&event);
+                       last_value += ev[i].value;
+               }
+       }
+
+       if (scroll != 0) {
+               event.u.scroll.rel = scroll;
+               jive_queue_event(&event);
+       }
 
        return 0;
 }

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

Reply via email to