diff options
author | toni <matzeton@googlemail.com> | 2014-12-07 03:20:34 +0100 |
---|---|---|
committer | toni <matzeton@googlemail.com> | 2014-12-07 20:39:45 +0100 |
commit | f365c0c482ab20a13af6155890c1784227559b6f (patch) | |
tree | 0bfe4edb59dd699a84e975d4c9cb8007892e7fb3 /ui_ani.c | |
parent | e3ec8f9259d132eec7071343931fd26733d1dd64 (diff) | |
parent | fc17c62cd6872ad16b2f87857f346c3da66cd4a2 (diff) |
Merge branch 'master' of github.com:freecoding/naskpass
Diffstat (limited to 'ui_ani.c')
-rw-r--r-- | ui_ani.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -3,17 +3,18 @@ #include "ui.h" #include "ui_ani.h" -#define ANIC_INITSTATE '\0' +#define ANIC_INITSTATE '|' struct anic * -init_anic(unsigned int x, unsigned int y) +init_anic(unsigned int x, unsigned int y, chtype attrs) { struct anic *a = calloc(1, sizeof(struct anic)); a->x = x; a->y = y; a->state = ANIC_INITSTATE; + a->attrs = attrs; return (a); } @@ -24,30 +25,34 @@ free_anic(struct anic *a) } int -anic_cb(WINDOW *win, void *data, bool needs_update) +anic_cb(WINDOW *win, void *data, bool needs_update, bool timed_out) { struct anic *a = (struct anic *) data; if (a == NULL) return (UICB_ERR_UNDEF); - switch (a->state) { - default: - case '|': a->state = '/'; break; - case '/': a->state = '-'; break; - case '-': a->state = '\\'; break; - case '\\': a->state = '|'; break; + if (timed_out == true) { + switch (a->state) { + default: + case '|': a->state = '/'; break; + case '/': a->state = '-'; break; + case '-': a->state = '\\'; break; + case '\\': a->state = '|'; break; + } } if (needs_update == true) { + attron(a->attrs); if (win != NULL) { mvwaddch(win, a->y, a->x, a->state); } else { mvaddch(a->y, a->x, a->state); } + attroff(a->attrs); } else return (UICB_ERR_NOP); return (UICB_OK); } void -register_anic(struct anic *a, chtype attr) +register_anic(struct anic *a) { - register_ui_elt(anic_cb, NULL, (void *) a, NULL, attr); + register_ui_elt(anic_cb, (void *) a, NULL); } |