+}
+
+
+
+extern void free_windb()
+{
+ char id;
+ while (0 != (id = get_next_win_id()))
+ {
+ struct Win * wc = get_win_by_id(id);
+ free(wc->title);
+ free_keybindings(wc->kb.kbs);
+ }
+ free(world.windb.ids);
+ world.windb.ids = NULL;
+ free(world.windb.wins);
+ world.windb.wins = NULL;
+ free(world.windb.order);
+ world.windb.order = NULL;
+}
+
+
+
+extern void winch_called(int signal)
+{
+ world.winch = 1;
+}
+
+
+
+extern void reset_windows_on_winch()
+{
+ endwin(); /* "[S]tandard way" to recalibrate ncurses post SIGWINCH, says */
+ refresh(); /* <http://invisible-island.net/ncurses/ncurses-intro.html>. */
+ char tmp_order[strlen(world.windb.order) + 1];
+ sprintf(tmp_order, "%s", world.windb.order);
+ uint8_t i;
+ char tmp_active = world.windb.active;
+ for (i = 0; i < strlen(tmp_order); toggle_window(tmp_order[i]), i++);
+ delwin(world.windb.v_screen);
+ make_v_screen_and_init_win_sizes();
+ for (i = 0; i < strlen(tmp_order); toggle_window(tmp_order[i]), i++);
+ world.windb.active = tmp_active;
+}
+
+
+
+extern void draw_all_wins()
+{
+ /* Empty everything before filling it a-new. */
+ erase();
+ wnoutrefresh(world.windb.t_screen);
+ werase(world.windb.v_screen);
+ if (world.windb.active)
+ {
+
+ /* Draw borders, wins. Order matters: corners should overwrite lines. */
+ draw_wins_borderlines(get_win_by_id(world.windb.order[0]));
+ draw_wins_bordercorners(get_win_by_id(world.windb.order[0]));
+ draw_wins(get_win_by_id(world.windb.order[0]));
+
+ /* Draw .v_screen scroll hints. */
+ struct yx_uint16 start;
+ start.y = 0;
+ start.x = world.windb.v_screen_offset;
+ char * cols_string = "columns";
+ if (world.windb.v_screen_offset > 0)
+ {
+ scroll_hint(world.windb.v_screen_size, '<',
+ world.windb.v_screen_offset + 1, cols_string, start);
+ }
+ uint16_t size_x = getmaxx(world.windb.v_screen);
+ uint16_t right_edge = world.windb.v_screen_offset
+ + world.windb.v_screen_size.x;
+ if (right_edge < size_x - 1)
+ {
+ scroll_hint(world.windb.v_screen_size, '>',
+ size_x - right_edge, cols_string, start);
+ }
+
+ /* Put .v_screen segment to be shown on .t_screen to .t_screen buffer.*/
+ pnoutrefresh(world.windb.v_screen, 0, world.windb.v_screen_offset, 0, 0,
+ world.windb.v_screen_size.y,
+ world.windb.v_screen_size.x - 1);