diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-11-12 17:57:12 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-11-12 17:57:12 +0100 |
commit | dad436ba290143f130412d43f17e19f6ddd314c1 (patch) | |
tree | feb3d4c4382426e9f5baed9438fe38af84db3966 | |
parent | bc42e2607200139de190f38cf041c03393f44780 (diff) |
vte: add tsm_vte_get_def_attr() helper
This helper returns the current default attribute of the VTE object.
Compared to the def-attr of the screen it's immutable by the pty. It
should be used to draw borders and/or padding of your terminal or to
initialize the cells.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r-- | docs/libtsm.sym | 1 | ||||
-rw-r--r-- | src/libtsm.h | 1 | ||||
-rw-r--r-- | src/tsm_vte.c | 9 |
3 files changed, 11 insertions, 0 deletions
diff --git a/docs/libtsm.sym b/docs/libtsm.sym index 3593646..e5acf02 100644 --- a/docs/libtsm.sym +++ b/docs/libtsm.sym @@ -106,6 +106,7 @@ global: tsm_vte_unref; tsm_vte_set_palette; + tsm_vte_get_def_attr; tsm_vte_reset; tsm_vte_hard_reset; diff --git a/src/libtsm.h b/src/libtsm.h index 39dda26..d9f30cd 100644 --- a/src/libtsm.h +++ b/src/libtsm.h @@ -304,6 +304,7 @@ void tsm_vte_ref(struct tsm_vte *vte); void tsm_vte_unref(struct tsm_vte *vte); int tsm_vte_set_palette(struct tsm_vte *vte, const char *palette); +void tsm_vte_get_def_attr(struct tsm_vte *vte, struct tsm_screen_attr *out); void tsm_vte_reset(struct tsm_vte *vte); void tsm_vte_hard_reset(struct tsm_vte *vte); diff --git a/src/tsm_vte.c b/src/tsm_vte.c index 70d34d9..a410c40 100644 --- a/src/tsm_vte.c +++ b/src/tsm_vte.c @@ -460,6 +460,15 @@ int tsm_vte_set_palette(struct tsm_vte *vte, const char *palette) return 0; } +SHL_EXPORT +void tsm_vte_get_def_attr(struct tsm_vte *vte, struct tsm_screen_attr *out) +{ + if (!vte || !out) + return; + + memcpy(out, &vte->def_attr, sizeof(*out)); +} + /* * Write raw byte-stream to pty. * When writing data to the client we must make sure that we send the correct |