aboutsummaryrefslogtreecommitdiffstats
path: root/term.c
blob: d3345d92fe7c81ccf13f60502743e0fcae05fb86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <cairo.h>
#include <stdlib.h>

#include "runes.h"

RunesTerm *runes_term_create()
{
    RunesTerm *t;

    t = malloc(sizeof(RunesTerm));

    t->w       = runes_window_create();
    t->surface = runes_surface_create(t->w);
    t->cr      = cairo_create(t->surface);
    t->loop    = runes_loop_create(t);

    return t;
}

uv_loop_t *runes_loop_create(RunesTerm *t)
{
    uv_loop_t *loop;

    loop = uv_default_loop();
    runes_loop_init(t, loop);
    return loop;
}

void runes_term_destroy(RunesTerm *t)
{
    cairo_destroy(t->cr);
    cairo_surface_destroy(t->surface);
    runes_window_destroy(t->w);

    free(t);
}