ply_pixel_display_t *
ply_pixel_display_new (ply_renderer_t      *renderer,
                       ply_renderer_head_t *head)
{
  ply_pixel_display_t *display;
  ply_pixel_buffer_t  *pixel_buffer;
  ply_rectangle_t      size;

  display = calloc (1, sizeof (ply_pixel_display_t));

  display->loop = ply_event_loop_get_default ();
  display->renderer = renderer;
  display->head = head;

  pixel_buffer = ply_renderer_get_buffer_for_head (renderer, head);
  ply_pixel_buffer_get_size (pixel_buffer, &size);

  display->width = size.width;
  display->height = size.height;

  display->bits_per_pixel = ply_renderer_get_bits_per_pixel_for_head (renderer,
                                                                      head);

  return display;
}
Example #2
0
bool
ply_animation_start (ply_animation_t    *animation,
                     ply_pixel_display_t *display,
                     ply_trigger_t      *stop_trigger,
                     long                x,
                     long                y)
{
  assert (animation != NULL);

  if (!animation->is_stopped)
    return true;

  animation->loop = ply_event_loop_get_default ();
  animation->display = display;
  animation->stop_trigger = stop_trigger;
  animation->is_stopped = false;
  animation->stop_requested = false;

  animation->x = x;
  animation->y = y;

  animation->start_time = ply_get_timestamp ();

  ply_event_loop_watch_for_timeout (animation->loop,
                                    1.0 / FRAMES_PER_SECOND,
                                    (ply_event_loop_timeout_handler_t)
                                    on_timeout, animation);

  return true;
}
Example #3
0
ply_seat_t *
ply_seat_new (ply_terminal_t *terminal)
{
        ply_seat_t *seat;

        seat = calloc (1, sizeof(ply_seat_t));

        seat->loop = ply_event_loop_get_default ();
        seat->terminal = terminal;
        seat->text_displays = ply_list_new ();
        seat->pixel_displays = ply_list_new ();

        return seat;
}
Example #4
0
ply_terminal_t *
ply_terminal_new (const char *device_name)
{
    ply_terminal_t *terminal;

    assert (device_name != NULL);

    terminal = calloc (1, sizeof(ply_terminal_t));

    terminal->loop = ply_event_loop_get_default ();
    terminal->vt_change_closures = ply_list_new ();
    terminal->input_closures = ply_list_new ();

    if (strncmp (device_name, "/dev/", strlen ("/dev/")) == 0)
        terminal->name = strdup (device_name);
    else
        asprintf (&terminal->name, "/dev/%s", device_name);

    terminal->fd = -1;
    terminal->vt_number = -1;
    terminal->initial_vt_number = -1;

    return terminal;
}
Example #5
0
static ply_renderer_backend_t *
create_backend (const char *device_name,
                ply_terminal_t *terminal)
{
  ply_renderer_backend_t *backend;

  backend = calloc (1, sizeof (ply_renderer_backend_t));

  if (device_name != NULL)
    backend->device_name = strdup (device_name);
  else
    backend->device_name = strdup ("/dev/dri/card0");

  ply_trace ("creating renderer backend for device %s", backend->device_name);

  backend->device_fd = -1;

  backend->loop = ply_event_loop_get_default ();
  backend->heads = ply_list_new ();
  backend->input_source.key_buffer = ply_buffer_new ();
  backend->terminal = terminal;

  return backend;
}