Merge branch 'master' of https://vcs.maemo.org/git/livewp
[livewp] / applet / src / livewp-home-widget.c
index 1219d36..01daa18 100644 (file)
@@ -332,8 +332,7 @@ change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
     
     ms = tvb.tv_usec;
     sec = tvb.tv_sec;
-//    fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
-   
+    
     if (!actor->visible){
         actor->visible = TRUE;
         if (scene.daytime == TIME_NIGHT){
@@ -910,8 +909,10 @@ short_timeout (AWallpaperPlugin *desktop_plugin)
       Actor *actor;
       gboolean stop_flag = TRUE;
 
-    if (!desktop_plugin->priv->visible)
-        return TRUE;
+    if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
+        desktop_plugin->priv->short_timer = 0;
+        return FALSE;
+    }
 
     now = time(NULL);
     //scene.daytime = daytime;
@@ -948,8 +949,10 @@ long_timeout (AWallpaperPlugin *desktop_plugin)
     Actor *actor;
 
     /* TODO  remove timeout */
-    if (!desktop_plugin->priv->visible)
-        return TRUE;
+    if (!desktop_plugin->priv->visible){
+        desktop_plugin->priv->short_timer = 0;
+        return FALSE;
+    }
     //fprintf(stderr, "timer daytime=%d\n", daytime);
     if (scene.daytime != daytime){
         tmp = scene.actors;
@@ -973,7 +976,8 @@ long_timeout (AWallpaperPlugin *desktop_plugin)
             && desktop_plugin->priv->short_timer == 0){
             actor->time_start_animation = now;
             /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */
-            desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin);
+            if (desktop_plugin->priv->rich_animation)
+                desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin);
         }
         tmp = g_slist_next(tmp);
     }
@@ -988,11 +992,12 @@ desktop_plugin_visible_notify (GObject    *object,
                                           GParamSpec *spec,
                                           AWallpaperPlugin *desktop_plugin)
 {
-      gboolean visible;
-      g_object_get (object, "is-on-current-desktop", &visible, NULL);
-      if (visible)
+    gboolean visible;
+    g_object_get (object, "is-on-current-desktop", &visible, NULL);
+    if (visible){
         desktop_plugin->priv->visible = TRUE;
-      else
+        desktop_plugin->priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
+    }else
         desktop_plugin->priv->visible = FALSE;
    /*   fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
 }