-static struct sysinfo_screen *sysinfo_screen_from_scr(struct nc_scr *scr)
-{
- struct sysinfo_screen *sysinfo_screen;
-
- assert(scr->sig == pb_sysinfo_screen_sig);
- sysinfo_screen = (struct sysinfo_screen *)
- ((char *)scr - (size_t)&((struct sysinfo_screen *)0)->scr);
- assert(sysinfo_screen->scr.sig == pb_sysinfo_screen_sig);
- return sysinfo_screen;
-}
-
-static void sysinfo_screen_draw(struct sysinfo_screen *screen)
-{
- int max_y, i;
-
- max_y = getmaxy(screen->scr.sub_ncw);
-
- max_y = min(max_y, screen->scroll_y + screen->n_lines);
-
- for (i = screen->scroll_y; i < max_y; i++)
- mvwaddstr(screen->scr.sub_ncw, i, 1, screen->lines[i]);
-
- wrefresh(screen->scr.sub_ncw);
-}
-
-static void sysinfo_screen_scroll(struct sysinfo_screen *screen, int key)
-{
- int win_lines = getmaxy(screen->scr.sub_ncw);
- int delta;
-
- if (key == KEY_UP)
- delta = -1;
- else if (key == KEY_DOWN)
- delta = 1;
- else
- return;
-
- if (screen->scroll_y + delta < 0)
- return;
- if (screen->scroll_y + delta + win_lines > screen->n_lines - 1)
- return;
-
- screen->scroll_y += delta;
- wscrl(screen->scr.sub_ncw, delta);
-
- if (delta > 0) {
- mvwaddstr(screen->scr.sub_ncw, win_lines - 1, 1,
- screen->lines[screen->scroll_y+win_lines-1]);
- } else if (delta < 0) {
- mvwaddstr(screen->scr.sub_ncw, 0, 1,
- screen->lines[screen->scroll_y]);
- }
-
- wrefresh(screen->scr.sub_ncw);
-}
-
-static void sysinfo_clear(struct sysinfo_screen *screen)
-{
- talloc_free(screen->lines);
- screen->n_lines = 0;
- screen->n_alloc_lines = 16;
- screen->lines = talloc_array(screen, char *, screen->n_alloc_lines);
-}