dvtm

Fork of dvtm, a minimal terminal multiplexer
git clone git://git.laack.co/dvtm.git
Log | Files | Refs | README | LICENSE

vt.h (2312B)


      1 /*
      2  * Copyright © 2004 Bruno T. C. de Oliveira
      3  * Copyright © 2006 Pierre Habouzit
      4  * Copyright © 2008-2013 Marc André Tanner
      5  *
      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.
      9  *
     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.
     17  */
     18 #ifndef VT_H
     19 #define VT_H
     20 
     21 #include <curses.h>
     22 #include <stdbool.h>
     23 #include <sys/types.h>
     24 
     25 #ifndef NCURSES_MOUSE_VERSION
     26 #define mmask_t unsigned long
     27 #endif
     28 
     29 typedef struct Vt Vt;
     30 typedef void (*vt_title_handler_t)(Vt*, const char *title);
     31 typedef void (*vt_urgent_handler_t)(Vt*);
     32 
     33 void vt_init(void);
     34 void vt_shutdown(void);
     35 
     36 void vt_keytable_set(char const * const keytable_overlay[], int count);
     37 void vt_default_colors_set(Vt*, attr_t attrs, short fg, short bg);
     38 void vt_title_handler_set(Vt*, vt_title_handler_t);
     39 void vt_urgent_handler_set(Vt*, vt_urgent_handler_t);
     40 void vt_data_set(Vt*, void *);
     41 void *vt_data_get(Vt*);
     42 
     43 Vt *vt_create(int rows, int cols, int scroll_buf_sz);
     44 void vt_resize(Vt*, int rows, int cols);
     45 void vt_destroy(Vt*);
     46 pid_t vt_forkpty(Vt*, const char *p, const char *argv[], const char *cwd, const char *env[], int *to, int *from);
     47 int vt_pty_get(Vt*);
     48 bool vt_cursor_visible(Vt*);
     49 
     50 int vt_process(Vt *);
     51 void vt_keypress(Vt *, int keycode);
     52 ssize_t vt_write(Vt*, const char *buf, size_t len);
     53 void vt_mouse(Vt*, int x, int y, mmask_t mask);
     54 void vt_dirty(Vt*);
     55 void vt_draw(Vt*, WINDOW *win, int startrow, int startcol);
     56 short vt_color_get(Vt*, short fg, short bg);
     57 short vt_color_reserve(short fg, short bg);
     58 
     59 void vt_scroll(Vt*, int rows);
     60 void vt_noscroll(Vt*);
     61 
     62 pid_t vt_pid_get(Vt*);
     63 size_t vt_content_get(Vt*, char **s, bool colored);
     64 int vt_content_start(Vt*);
     65 int vt_content_end(Vt*);
     66 
     67 #endif /* VT_H */