Esempio n. 1
0
static void
start_animation (ply_boot_splash_plugin_t *plugin)
{
        ply_list_node_t *node;

        if (plugin->is_animating)
                return;

        node = ply_list_get_first_node (plugin->views);
        while (node != NULL) {
                ply_list_node_t *next_node;
                view_t *view;

                view = ply_list_node_get_data (node);
                next_node = ply_list_get_next_node (plugin->views, node);

                view_start_animation (view);

                node = next_node;
        }

        plugin->is_animating = true;

        plugin->start_time = ply_get_timestamp ();
        animate_at_time (plugin, plugin->start_time);

        if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
                return;

        ply_event_loop_watch_for_timeout (plugin->loop,
                                          1.0 / FRAMES_PER_SECOND,
                                          (ply_event_loop_timeout_handler_t)
                                          on_timeout, plugin);
}
Esempio n. 2
0
static void
on_timeout (ply_throbber_t *throbber)
{
        double sleep_time;
        bool should_continue;

        throbber->now = ply_get_timestamp ();

        should_continue = animate_at_time (throbber,
                                           throbber->now - throbber->start_time);

        sleep_time = 1.0 / FRAMES_PER_SECOND;
        sleep_time = MAX (sleep_time - (ply_get_timestamp () - throbber->now),
                          0.005);

        if (!should_continue) {
                throbber->is_stopped = true;
                if (throbber->stop_trigger != NULL) {
                        ply_trigger_pull (throbber->stop_trigger, NULL);
                        throbber->stop_trigger = NULL;
                }
        } else {
                ply_event_loop_watch_for_timeout (throbber->loop,
                                                  sleep_time,
                                                  (ply_event_loop_timeout_handler_t)
                                                  on_timeout, throbber);
        }
}
Esempio n. 3
0
static void
on_timeout (ply_boot_splash_plugin_t *plugin)
{
        double sleep_time;

        plugin->now = ply_get_timestamp ();

        /* The choice below is between
         *
         * 1) keeping a constant animation speed, and dropping
         * frames when necessary
         * 2) showing every frame, but slowing down the animation
         * when a frame would be otherwise dropped.
         *
         * It turns out there are parts of boot up where the animation
         * can get sort of choppy.  By default we choose 2, since the
         * nature of this animation means it looks natural even when it
         * is slowed down
         */
#ifdef REAL_TIME_ANIMATION
        animate_at_time (plugin,
                         plugin->now - plugin->start_time);
#else
        static double time = 0.0;
        time += 1.0 / FRAMES_PER_SECOND;
        animate_at_time (plugin, time);
#endif

        sleep_time = 1.0 / FRAMES_PER_SECOND;
        sleep_time = MAX (sleep_time - (ply_get_timestamp () - plugin->now),
                          0.005);

        ply_event_loop_watch_for_timeout (plugin->loop,
                                          sleep_time,
                                          (ply_event_loop_timeout_handler_t)
                                          on_timeout, plugin);
}
Esempio n. 4
0
static void
on_timeout (ply_animation_t *animation)
{
  double sleep_time;
  bool should_continue;
  animation->previous_time = animation->now;
  animation->now = ply_get_timestamp ();

#ifdef REAL_TIME_ANIMATION
  should_continue = animate_at_time (animation,
                                     animation->now - animation->start_time);
#else
  static double time = 0.0;
  time += 1.0 / FRAMES_PER_SECOND;
  should_continue = animate_at_time (animation, time);
#endif

  sleep_time = 1.0 / FRAMES_PER_SECOND;
  sleep_time = MAX (sleep_time - (ply_get_timestamp () - animation->now),
                    0.005);

  if (!should_continue)
    {
      if (animation->stop_trigger != NULL)
        {
          ply_trigger_pull (animation->stop_trigger, NULL);
          animation->stop_trigger = NULL;
        }
    }
  else
    {
      ply_event_loop_watch_for_timeout (animation->loop,
                                        sleep_time,
                                        (ply_event_loop_timeout_handler_t)
                                        on_timeout, animation);
    }
}