2012-06-12 03:10:01 -07:00
|
|
|
typedef struct _Termpty Termpty;
|
|
|
|
typedef struct _Termcell Termcell;
|
|
|
|
typedef struct _Termatt Termatt;
|
|
|
|
typedef struct _Termstate Termstate;
|
|
|
|
typedef struct _Termsave Termsave;
|
|
|
|
|
|
|
|
#define COL_DEF 0
|
|
|
|
#define COL_BLACK 1
|
|
|
|
#define COL_RED 2
|
|
|
|
#define COL_GREEN 3
|
|
|
|
#define COL_YELLOW 4
|
|
|
|
#define COL_BLUE 5
|
|
|
|
#define COL_MAGENTA 6
|
|
|
|
#define COL_CYAN 7
|
|
|
|
#define COL_WHITE 8
|
2012-06-15 22:07:33 -07:00
|
|
|
#define COL_INVIS 9
|
2012-06-12 03:10:01 -07:00
|
|
|
|
2012-06-15 22:07:33 -07:00
|
|
|
#define COL_INVERSE 10
|
|
|
|
#define COL_INVERSEBG 11
|
2012-06-12 03:10:01 -07:00
|
|
|
|
2012-10-04 16:19:17 -07:00
|
|
|
#define MOUSE_OFF 0
|
|
|
|
#define MOUSE_X10 1
|
|
|
|
#define MOUSE_NORMAL 2
|
|
|
|
#define MOUSE_UTF8 3
|
|
|
|
#define MOUSE_SGR 4
|
|
|
|
#define MOUSE_URXVT 5
|
|
|
|
#define MOUSE_NORMAL_BTN_MOVE 6
|
2012-06-22 23:43:02 -07:00
|
|
|
|
2012-06-25 18:38:13 -07:00
|
|
|
// choose - italic OR double-width support
|
|
|
|
|
|
|
|
//#define SUPPORT_ITALIC 1
|
|
|
|
#define SUPPORT_DBLWIDTH 1
|
|
|
|
|
2012-06-12 03:10:01 -07:00
|
|
|
struct _Termatt
|
|
|
|
{
|
|
|
|
unsigned char fg, bg;
|
|
|
|
unsigned short bold : 1;
|
|
|
|
unsigned short faint : 1;
|
2012-06-25 18:38:13 -07:00
|
|
|
#if defined(SUPPORT_ITALIC)
|
2012-06-12 03:10:01 -07:00
|
|
|
unsigned short italic : 1;
|
2012-06-25 18:38:13 -07:00
|
|
|
#elif defined(SUPPORT_DBLWIDTH)
|
|
|
|
unsigned short dblwidth : 1;
|
|
|
|
#endif
|
2012-06-12 03:10:01 -07:00
|
|
|
unsigned short underline : 1;
|
2012-06-25 18:38:13 -07:00
|
|
|
unsigned short blink : 1; // don't intend to support this currently
|
|
|
|
unsigned short blink2 : 1; // don't intend to support this currently
|
2012-06-12 03:10:01 -07:00
|
|
|
unsigned short inverse : 1;
|
|
|
|
unsigned short invisible : 1;
|
|
|
|
unsigned short strike : 1;
|
|
|
|
unsigned short fg256 : 1;
|
|
|
|
unsigned short bg256 : 1;
|
2012-06-18 06:59:09 -07:00
|
|
|
unsigned short fgintense : 1;
|
|
|
|
unsigned short bgintense : 1;
|
2012-06-12 03:10:01 -07:00
|
|
|
// below used for working out text from selections
|
|
|
|
unsigned short autowrapped : 1;
|
|
|
|
unsigned short newline : 1;
|
|
|
|
unsigned short tab : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Termstate
|
|
|
|
{
|
|
|
|
int cx, cy;
|
|
|
|
Termatt att;
|
|
|
|
unsigned char charset;
|
|
|
|
unsigned char charsetch;
|
|
|
|
unsigned char chset[4];
|
|
|
|
int scroll_y1, scroll_y2;
|
|
|
|
int had_cr_x, had_cr_y;
|
|
|
|
unsigned int multibyte : 1;
|
|
|
|
unsigned int alt_kp : 1;
|
|
|
|
unsigned int insert : 1;
|
|
|
|
unsigned int appcursor : 1;
|
|
|
|
unsigned int wrap : 1;
|
|
|
|
unsigned int wrapnext : 1;
|
|
|
|
unsigned int hidecursor : 1;
|
|
|
|
unsigned int crlf : 1;
|
|
|
|
unsigned int had_cr : 1;
|
2012-06-22 23:43:02 -07:00
|
|
|
unsigned int send_bs : 1;
|
|
|
|
unsigned int kbd_lock : 1;
|
|
|
|
unsigned int reverse : 1;
|
|
|
|
unsigned int no_autorepeat : 1;
|
2012-06-25 18:38:13 -07:00
|
|
|
unsigned int cjk_ambiguous_wide : 1;
|
2012-06-12 03:10:01 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Termpty
|
|
|
|
{
|
|
|
|
Ecore_Event_Handler *hand_exe_exit;
|
|
|
|
Ecore_Fd_Handler *hand_fd;
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
void (*func) (void *data);
|
|
|
|
void *data;
|
2012-06-30 17:24:30 -07:00
|
|
|
} change, scroll, set_title, set_icon, cancel_sel, exited, bell, command;
|
2012-06-12 03:10:01 -07:00
|
|
|
} cb;
|
|
|
|
struct {
|
|
|
|
const char *title;
|
|
|
|
const char *icon;
|
|
|
|
} prop;
|
|
|
|
int w, h;
|
|
|
|
int fd, slavefd;
|
|
|
|
pid_t pid;
|
2012-06-30 17:24:30 -07:00
|
|
|
const char *cur_cmd;
|
2012-06-12 03:10:01 -07:00
|
|
|
Termcell *screen, *screen2;
|
|
|
|
Termsave **back;
|
|
|
|
int backmax, backpos;
|
|
|
|
int backscroll_num;
|
|
|
|
int *buf;
|
|
|
|
int buflen;
|
|
|
|
Termstate state, save, swap;
|
2012-06-20 07:12:26 -07:00
|
|
|
int exit_code;
|
2012-06-12 03:10:01 -07:00
|
|
|
unsigned int altbuf : 1;
|
2012-07-02 01:58:49 -07:00
|
|
|
unsigned int mouse_rep : 3;
|
2012-06-12 03:10:01 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Termcell
|
|
|
|
{
|
2012-06-25 18:38:13 -07:00
|
|
|
int codepoint;
|
2012-06-12 03:10:01 -07:00
|
|
|
Termatt att;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Termsave
|
|
|
|
{
|
|
|
|
int w;
|
|
|
|
Termcell cell[1];
|
|
|
|
};
|
|
|
|
|
2012-06-19 12:53:02 -07:00
|
|
|
void termpty_init(void);
|
|
|
|
void termpty_shutdown(void);
|
|
|
|
|
2012-09-27 02:33:33 -07:00
|
|
|
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h, int backscroll);
|
2012-06-12 03:10:01 -07:00
|
|
|
void termpty_free(Termpty *ty);
|
|
|
|
Termcell *termpty_cellrow_get(Termpty *ty, int y, int *wret);
|
|
|
|
void termpty_write(Termpty *ty, const char *input, int len);
|
|
|
|
void termpty_resize(Termpty *ty, int w, int h);
|
2012-06-16 10:31:54 -07:00
|
|
|
void termpty_backscroll_set(Termpty *ty, int size);
|
2012-07-13 01:46:33 -07:00
|
|
|
|
|
|
|
extern int _termpty_log_dom;
|