Cleanup vt_write
[dvtm.git] / vt.h
blobb15bf3d840a6b3ea93b3e1a10fe8e74f38b83703
1 /*
2 * Copyright © 2004 Bruno T. C. de Oliveira
3 * Copyright © 2006 Pierre Habouzit
4 * Copyright © 2008-2013 Marc André Tanner
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #ifndef VT_H
19 #define VT_H
21 #include <curses.h>
22 #include <stdbool.h>
23 #include <sys/types.h>
25 #ifndef NCURSES_MOUSE_VERSION
26 #define mmask_t unsigned long
27 #endif
29 typedef struct Vt Vt;
30 typedef void (*vt_title_handler_t)(Vt*, const char *data);
32 void vt_init(void);
33 void vt_shutdown(void);
35 void vt_keytable_set(char const * const keytable_overlay[], int count);
36 void vt_default_colors_set(Vt*, attr_t attrs, short fg, short bg);
37 void vt_title_handler_set(Vt*, vt_title_handler_t);
38 void vt_data_set(Vt*, void *);
39 void *vt_data_get(Vt*);
41 Vt *vt_create(int rows, int cols, int scroll_buf_sz);
42 void vt_resize(Vt*, int rows, int cols);
43 void vt_destroy(Vt*);
44 pid_t vt_forkpty(Vt*, const char *p, const char *argv[], const char *cwd, const char *env[], int *to, int *from);
45 int vt_pty_get(Vt*);
46 bool vt_cursor_visible(Vt*);
48 int vt_process(Vt *);
49 void vt_keypress(Vt *, int keycode);
50 ssize_t vt_write(Vt*, const char *buf, size_t len);
51 void vt_mouse(Vt*, int x, int y, mmask_t mask);
52 void vt_dirty(Vt*);
53 void vt_draw(Vt*, WINDOW *win, int startrow, int startcol);
54 short vt_color_get(Vt*, short fg, short bg);
55 short vt_color_reserve(short fg, short bg);
57 void vt_scroll(Vt*, int rows);
58 void vt_noscroll(Vt*);
60 void vt_bell(Vt*, bool bell);
61 void vt_togglebell(Vt*);
63 pid_t vt_pid_get(Vt*);
64 size_t vt_content_get(Vt*, char **s);
65 int vt_content_start(Vt*);
67 #endif /* VT_H */