termpty: attach a Config * to Termpty
This commit is contained in:
parent
7cc1197a53
commit
7b3110d4a2
|
@ -120,7 +120,7 @@ keyin_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Config *cfg = termpty_config_get(ty);
|
const Config *cfg = ty->config;
|
||||||
|
|
||||||
if (cfg->erase_is_del && !ctrl)
|
if (cfg->erase_is_del && !ctrl)
|
||||||
{
|
{
|
||||||
|
|
|
@ -423,7 +423,7 @@ termio_config_update(Evas_Object *obj)
|
||||||
sd->jump_on_change = sd->config->jump_on_change;
|
sd->jump_on_change = sd->config->jump_on_change;
|
||||||
sd->jump_on_keypress = sd->config->jump_on_keypress;
|
sd->jump_on_keypress = sd->config->jump_on_keypress;
|
||||||
|
|
||||||
termpty_backlog_size_set(sd->pty, sd->config->scrollback);
|
termpty_config_update(sd->pty, sd->config);
|
||||||
sd->scroll = 0;
|
sd->scroll = 0;
|
||||||
|
|
||||||
colors_term_init(sd->grid.obj, sd->theme, sd->config);
|
colors_term_init(sd->grid.obj, sd->theme, sd->config);
|
||||||
|
@ -3981,9 +3981,8 @@ termio_add(Evas_Object *win, Config *config,
|
||||||
_smart_cb_drop, obj);
|
_smart_cb_drop, obj);
|
||||||
|
|
||||||
window_id = elm_win_window_id_get(win);
|
window_id = elm_win_window_id_get(win);
|
||||||
sd->pty = termpty_new(cmd, login_shell, cd, w, h, config->scrollback,
|
sd->pty = termpty_new(cmd, login_shell, cd, w, h, config, mod, title,
|
||||||
config->xterm_256color, config->erase_is_del, mod,
|
window_id);
|
||||||
title, window_id);
|
|
||||||
if (!sd->pty)
|
if (!sd->pty)
|
||||||
{
|
{
|
||||||
ERR(_("Could not allocate termpty"));
|
ERR(_("Could not allocate termpty"));
|
||||||
|
|
|
@ -479,8 +479,7 @@ _is_shell_valid(const char *cmd)
|
||||||
|
|
||||||
Termpty *
|
Termpty *
|
||||||
termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
int w, int h, int backscroll, Eina_Bool xterm_256color,
|
int w, int h, Config *config, const char *emotion_mod,
|
||||||
Eina_Bool erase_is_del, const char *emotion_mod,
|
|
||||||
const char *title, Ecore_Window window_id)
|
const char *title, Ecore_Window window_id)
|
||||||
{
|
{
|
||||||
Termpty *ty;
|
Termpty *ty;
|
||||||
|
@ -494,9 +493,10 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
|
|
||||||
ty = calloc(1, sizeof(Termpty));
|
ty = calloc(1, sizeof(Termpty));
|
||||||
if (!ty) return NULL;
|
if (!ty) return NULL;
|
||||||
|
ty->config = config;
|
||||||
ty->w = w;
|
ty->w = w;
|
||||||
ty->h = h;
|
ty->h = h;
|
||||||
ty->backsize = backscroll;
|
ty->backsize = config->scrollback;
|
||||||
|
|
||||||
ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h);
|
ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h);
|
||||||
if (!ty->screen)
|
if (!ty->screen)
|
||||||
|
@ -629,7 +629,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
ERR("unable to tcgetattr: %s", strerror(errno));
|
ERR("unable to tcgetattr: %s", strerror(errno));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
t.c_cc[VERASE] = (erase_is_del) ? 0x7f : 0x8;
|
t.c_cc[VERASE] = (config->erase_is_del) ? 0x7f : 0x8;
|
||||||
#ifdef IUTF8
|
#ifdef IUTF8
|
||||||
t.c_iflag |= IUTF8;
|
t.c_iflag |= IUTF8;
|
||||||
#endif
|
#endif
|
||||||
|
@ -709,7 +709,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
unsetenv("LINES");
|
unsetenv("LINES");
|
||||||
|
|
||||||
/* pretend to be xterm */
|
/* pretend to be xterm */
|
||||||
if (xterm_256color)
|
if (config->xterm_256color)
|
||||||
{
|
{
|
||||||
putenv("TERM=xterm-256color");
|
putenv("TERM=xterm-256color");
|
||||||
}
|
}
|
||||||
|
@ -849,6 +849,13 @@ termpty_free(Termpty *ty)
|
||||||
free(ty);
|
free(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
termpty_config_update(Termpty *ty, Config *config)
|
||||||
|
{
|
||||||
|
ty->config = config;
|
||||||
|
termpty_backlog_size_set(ty, config->scrollback);
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_termpty_cell_is_empty(const Termcell *cell)
|
_termpty_cell_is_empty(const Termcell *cell)
|
||||||
{
|
{
|
||||||
|
@ -1734,12 +1741,6 @@ termpty_cell_codepoint_att_fill(Termpty *ty, Eina_Unicode codepoint,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Config *
|
|
||||||
termpty_config_get(const Termpty *ty)
|
|
||||||
{
|
|
||||||
return termio_config_get(ty->obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 0 means error here */
|
/* 0 means error here */
|
||||||
static uint16_t
|
static uint16_t
|
||||||
_find_empty_slot(const Termpty *ty)
|
_find_empty_slot(const Termpty *ty)
|
||||||
|
|
|
@ -131,6 +131,7 @@ typedef struct _Term_Cursor {
|
||||||
struct _Termpty
|
struct _Termpty
|
||||||
{
|
{
|
||||||
Evas_Object *obj;
|
Evas_Object *obj;
|
||||||
|
Config *config;
|
||||||
Ecore_Event_Handler *hand_exe_exit;
|
Ecore_Event_Handler *hand_exe_exit;
|
||||||
Ecore_Fd_Handler *hand_fd;
|
Ecore_Fd_Handler *hand_fd;
|
||||||
struct {
|
struct {
|
||||||
|
@ -273,10 +274,10 @@ void termpty_init(void);
|
||||||
void termpty_shutdown(void);
|
void termpty_shutdown(void);
|
||||||
|
|
||||||
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
|
||||||
int w, int h, int backscroll, Eina_Bool xterm_256color,
|
int w, int h, Config *config, const char *emotion_mod,
|
||||||
Eina_Bool erase_is_del, const char *emotion_mod,
|
const char *title, Ecore_Window window_id);
|
||||||
const char *title, Ecore_Window window_id);
|
|
||||||
void termpty_free(Termpty *ty);
|
void termpty_free(Termpty *ty);
|
||||||
|
void termpty_config_update(Termpty *ty, Config *config);
|
||||||
|
|
||||||
void termpty_backlog_lock(void);
|
void termpty_backlog_lock(void);
|
||||||
void termpty_backlog_unlock(void);
|
void termpty_backlog_unlock(void);
|
||||||
|
@ -307,7 +308,6 @@ void termpty_screen_swap(Termpty *ty);
|
||||||
|
|
||||||
ssize_t termpty_line_length(const Termcell *cells, ssize_t nb_cells);
|
ssize_t termpty_line_length(const Termcell *cells, ssize_t nb_cells);
|
||||||
|
|
||||||
Config *termpty_config_get(const Termpty *ty);
|
|
||||||
void termpty_handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len);
|
void termpty_handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len);
|
||||||
void termpty_handle_block_codepoint_overwrite_heavy(Termpty *ty, int oldc, int newc);
|
void termpty_handle_block_codepoint_overwrite_heavy(Termpty *ty, int oldc, int newc);
|
||||||
|
|
||||||
|
|
|
@ -250,9 +250,10 @@ termpty_color_class_get(Termpty *ty EINA_UNUSED, const char *key,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_termpty_init(Termpty *ty)
|
_termpty_init(Termpty *ty, Config *config)
|
||||||
{
|
{
|
||||||
memset(ty, '\0', sizeof(*ty));
|
memset(ty, '\0', sizeof(*ty));
|
||||||
|
ty->config = config;
|
||||||
ty->w = TY_W;
|
ty->w = TY_W;
|
||||||
ty->h = TY_H;
|
ty->h = TY_H;
|
||||||
ty->backsize = TY_BACKSIZE;
|
ty->backsize = TY_BACKSIZE;
|
||||||
|
@ -312,7 +313,7 @@ main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||||
_config = config_new();
|
_config = config_new();
|
||||||
_sd.config = _config;
|
_sd.config = _config;
|
||||||
|
|
||||||
_termpty_init(&_ty);
|
_termpty_init(&_ty, _config);
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue