aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-08-28 21:40:05 +0200
committerBoris Faure <billiob@gmail.com>2017-08-28 21:41:21 +0200
commit496a5f178e10c92ee84711546203ecc36416c68b (patch)
tree1eae142d6d402a4c0d8b6bd176f8d3a88c6c2d50
parentcorrectly handle -T option. Ref T5704 (diff)
downloadterminology-496a5f178e10c92ee84711546203ecc36416c68b.tar.gz
have only one concept of title. Ref https://phab.enlightenment.org/T5704
-rw-r--r--src/bin/termio.c11
-rw-r--r--src/bin/termio.h2
-rw-r--r--src/bin/termpty.c5
-rw-r--r--src/bin/termpty.h2
-rw-r--r--src/bin/termptyesc.c2
-rw-r--r--src/bin/win.c2
6 files changed, 9 insertions, 15 deletions
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 12d24dd..ca488b0 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -362,27 +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 = 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);
diff --git a/src/bin/termio.h b/src/bin/termio.h
index ea142c0..32eb459 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -39,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);
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 501dca5..3c86546 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -496,9 +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);
- if (title)
- ty->prop.user_title = eina_stringshare_add(title);
+ ty->prop.title = eina_stringshare_add(title? title : arg0);
ty->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (ty->fd < 0)
@@ -735,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)
{
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index bcd7397..6de8d79 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -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;
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index c71a893..f147f63 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -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);
}
diff --git a/src/bin/win.c b/src/bin/win.c
index dcfb82d..1b8315a 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -3560,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);
}