Beispiel #1
0
static int
glw_keyintercept_callback(glw_t *w, void *opaque, 
			  glw_signal_t signal, void *extra)
{
  glw_t *c;

  switch(signal) {
  default:
    break;
  case GLW_SIGNAL_DESTROY:
    ki_unbind((glw_keyintercept_t *)w);
    break;
  case GLW_SIGNAL_LAYOUT:
    c = TAILQ_FIRST(&w->glw_childs);
    if(c != NULL)
      glw_layout0(c, extra);
    break;
  case GLW_SIGNAL_CHILD_CONSTRAINTS_CHANGED:
    glw_copy_constraints(w, extra);
    return 1;

  case GLW_SIGNAL_EVENT_BUBBLE:
    if(w->glw_flags2 & GLW2_ENABLED)
      return ki_handle_event((glw_keyintercept_t *)w, extra);
    else
      return 0;
  }
  return 0;
}
Beispiel #2
0
static int
glw_displacement_callback(glw_t *w, void *opaque, 
			  glw_signal_t signal, void *extra)
{
  glw_displacement_t *gd = (glw_displacement_t *)w;
  glw_t *c;
  glw_rctx_t *rc, rc0;

  switch(signal) {
  default:
    break;

  case GLW_SIGNAL_LAYOUT:
    if((c = TAILQ_FIRST(&w->glw_childs)) == NULL)
      break;

    rc = extra;
    int width  = rc->rc_width - gd->gd_padding_left - gd->gd_padding_right;
    int height = rc->rc_height - gd->gd_padding_top - gd->gd_padding_bottom;

    rc0 = *rc;
    rc0.rc_width  = width;
    rc0.rc_height = height;
    
    glw_layout0(c, &rc0);
    break;

 case GLW_SIGNAL_CHILD_CONSTRAINTS_CHANGED:
    glw_copy_constraints(w, extra);
    return 1;

  }
  return 0;
}
Beispiel #3
0
static int
glw_bloom_callback(glw_t *w, void *opaque, glw_signal_t signal,
		    void *extra)
{
  switch(signal) {
  default:
    break;
  case GLW_SIGNAL_CHILD_CONSTRAINTS_CHANGED:
    glw_copy_constraints(w, extra);
    return 1;
  }
  return 0;
}
Beispiel #4
0
static int
glw_cursor_callback(glw_t *w, void *opaque, glw_signal_t signal,
                    void *extra)
{
  switch(signal) {
  case GLW_SIGNAL_CHILD_CONSTRAINTS_CHANGED:
  case GLW_SIGNAL_CHILD_CREATED:
    if(extra == TAILQ_FIRST(&w->glw_childs))
       glw_copy_constraints(w, extra);
    return 1;
  default:
    return 0;
  }
}
Beispiel #5
0
static int
glw_slideshow_callback(glw_t *w, void *opaque, glw_signal_t signal,
		       void *extra)
{
  switch(signal) {
  case GLW_SIGNAL_CHILD_CONSTRAINTS_CHANGED:
    if(w->glw_focused == extra)
      glw_copy_constraints(w, extra);
    return 1;

  default:
    break;
  }
  return 0;
}
Beispiel #6
0
static int
glw_keyintercept_callback(glw_t *w, void *opaque, 
			  glw_signal_t signal, void *extra)
{
  switch(signal) {
  default:
    break;
  case GLW_SIGNAL_DESTROY:
    ki_unbind((glw_keyintercept_t *)w);
    break;
  case GLW_SIGNAL_CHILD_CONSTRAINTS_CHANGED:
    glw_copy_constraints(w, extra);
    return 1;

#if 0
  case GLW_SIGNAL_EVENT_BUBBLE:
    if(w->glw_flags2 & GLW2_ENABLED)
      return ki_handle_event((glw_keyintercept_t *)w, extra);
    else
      return 0;
#endif
  }
  return 0;
}
Beispiel #7
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);
  }
}
Beispiel #8
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);
}