summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2013-06-16 22:32:50 +0200
committerBoris Faure <billiob@gmail.com>2013-09-26 21:18:27 +0200
commitef543aa753bc0540b1e32ce4f5c012863975a7fd (patch)
treeb81ea961c96d485a2879e18a424531c12773a77f
parent02e42a747b5e27da8f487452a136b904790d86f2 (diff)
have a config to choose whether to set TERM to xterm-256color
-rw-r--r--src/bin/config.c5
-rw-r--r--src/bin/config.h1
-rw-r--r--src/bin/options_behavior.c22
-rw-r--r--src/bin/termio.c3
-rw-r--r--src/bin/termio.h1
-rw-r--r--src/bin/termpty.c15
-rw-r--r--src/bin/termpty.h3
7 files changed, 43 insertions, 7 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index 34a9e0d..ecbd2c9 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -84,6 +84,8 @@ config_init(void)
84 EET_DATA_DESCRIPTOR_ADD_BASIC 84 EET_DATA_DESCRIPTOR_ADD_BASIC
85 (edd_base, Config, "multi_instance", multi_instance, EET_T_UCHAR); 85 (edd_base, Config, "multi_instance", multi_instance, EET_T_UCHAR);
86 EET_DATA_DESCRIPTOR_ADD_BASIC 86 EET_DATA_DESCRIPTOR_ADD_BASIC
87 (edd_base, Config, "xterm_256color", xterm_256color, EET_T_UCHAR);
88 EET_DATA_DESCRIPTOR_ADD_BASIC
87 (edd_base, Config, "custom_geometry", custom_geometry, EET_T_UCHAR); 89 (edd_base, Config, "custom_geometry", custom_geometry, EET_T_UCHAR);
88 EET_DATA_DESCRIPTOR_ADD_BASIC 90 EET_DATA_DESCRIPTOR_ADD_BASIC
89 (edd_base, Config, "cg_width", cg_width, EET_T_INT); 91 (edd_base, Config, "cg_width", cg_width, EET_T_INT);
@@ -176,6 +178,7 @@ config_sync(const Config *config_src, Config *config)
176 config->multi_instance = config_src->multi_instance; 178 config->multi_instance = config_src->multi_instance;
177 config->application_server = config_src->application_server; 179 config->application_server = config_src->application_server;
178 config->application_server_restore_views = config_src->application_server_restore_views; 180 config->application_server_restore_views = config_src->application_server_restore_views;
181 config->xterm_256color = config_src->xterm_256color;
179 config->temporary = config_src->temporary; 182 config->temporary = config_src->temporary;
180 config->custom_geometry = config_src->custom_geometry; 183 config->custom_geometry = config_src->custom_geometry;
181 config->cg_width = config_src->cg_width; 184 config->cg_width = config_src->cg_width;
@@ -434,6 +437,7 @@ config_load(const char *key)
434 config->multi_instance = EINA_FALSE; 437 config->multi_instance = EINA_FALSE;
435 config->application_server = EINA_FALSE; 438 config->application_server = EINA_FALSE;
436 config->application_server_restore_views = EINA_FALSE; 439 config->application_server_restore_views = EINA_FALSE;
440 config->xterm_256color = EINA_FALSE;
437 config->custom_geometry = EINA_FALSE; 441 config->custom_geometry = EINA_FALSE;
438 config->cg_width = 80; 442 config->cg_width = 80;
439 config->cg_height = 24; 443 config->cg_height = 24;
@@ -484,6 +488,7 @@ config_fork(Config *config)
484 CPY(multi_instance); 488 CPY(multi_instance);
485 CPY(application_server); 489 CPY(application_server);
486 CPY(application_server_restore_views); 490 CPY(application_server_restore_views);
491 CPY(xterm_256color);
487 CPY(custom_geometry); 492 CPY(custom_geometry);
488 CPY(cg_width); 493 CPY(cg_width);
489 CPY(cg_height); 494 CPY(cg_height);
diff --git a/src/bin/config.h b/src/bin/config.h
index 78446f5..29390a4 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -42,6 +42,7 @@ struct _Config
42 Eina_Bool multi_instance; 42 Eina_Bool multi_instance;
43 Eina_Bool application_server; 43 Eina_Bool application_server;
44 Eina_Bool application_server_restore_views; 44 Eina_Bool application_server_restore_views;
45 Eina_Bool xterm_256color;
45 Eina_Bool custom_geometry; 46 Eina_Bool custom_geometry;
46 Eina_Bool drag_links; 47 Eina_Bool drag_links;
47 int cg_width; 48 int cg_width;
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 47b39d0..5b54412 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -144,6 +144,16 @@ _cb_op_behavior_application_server_chg(void *data, Evas_Object *obj, void *event
144} 144}
145 145
146static void 146static void
147_cb_op_behavior_xterm_256color_chg(void *data, Evas_Object *obj,
148 void *event EINA_UNUSED)
149{
150 Evas_Object *term = data;
151 Config *config = termio_config_get(term);
152 config->xterm_256color = elm_check_state_get(obj);
153 config_save(config, NULL);
154}
155
156static void
147_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED) 157_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
148{ 158{
149 Evas_Object *term = data; 159 Evas_Object *term = data;
@@ -345,7 +355,17 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
345 evas_object_show(o); 355 evas_object_show(o);
346 evas_object_smart_callback_add(o, "changed", 356 evas_object_smart_callback_add(o, "changed",
347 _cb_op_behavior_multi_instance_chg, term); 357 _cb_op_behavior_multi_instance_chg, term);
348 358
359 o = elm_check_add(bx);
360 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
361 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
362 elm_object_text_set(o, "set TERM to xterm-256color");
363 elm_check_state_set(o, config->xterm_256color);
364 elm_box_pack_end(bx, o);
365 evas_object_show(o);
366 evas_object_smart_callback_add(o, "changed",
367 _cb_op_behavior_xterm_256color_chg, term);
368
349 o = elm_check_add(bx); 369 o = elm_check_add(bx);
350 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); 370 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
351 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); 371 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 41bcbfd..54bc60b 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -4172,7 +4172,8 @@ termio_add(Evas_Object *parent, Config *config, const char *cmd, Eina_Bool login
4172 _smart_cb_drop, obj); 4172 _smart_cb_drop, obj);
4173#endif 4173#endif
4174 4174
4175 sd->pty = termpty_new(cmd, login_shell, cd, w, h, config->scrollback); 4175 sd->pty = termpty_new(cmd, login_shell, cd, w, h, config->scrollback,
4176 config->xterm_256color);
4176 if (!sd->pty) 4177 if (!sd->pty)
4177 { 4178 {
4178 ERR("Cannot allocate termpty"); 4179 ERR("Cannot allocate termpty");
diff --git a/src/bin/termio.h b/src/bin/termio.h
index f6e82dc..934abf9 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -31,5 +31,6 @@ const char *termio_title_get(Evas_Object *obj);
31const char *termio_icon_name_get(Evas_Object *obj); 31const char *termio_icon_name_get(Evas_Object *obj);
32void termio_debugwhite_set(Evas_Object *obj, Eina_Bool dbg); 32void termio_debugwhite_set(Evas_Object *obj, Eina_Bool dbg);
33void termio_config_set(Evas_Object *obj, Config *config); 33void termio_config_set(Evas_Object *obj, Config *config);
34Config *termio_config_get(const Evas_Object *obj);
34 35
35#endif 36#endif
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index a3cdeb3..648a45d 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -267,7 +267,8 @@ _limit_coord(Termpty *ty, Termstate *state)
267} 267}
268 268
269Termpty * 269Termpty *
270termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h, int backscroll) 270termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
271 int w, int h, int backscroll, Eina_Bool xterm_256color)
271{ 272{
272 Termpty *ty; 273 Termpty *ty;
273 const char *pty; 274 const char *pty;
@@ -399,9 +400,15 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h
399 400
400 /* TODO: should we reset signals here? */ 401 /* TODO: should we reset signals here? */
401 402
402 // pretend to be xterm 403 /* pretend to be xterm */
403 putenv("TERM=xterm"); 404 if (xterm_256color)
404// putenv("TERM=xterm-256color"); 405 {
406 putenv("TERM=xterm-256color");
407 }
408 else
409 {
410 putenv("TERM=xterm");
411 }
405 putenv("XTERM_256_COLORS=1"); 412 putenv("XTERM_256_COLORS=1");
406 if (!login_shell) 413 if (!login_shell)
407 execvp(args[0], (char *const *)args); 414 execvp(args[0], (char *const *)args);
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index c0cd9fe..0f22ca4 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -191,7 +191,8 @@ struct _Termexp
191void termpty_init(void); 191void termpty_init(void);
192void termpty_shutdown(void); 192void termpty_shutdown(void);
193 193
194Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, int w, int h, int backscroll); 194Termpty *termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
195 int w, int h, int backscroll, Eina_Bool xterm_256color);
195void termpty_free(Termpty *ty); 196void termpty_free(Termpty *ty);
196void termpty_cellcomp_freeze(Termpty *ty); 197void termpty_cellcomp_freeze(Termpty *ty);
197void termpty_cellcomp_thaw(Termpty *ty); 198void termpty_cellcomp_thaw(Termpty *ty);