dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 140d93c547d6d4fcca26dd19ed2bc4fd3081e6c4
parent 3b084ae3bd9cc542bccd7e34ef17a3d51d213e77
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 16 Oct 2014 22:30:29 +0200

Use attr_t for curses attributes

Diffstat:
dvtm.c | 2+-
vt.c | 12++++++------
vt.h | 2+-
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dvtm.c b/dvtm.c @@ -447,7 +447,7 @@ static void applycolorrules(Client *c) { const ColorRule *r = colorrules; short fg = r->color->fg, bg = r->color->bg; - unsigned attrs = r->attrs; + attr_t attrs = r->attrs; for (unsigned int i = 1; i < countof(colorrules); i++) { r = &colorrules[i]; diff --git a/vt.c b/vt.c @@ -93,7 +93,7 @@ static char vt_term[32] = "dvtm"; typedef struct { wchar_t text; - uint16_t attr; + attr_t attr; short fg; short bg; } Cell; @@ -115,7 +115,7 @@ typedef struct { int scroll_above; int scroll_below; int rows, cols, maxcols; - unsigned curattrs, savattrs; + attr_t curattrs, savattrs; int curs_col, curs_srow, curs_scol; short curfg, curbg, savfg, savbg; } Buffer; @@ -124,7 +124,7 @@ struct Vt { Buffer buffer_normal; Buffer buffer_alternate; Buffer *buffer; - unsigned defattrs; + attr_t defattrs; short deffg, defbg; int pty; pid_t childpid; @@ -217,7 +217,7 @@ static void process_nonprinting(Vt *t, wchar_t wc); static void send_curs(Vt *t); __attribute__ ((const)) -static uint16_t build_attrs(unsigned curattrs) +static attr_t build_attrs(attr_t curattrs) { return ((curattrs & ~A_COLOR) | COLOR_PAIR(curattrs & 0xff)) >> NCURSES_ATTR_SHIFT; @@ -1192,7 +1192,7 @@ int vt_process(Vt *t) return 0; } -void vt_set_default_colors(Vt *t, unsigned attrs, short fg, short bg) +void vt_set_default_colors(Vt *t, attr_t attrs, short fg, short bg) { t->defattrs = attrs; t->deffg = fg; @@ -1411,7 +1411,7 @@ void vt_draw(Vt *t, WINDOW * win, int srow, int scol) cell->fg = t->deffg; if (cell->bg == -1) cell->bg = t->defbg; - wattrset(win, (attr_t) cell->attr << NCURSES_ATTR_SHIFT); + wattrset(win, cell->attr << NCURSES_ATTR_SHIFT); wcolor_set(win, vt_color_get(t, cell->fg, cell->bg), NULL); } diff --git a/vt.h b/vt.h @@ -66,7 +66,7 @@ void vt_set_escseq_handler(Vt *, vt_escseq_handler_t); void vt_set_event_handler(Vt *, vt_event_handler_t); void vt_set_data(Vt *, void *); void *vt_get_data(Vt *); -void vt_set_default_colors(Vt *, unsigned attrs, short fg, short bg); +void vt_set_default_colors(Vt *, attr_t attrs, short fg, short bg); Vt *vt_create(int rows, int cols, int scroll_buf_sz); void vt_resize(Vt *, int rows, int cols);