aboutsummaryrefslogtreecommitdiff
path: root/vterm-module.h
blob: 25ea860ebdae0e35c05c3c862346208189582aa0 (plain)
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
37
38
39
40
41
42
43
#ifndef VTERM_MODULE_H
#define VTERM_MODULE_H

#include <emacs-module.h>
#include <inttypes.h>
#include <stdbool.h>
#include <vterm.h>

int plugin_is_GPL_compatible;

struct Term {
  VTerm *vt;
  int masterfd;
  pid_t pid;
  pthread_t thread;
};

static bool compare_cells(VTermScreenCell *a, VTermScreenCell *b);
static bool is_key(unsigned char *key, size_t len, char *key_description);

static int set_term_prop_cb(VTermProp prop, VTermValue *val, void *user_data);

static void term_redraw(struct Term *term, emacs_env *env);
static void term_flush_output(struct Term *term);
static void term_process_key(struct Term *term, unsigned char *key, size_t len,
                             VTermModifier modifier);
static void term_put_caret(struct Term *term, emacs_env *env, int row, int col,
                           int offset);
static void term_finalize(void *object);

static emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs,
                              emacs_value args[], void *data);
static emacs_value Fvterm_update(emacs_env *env, ptrdiff_t nargs,
                                 emacs_value args[], void *data);
static emacs_value Fvterm_kill(emacs_env *env, ptrdiff_t nargs,
                               emacs_value args[], void *data);
static emacs_value Fvterm_set_size(emacs_env *env, ptrdiff_t nargs,
                                   emacs_value args[], void *data);

static void *event_loop(void *arg);
int emacs_module_init(struct emacs_runtime *ert);

#endif /* VTERM_MODULE_H */