aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-08-28 21:36:48 +0200
committerBoris Faure <billiob@gmail.com>2017-08-28 21:41:10 +0200
commit38da9b2ded12f511025d8958d76570aa6845ad9c (patch)
tree9badaa78c4ba94f179ad2226f56aa5cdd135a172
parentforce user title one window when set through -T option. Closes T5704 (diff)
downloadterminology-38da9b2ded12f511025d8958d76570aa6845ad9c.tar.gz
correctly handle -T option. Ref https://phab.enlightenment.org/T5704
-rw-r--r--src/bin/main.c5
-rw-r--r--src/bin/termio.c11
-rw-r--r--src/bin/termio.h4
-rw-r--r--src/bin/termpty.c5
-rw-r--r--src/bin/termpty.h3
-rw-r--r--src/bin/win.c17
-rw-r--r--src/bin/win.h4
7 files changed, 27 insertions, 22 deletions
diff --git a/src/bin/main.c b/src/bin/main.c
index 6980f36..846b3b3 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -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."));
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 2a12a02..12d24dd 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -371,14 +371,15 @@ 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;
- len = strlen(title);
+ if (title)
+ len = strlen(title);
if (len)
{
sd->pty->prop.user_title = eina_stringshare_add_length(title, 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"));
diff --git a/src/bin/termio.h b/src/bin/termio.h
index 049e389..ea142c0 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -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,
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 1efc594..501dca5 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -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)
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 5ef8f93..bcd7397 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -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);
diff --git a/src/bin/win.c b/src/bin/win.c
index c2c2bfd..dcfb82d 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -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);
diff --git a/src/bin/win.h b/src/bin/win.h
index b44fb25..ef9f311 100644
--- a/src/bin/win.h
+++ b/src/bin/win.h
@@ -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 *