Merge branch 'terminology-1.1'

This commit is contained in:
Boris Faure 2017-08-28 21:42:17 +02:00
commit 13da2313d2
8 changed files with 34 additions and 35 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

@ -362,26 +362,24 @@ termio_title_get(const Evas_Object *obj)
{
Termio *sd = evas_object_smart_data_get(obj);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL);
if (sd->pty->prop.user_title)
return sd->pty->prop.user_title;
return sd->pty->prop.title;
}
void
termio_user_title_set(Evas_Object *obj, const char *title)
termio_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 (sd->pty->prop.title)
eina_stringshare_del(sd->pty->prop.title);
if (title)
len = strlen(title);
if (len)
{
sd->pty->prop.user_title = eina_stringshare_add_length(title, len);
sd->pty->prop.title = eina_stringshare_add_length(title, len);
}
if (sd->pty->cb.set_title.func)
sd->pty->cb.set_title.func(sd->pty->cb.set_title.data);
@ -5544,7 +5542,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 +6015,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 +6077,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,
@ -37,7 +39,7 @@ Eina_Bool termio_cwd_get(const Evas_Object *obj, char *buf, size_t size);
Evas_Object *termio_textgrid_get(const Evas_Object *obj);
Evas_Object *termio_win_get(const Evas_Object *obj);
const char *termio_title_get(const Evas_Object *obj);
void termio_user_title_set(Evas_Object *obj, const char *title);
void termio_title_set(Evas_Object *obj, const char *title);
const char *termio_icon_name_get(const Evas_Object *obj);
void termio_media_mute_set(Evas_Object *obj, Eina_Bool mute);
void termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize);

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;
@ -495,7 +496,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
arg0 = strrchr(args[0], '/');
if (!arg0) arg0 = args[0];
else arg0++;
ty->prop.title = eina_stringshare_add(arg0);
ty->prop.title = eina_stringshare_add(title? title : arg0);
ty->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (ty->fd < 0)
@ -732,7 +733,6 @@ termpty_free(Termpty *ty)
if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit);
if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd);
if (ty->prop.title) eina_stringshare_del(ty->prop.title);
if (ty->prop.user_title) eina_stringshare_del(ty->prop.user_title);
if (ty->prop.icon) eina_stringshare_del(ty->prop.icon);
if (ty->back)
{

View File

@ -84,7 +84,7 @@ struct _Termpty
} change, set_title, set_icon, cancel_sel, exited, bell, command;
} cb;
struct {
const char *title, *icon, *user_title;
const char *title, *icon;
} prop;
const char *cur_cmd;
Termcell *screen, *screen2;
@ -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

@ -1627,7 +1627,7 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
ty->prop.title = NULL;
ty->prop.icon = NULL;
}
if (ty->cb.set_title.func && !ty->prop.user_title)
if (ty->cb.set_title.func)
ty->cb.set_title.func(ty->cb.set_title.data);
if (ty->cb.set_icon.func) ty->cb.set_icon.func(ty->cb.set_icon.data);
}

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);
@ -3566,7 +3560,7 @@ _set_title_ok_cb(void *data,
if (!title || !strlen(title))
title = NULL;
termio_user_title_set(term->termio, title);
termio_title_set(term->termio, title);
evas_object_del(popup);
term_unref(term);
}
@ -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 *