correctly handle -T option. Ref T5704

This commit is contained in:
Boris Faure 2017-08-28 21:36:48 +02:00
parent 61ce65c700
commit 38da9b2ded
7 changed files with 27 additions and 22 deletions

View File

@ -281,7 +281,8 @@ main_ipc_new(Ipc_Instance *inst)
if (inst->w <= 0) inst->w = 80;
if (inst->h <= 0) inst->h = 24;
term = term_new(wn, config, inst->cmd, inst->login_shell,
inst->cd, inst->w, inst->h, inst->hold);
inst->cd, inst->w, inst->h, inst->hold,
inst->title);
if (!term)
{
CRITICAL(_("Could not create terminal widget."));
@ -906,7 +907,7 @@ remote:
config = win_config_get(wn);
term = term_new(wn, config, cmd, login_shell, cd,
size_w, size_h, hold);
size_w, size_h, hold, title);
if (!term)
{
CRITICAL(_("Could not create terminal widget."));

View File

@ -371,13 +371,14 @@ void
termio_user_title_set(Evas_Object *obj, const char *title)
{
Termio *sd = evas_object_smart_data_get(obj);
size_t len;
size_t len = 0;
EINA_SAFETY_ON_NULL_RETURN(sd);
if (sd->pty->prop.user_title)
eina_stringshare_del(sd->pty->prop.user_title);
sd->pty->prop.user_title = NULL;
if (title)
len = strlen(title);
if (len)
{
@ -5544,7 +5545,6 @@ _smart_pty_title(void *data)
EINA_SAFETY_ON_NULL_RETURN(sd);
if (!sd->win) return;
evas_object_smart_callback_call(obj, "title,change", NULL);
// elm_win_title_set(sd->win, sd->pty->prop.title);
}
static void
@ -6018,7 +6018,7 @@ _smart_cb_drop(void *data,
Evas_Object *
termio_add(Evas_Object *win, Config *config,
const char *cmd, Eina_Bool login_shell, const char *cd,
int w, int h, Term *term)
int w, int h, Term *term, const char *title)
{
Evas *e;
Evas_Object *obj, *g;
@ -6080,7 +6080,8 @@ termio_add(Evas_Object *win, Config *config,
#endif
sd->pty = termpty_new(cmd, login_shell, cd, w, h, config->scrollback,
config->xterm_256color, config->erase_is_del, mod);
config->xterm_256color, config->erase_is_del, mod,
title);
if (!sd->pty)
{
ERR(_("Could not allocate termpty"));

View File

@ -7,7 +7,9 @@
#include "termpty.h"
#include "win.h"
Evas_Object *termio_add(Evas_Object *parent, Config *config, const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h, Term *term);
Evas_Object *termio_add(Evas_Object *parent, Config *config, const char *cmd,
Eina_Bool login_shell, const char *cd, int w, int h,
Term *term, const char *title);
void termio_win_set(Evas_Object *obj, Evas_Object *win);
void termio_theme_set(Evas_Object *obj, Evas_Object *theme);
char *termio_selection_get(const Evas_Object *obj,

View File

@ -410,7 +410,8 @@ _is_shell_valid(const char *cmd)
Termpty *
termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
int w, int h, int backscroll, Eina_Bool xterm_256color,
Eina_Bool erase_is_del, const char *emotion_mod)
Eina_Bool erase_is_del, const char *emotion_mod,
const char *title)
{
Termpty *ty;
const char *pty;
@ -496,6 +497,8 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
if (!arg0) arg0 = args[0];
else arg0++;
ty->prop.title = eina_stringshare_add(arg0);
if (title)
ty->prop.user_title = eina_stringshare_add(title);
ty->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (ty->fd < 0)

View File

@ -227,7 +227,8 @@ void termpty_shutdown(void);
Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
int w, int h, int backscroll, Eina_Bool xterm_256color,
Eina_Bool erase_is_del, const char *emotion_mod);
Eina_Bool erase_is_del, const char *emotion_mod,
const char *title);
void termpty_free(Termpty *ty);
void termpty_backlog_lock(void);

View File

@ -161,7 +161,6 @@ struct _Win
Ecore_Timer *cmdbox_focus_timer;
unsigned char focused : 1;
unsigned char cmdbox_up : 1;
unsigned char forced_title : 1;
};
/* }}} */
@ -1004,9 +1003,6 @@ _win_set_title(Term_Container *tc,
wn = (Win*) tc;
if (wn->forced_title)
return;
eina_stringshare_del(tc->title);
tc->title = eina_stringshare_ref(title);
@ -1070,7 +1066,7 @@ _win_split(Term_Container *tc, Term_Container *child,
}
tm_new = term_new(wn, wn->config,
cmd, wn->config->login_shell, wdir,
80, 24, EINA_FALSE);
80, 24, EINA_FALSE, NULL);
tc_solo_new = _solo_new(tm_new, wn);
evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio);
@ -1146,8 +1142,6 @@ win_new(const char *name, const char *role, const char *title,
tc->type = TERM_CONTAINER_TYPE_WIN;
tc->wn = wn;
wn->forced_title = (title != NULL);
config_default_font_set(config, evas_object_evas_get(wn->win));
wn->config = config_fork(config);
@ -1638,7 +1632,7 @@ _split_split(Term_Container *tc, Term_Container *child,
}
tm_new = term_new(wn, wn->config,
cmd, wn->config->login_shell, wdir,
80, 24, EINA_FALSE);
80, 24, EINA_FALSE, NULL);
tc_solo_new = _solo_new(tm_new, wn);
evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio);
@ -2620,7 +2614,7 @@ _tab_new_cb(void *data,
tm_new = term_new(wn, wn->config,
NULL, wn->config->login_shell, wdir,
80, 24, EINA_FALSE);
80, 24, EINA_FALSE, NULL);
tc_new = _solo_new(tm_new, wn);
evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio);
@ -4490,7 +4484,8 @@ term_unref(Term *term)
Term *
term_new(Win *wn, Config *config, const char *cmd,
Eina_Bool login_shell, const char *cd,
int size_w, int size_h, Eina_Bool hold)
int size_w, int size_h, Eina_Bool hold,
const char *title)
{
Term *term;
Evas_Object *o;
@ -4558,7 +4553,7 @@ term_new(Win *wn, Config *config, const char *cmd,
edje_object_message_send(term->base, EDJE_MESSAGE_INT, 1, &msg);
term->termio = o = termio_add(wn->win, config, cmd, login_shell, cd,
size_w, size_h, term);
size_w, size_h, term, title);
evas_object_data_set(o, "term", term);
colors_term_init(termio_textgrid_get(term->termio), term->bg, config);

View File

@ -32,7 +32,9 @@ void win_free(Win *wn);
void windows_free(void);
void windows_update(void);
Term *term_new(Win *wn, Config *config, const char *cmd, Eina_Bool login_shell, const char *cd, int size_w, int size_h, Eina_Bool hold);
Term *term_new(Win *wn, Config *config, const char *cmd,
Eina_Bool login_shell, const char *cd, int size_w, int size_h,
Eina_Bool hold, const char *title);
int win_term_set(Win *wn, Term *term);
Eina_List *