summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-11-12 17:57:12 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-12 17:57:12 +0100
commitdad436ba290143f130412d43f17e19f6ddd314c1 (patch)
treefeb3d4c4382426e9f5baed9438fe38af84db3966
parentbc42e2607200139de190f38cf041c03393f44780 (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.sym1
-rw-r--r--src/libtsm.h1
-rw-r--r--src/tsm_vte.c9
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