fix bug when h-d crashes
authorJavier S. Pedro <maemo@javispedro.com>
Sun, 4 Apr 2010 00:04:34 +0000 (02:04 +0200)
committerJavier S. Pedro <maemo@javispedro.com>
Sun, 4 Apr 2010 00:04:34 +0000 (02:04 +0200)
sdlhaa/src/SDL_haa.c

index 3259884..ca92ffa 100644 (file)
@@ -335,7 +335,7 @@ static void actor_update_ready(HAA_ActorPriv* actor)
        int actual_format;
        unsigned long nitems, bytes_after;
        unsigned char *prop = NULL;
-       
+
        status = XGetWindowProperty(display, window,
                ATOM(_HILDON_ANIMATION_CLIENT_READY), 0, 32,
                False, XA_ATOM,
@@ -353,12 +353,17 @@ static void actor_update_ready(HAA_ActorPriv* actor)
        }
 
        if (actor->ready) {
-               /* Ready flag already set, which means hildon-desktop just restarted */
+               /* Ready flag already set, which means hildon-desktop just restarted.
+                 Reset this actor. */
                XUnmapWindow(display, window);
                XSync(display, False);
                XMapWindow(display, window);
                XSync(display, False);
-               SDL_Delay(500); /* Give the WM some time to relax. */
+
+               /* Hildon-desktop restarting means all the system will be under
+                 extreme load. Relax. */
+               // TODO: Delay once per crash, not per actor.
+               SDL_Delay(500);
 
                /* Next Flip will resend every setting */
                actor->p.pending = HAA_PENDING_EVERYTHING;
@@ -461,6 +466,7 @@ HAA_Actor* HAA_CreateActor(Uint32 flags,
        actor->p.z_rotation_y = 0;
        actor->p.pending =
                HAA_PENDING_POSITION | HAA_PENDING_SCALE | HAA_PENDING_PARENT;
+       actor->ready = 0;
 
        /* Select the X11 visual */
        int screen = DefaultScreen(display);