+static struct Win * get_win_after(char c)
+{
+ return get_win_by_id(world.winDB.order[get_pos_in_order(c) + 1]);
+}
+
+
+
+static struct Win * get_win_before(char c)
+{
+ uint8_t i = get_pos_in_order(c);
+ if (i > 0)
+ {
+ return get_win_by_id(world.winDB.order[i - 1]);
+ }
+ return NULL;
+}
+
+
+
+static void init_win_size_from_winconf_and_v_screen_size(char id)
+{
+ struct Win * w = get_win_by_id(id);
+ w->frame_size.y = world.winDB.v_screen_size.y - 1;
+ if ( 0 < w->target_height
+ && w->target_height <= world.winDB.v_screen_size.y - 1)
+ {
+ w->frame_size.y = w->target_height;
+ }
+ else if ( 0 > w->target_height
+ && world.winDB.v_screen_size.y + (w->target_height - 1) > 0)
+ {
+ w->frame_size.y = world.winDB.v_screen_size.y + (w->target_height - 1);
+ }
+ w->frame_size.x = world.winDB.v_screen_size.x;
+ if (0 < w->target_width)
+ {
+ w->frame_size.x = w->target_width;
+ }
+ else if ( 0 > w->target_width
+ && world.winDB.v_screen_size.x + w->target_width > 0)
+ {
+ w->frame_size.x = world.winDB.v_screen_size.x + w->target_width;
+ }
+}
+
+
+
+static uint8_t match_func(char c, void (** f) (), char c_m, void (* f_m) ())
+{
+ if (c == c_m)
+ {
+ * f = f_m;
+ return 1;
+ }
+ return 0;
+}
+
+
+
+static void * get_drawfunc_by_char(char c)
+{
+ void (* f) (struct Win *) = NULL;
+ if ( match_func(c, &f, 'c', draw_win_inventory)
+ || match_func(c, &f, 'i', draw_win_info)
+ || match_func(c, &f, 'l', draw_win_log)
+ || match_func(c, &f, 'k', draw_win_available_keybindings)
+ || match_func(c, &f, 'm', draw_win_map)
+ || match_func(c, &f, '0', draw_win_keybindings_global)
+ || match_func(c, &f, '1', draw_win_keybindings_winconf_geometry)
+ || match_func(c, &f, '2', draw_win_keybindings_winconf_keybindings));
+ return f;
+}
+
+
+
+static void set_win_target_size(struct Win * wcp)
+{
+ if (0 == wcp->target_height_type)
+ {
+ wcp->target_height = wcp->frame_size.y;
+ }
+ else if (1 == wcp->target_height_type)
+ {
+ wcp->target_height = wcp->frame_size.y - world.winDB.v_screen_size.y +1;
+ }
+ if (0 == wcp->target_width_type)
+ {
+ wcp->target_width = wcp->frame_size.x;
+ }
+ else if (1 == wcp->target_width_type)
+ {
+ wcp->target_width = wcp->frame_size.x - world.winDB.v_screen_size.x;
+ }
+}
+
+
+
+static char get_next_win_id()
+{
+ static uint8_t i = 0;
+ char c = world.winDB.ids[i];
+ if (0 == c)
+ {
+ i = 0;
+ return c;
+ }
+ i++;
+ return c;
+}
+
+
+
+static void refit_v_screen()