Example #1
0
static void
glw_slideshow_layout(glw_t *w, const glw_rctx_t *rc)
{
  glw_slideshow_t *s = (glw_slideshow_t *)w;
  glw_t *c, *p, *n;
  float delta;

  glw_reset_screensaver(w->glw_root);

  delta = s->w.glw_root->gr_frameduration / (1000000.0 * s->transition_time);
  if(s->time == 0) {
    s->displaytime = INT32_MAX;
  } else {
    s->displaytime = 1000000 * s->time / s->w.glw_root->gr_frameduration;
  }

    
  if((c = s->w.glw_focused) == NULL) {
    c = s->w.glw_focused = glw_first_widget(&s->w);
    if(c)
      glw_copy_constraints(&s->w, c);
  }
  if(c == NULL)
    return;

  if(s->timer >= s->displaytime) {
    c = glw_next_widget(c);
    if(c == NULL)
      c = glw_first_widget(&s->w);
    s->timer = 0;
    if(c != NULL) {
      glw_focus_open_path_close_all_other(c);
      glw_copy_constraints(&s->w, c);
    }
  }
  
  if(!s->hold)
    s->timer++;

  glw_layout0(c, rc);
  c->glw_parent_alpha = GLW_MIN(c->glw_parent_alpha + delta, 1.0f);

  /**
   * Keep previous and next images 'hot' (ie, loaded into texture memory)
   */
  p = glw_prev_widget(c);
  if(p == NULL)
    p = glw_last_widget(&s->w);
  if(p != NULL && p != c) {
    p->glw_parent_alpha = GLW_MAX(p->glw_parent_alpha - delta, 0.0f);
    glw_layout0(p, rc);
  }

  n = glw_next_widget(c);
  if(n == NULL)
    n = glw_first_widget(&s->w);
  if(n != NULL && n != c) {
    n->glw_parent_alpha = GLW_MAX(n->glw_parent_alpha - delta, 0.0f);
    glw_layout0(n, rc);
  }
}
Example #2
0
static void
glw_slideshow_layout(glw_t *w, const glw_rctx_t *rc)
{
  glw_root_t *gr = w->glw_root;
  glw_slideshow_t *s = (glw_slideshow_t *)w;
  glw_t *c, *p, *n;
  float delta;
  int r = 0;

  glw_reset_screensaver(w->glw_root);

  delta = s->w.glw_root->gr_frameduration / (float)s->transition_time;

  if((c = s->w.glw_focused) == NULL) {
    c = s->w.glw_focused = glw_first_widget(&s->w);
    if(c)
      glw_copy_constraints(&s->w, c);
  }

  if(c == NULL)
    return;

  glw_schedule_refresh(gr, s->deadline);

  if(s->deadline <= gr->gr_frame_start) {
    s->deadline = gr->gr_frame_start + s->display_time;

    c = glw_next_widget(c);
    if(c == NULL)
      c = glw_first_widget(&s->w);
    if(c != NULL) {
      glw_focus_open_path_close_all_other(c);
      glw_copy_constraints(&s->w, c);
    }
  }

  glw_layout0(c, rc);
  r |= update_parent_alpha(c, GLW_MIN(c->glw_parent_alpha + delta, 1.0f));

  /**
   * Keep previous and next images 'hot' (ie, loaded into texture memory)
   */
  p = glw_prev_widget(c);
  if(p == NULL)
    p = glw_last_widget(&s->w, 0);
  if(p != NULL && p != c) {
    r |= update_parent_alpha(p, GLW_MAX(p->glw_parent_alpha - delta, 0.0f));
    glw_layout0(p, rc);
  }

  n = glw_next_widget(c);
  if(n == NULL)
    n = glw_first_widget(&s->w);
  if(n != NULL && n != c) {
    r |= update_parent_alpha(n, GLW_MAX(n->glw_parent_alpha - delta, 0.0f));
    glw_layout0(n, rc);
  }

  if(r)
    glw_need_refresh(w->glw_root, 0);
}