Author: titmuss
Date: Fri Dec 19 13:05:09 2008
New Revision: 3579

URL: http://svn.slimdevices.com?rev=3579&root=Jive&view=rev
Log:
Bug: N/A
Description:
Hide mouse pointer on inactivity.


Modified:
    7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c

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=3579&root=Jive&r1=3578&r2=3579&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 Fri Dec 19 
13:05:09 2008
@@ -33,6 +33,8 @@
 
 /* button hold threshold 1 seconds */
 #define HOLD_TIMEOUT 1000
+
+#define POINTER_TIMEOUT 20000
 
 static bool update_screen = true;
 
@@ -65,6 +67,8 @@
 static SDL_TimerID key_timer = NULL;
 
 static SDL_TimerID mouse_timer = NULL;
+
+static SDL_TimerID pointer_timer = NULL;
 
 static Uint16 mouse_origin_x, mouse_origin_y;
 
@@ -161,7 +165,7 @@
        jive_surface_set_wm_icon(icon);
        jive_surface_free(icon);
 
-//     SDL_ShowCursor (SDL_DISABLE);
+       SDL_ShowCursor(SDL_DISABLE);
        SDL_EnableKeyRepeat (100, 100);
        SDL_EnableUNICODE(1);
 
@@ -827,6 +831,12 @@
        return 0;
 }
 
+static Uint32 pointer_callback(Uint32 interval, void *param) {
+       SDL_ShowCursor(SDL_DISABLE);
+
+       return 0;
+}
+
 
 static int do_dispatch_event(lua_State *L, JiveEvent *jevent) {
        int r;
@@ -929,6 +939,14 @@
                break;
 
        case SDL_MOUSEMOTION:
+
+               /* show mouse cursor */
+               if (pointer_timer) {
+                       SDL_RemoveTimer(pointer_timer);
+               }
+               SDL_ShowCursor(SDL_ENABLE);
+               SDL_AddTimer(POINTER_TIMEOUT, &pointer_callback, NULL);
+
                if (event->motion.state & SDL_BUTTON(1)) {
                        if ( ( (mouse_state == MOUSE_STATE_DOWN || mouse_state 
== MOUSE_STATE_SENT)
                               && (abs(mouse_origin_x - event->motion.x) > 10

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

Reply via email to