+ init_win_from_winconf(id);
+ }
+}
+
+
+
+extern void sorted_wintoggle_and_activate()
+{
+ char * f_name = "sorted_wintoggle_and_activate()";
+
+ char * path = "config/windows/toggle_order_and_active";
+ FILE * file = try_fopen(path, "r", f_name);
+ uint16_t linemax = get_linemax(file, f_name);
+ char win_order[linemax + 1];
+ try_fgets(win_order, linemax + 1, file, f_name);
+
+ uint8_t a = 0;
+ exit_trouble(read_uint8(file, &a), f_name, "read_uint8()");
+
+ try_fclose(file, f_name);
+
+ uint8_t i = 0;
+ for (; i < strlen(win_order) - 1; i++)
+ {
+ if (NULL == strchr(world.winconf_ids, win_order[i]))
+ {
+ continue;
+ }
+ toggle_window(win_order[i]);
+
+ if (a == (uint8_t) win_order[i])
+ {
+ world.wmeta->active = get_win_by_id(win_order[i]);
+ }
+ }
+}
+
+
+
+extern void save_win_configs()
+{
+ char * f_name = "save_win_configs()";
+
+ char id;
+ while (0 != (id = get_next_winconf_id()))
+ {
+ save_win_config(id);
+ }
+
+ char * path = "config/windows/toggle_order_and_active";
+ char * path_tmp = "config/windows/toggle_order_and_active_tmp";
+ FILE * file = try_fopen(path_tmp, "w", f_name);
+
+ char line[6];
+ struct Win * w_p = world.wmeta->chain_start;
+ uint8_t i = 0;
+ while (0 != w_p)
+ {
+ struct WinConf * wc = get_winconf_by_win(w_p);
+ line[i] = wc->id;
+ w_p = w_p->next;
+ i++;
+ }
+ line[i] = '\n';
+ try_fwrite(line, sizeof(char), strlen(line), file, f_name);
+ if (0 != world.wmeta->active)
+ {
+ struct WinConf * wc = get_winconf_by_win(world.wmeta->active);
+ write_uint8(wc->id, file);
+ }
+
+ try_fclose_unlink_rename(file, path_tmp, path, f_name);
+}
+
+
+
+extern void toggle_window(char id)
+{
+ struct Win * win = get_win_by_id(id);
+ if (0 == win->prev && world.wmeta->chain_start != win) /* Win struct is */
+ { /* outside chain. */
+ append_win(win);
+ }
+ else
+ {
+ suspend_win(win);
+ }
+}
+
+
+
+extern void toggle_winconfig()
+{
+ struct Win * win = world.wmeta->active;
+ struct WinConf * wcp = get_winconf_by_win(win);
+ if (0 == wcp->view)
+ {
+ win->draw = draw_winconf_geometry;
+ wcp->view = 1;
+ wcp->center = win->center;
+ win->center.y = 0;
+ win->center.x = 0;
+ }
+ else if (1 == wcp->view)
+ {
+ win->draw = draw_winconf_keybindings;
+ wcp->view = 2;
+ win->center.x = 0;
+ }
+ else
+ {
+ win->draw = get_drawfunc_by_char(wcp->draw);
+ win->center = wcp->center;
+ wcp->view = 0;
+ }
+}
+
+
+
+extern void toggle_win_height_type()
+{
+ struct Win * win = world.wmeta->active;
+ struct WinConf * wcp = get_winconf_by_win(win);
+ if (0 == wcp->height_type)
+ {
+ wcp->height_type = 1;
+ }
+ else
+ {
+ wcp->height_type = 0;
+ }
+ set_winconf_geometry(wcp->id);
+}
+
+
+
+extern void toggle_win_width_type()
+{
+ struct Win * win = world.wmeta->active;
+ struct WinConf * wcp = get_winconf_by_win(win);
+ if (0 == wcp->width_type && win->framesize.x <= world.wmeta->padsize.x)
+ {
+ wcp->width_type = 1;