+ mvaddstr(win->curses_win->_begy - 1, win->curses_win->_begx + title_offset, title); }
+ refresh(); }
+
+void draw_windows_borders (struct Win * win, struct Win * win_active, struct Corners * corners, int ccount) {
+// Craw draw_window_borders() for all windows in chain from win on. Save current window's border corners.
+ char active = 0;
+ if (win == win_active)
+ active = 1;
+ draw_window_borders(win, active);
+ corners[ccount].tl.y = win->curses_win->_begy - 1;
+ corners[ccount].tl.x = win->curses_win->_begx - 1;
+ corners[ccount].tr.y = win->curses_win->_begy - 1;
+ corners[ccount].tr.x = win->curses_win->_begx + win->width;
+ corners[ccount].bl.y = win->curses_win->_begy + win->height;
+ corners[ccount].bl.x = win->curses_win->_begx - 1;
+ corners[ccount].br.y = win->curses_win->_begy + win->height;
+ corners[ccount].br.x = win->curses_win->_begx + win->width;
+ if (0 != win->next) {
+ draw_windows_borders (win->next, win_active, corners, ccount + 1); } }
+
+void draw_windows (struct Win * win) {
+// Draw contents of all windows in window chain from win on.
+ draw_window(win);
+ if (0 != win->next) {
+ draw_windows (win->next); } }
+
+void draw_all_windows (struct WinMeta * win_meta) {
+// Draw all windows and their borders.
+ clear();
+ if (win_meta->chain_start) {
+ int n_wins = 1;
+ struct Win * win_p = win_meta->chain_start;
+ while (0 != win_p->next) {
+ win_p = win_p->next;
+ n_wins++; }
+ struct Corners * all_corners = malloc(sizeof(struct Corners) * n_wins);
+ draw_windows_borders (win_meta->chain_start, win_meta->active, all_corners, 0);
+ draw_windows (win_meta->chain_start);
+ int i;
+ for (i = 0; i < n_wins; i++) {
+ mvaddch(all_corners[i].tl.y, all_corners[i].tl.x, '+');
+ mvaddch(all_corners[i].tr.y, all_corners[i].tr.x, '+');
+ mvaddch(all_corners[i].bl.y, all_corners[i].bl.x, '+');
+ mvaddch(all_corners[i].br.y, all_corners[i].br.x, '+'); }
+ free(all_corners); } }
+
+void draw_window(struct Win * win) {
+// Draw window content if visible.