home · contact · privacy
Minor comment fixing.
[plomrogue] / src / wincontrol.c
index 529457c0dc866f19e7cec44a2544cdd1b589099d..5680ff97ee3de08ba2694ebab86d797ca078f8b0 100644 (file)
@@ -208,12 +208,12 @@ static void save_win_config(struct World * world, char id)
     }
     linemax = linemax + 6;         /* + 6 = + 3 digits + whitespace + \n + \0 */
 
-    char keyb_line[linemax];
+    char kb_line[linemax];
     kb_p = wc->kb.kbs;
     while (0 != kb_p)
     {
-        snprintf(keyb_line, linemax, "%d %s\n", kb_p->key, kb_p->name);
-        try_fwrite(keyb_line, sizeof(char), strlen(keyb_line), file, world, f_name);
+        snprintf(kb_line, linemax, "%d %s\n", kb_p->key, kb_p->name);
+        try_fwrite(kb_line, sizeof(char), strlen(kb_line), file, world, f_name);
         kb_p = kb_p->next;
     }
 
@@ -240,20 +240,19 @@ static void set_winconf_geometry(struct World * world, char id)
     struct WinConf * wcp = get_winconf_by_id(world, id);
     if      (0 == wcp->height_type)
     {
-        wcp->height = wcp->win->frame.size.y;
+        wcp->height = wcp->win->framesize.y;
     }
     else if (1 == wcp->height_type)
     {
-        wcp->height = wcp->win->frame.size.y - world->wmeta->padframe.size.y
-                      + 1;
+        wcp->height = wcp->win->framesize.y - world->wmeta->padsize.y + 1;
     }
     if      (0 == wcp->width_type)
     {
-        wcp->width = wcp->win->frame.size.x;
+        wcp->width = wcp->win->framesize.x;
     }
     else if (1 == wcp->width_type)
     {
-        wcp->width = wcp->win->frame.size.x - world->wmeta->padframe.size.x;
+        wcp->width = wcp->win->framesize.x - world->wmeta->padsize.x;
     }
 }
 
@@ -465,20 +464,6 @@ extern void sorted_wintoggle_and_activate(struct World * world)
 
 
 
-extern void reload_win_config(struct World * world)
-{
-    while (0 != world->wmeta->active)
-    {
-        suspend_win(world->wmeta, world->wmeta->active);
-    }
-    free_winconfs(world);
-    init_winconfs(world);
-    init_wins(world);
-    sorted_wintoggle_and_activate(world);
-}
-
-
-
 extern void save_win_configs(struct World * world)
 {
     char * f_name = "save_win_configs()";
@@ -518,13 +503,13 @@ extern void save_win_configs(struct World * world)
 
 extern uint8_t toggle_window(struct WinMeta * win_meta, struct Win * win)
 {
-    if (0 != win->frame.curses_win)
+    if (0 == win->prev && win_meta->chain_start != win) /* Win outside chain. */
     {
-        return suspend_win(win_meta, win);
+        return append_win(win_meta, win);
     }
     else
     {
-        return append_win(win_meta, win);
+        return suspend_win(win_meta, win);
     }
 }
 
@@ -537,15 +522,20 @@ extern void toggle_winconfig(struct World * world, struct Win * win)
     {
         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;
     }
 }
@@ -571,8 +561,7 @@ extern void toggle_win_height_type(struct World * world, struct Win * win)
 extern void toggle_win_width_type(struct World * world, struct Win * win)
 {
     struct WinConf * wcp = get_winconf_by_win(world, win);
-    if (   0 == wcp->width_type
-        && win->frame.size.x <= world->wmeta->padframe.size.x)
+    if (0 == wcp->width_type && win->framesize.x <= world->wmeta->padsize.x)
     {
         wcp->width_type = 1;
     }
@@ -603,7 +592,7 @@ extern uint8_t growshrink_active_window(struct World * world, char change)
 {
     if (0 != world->wmeta->active)
     {
-        struct yx_uint16 size = world->wmeta->active->frame.size;
+        struct yx_uint16 size = world->wmeta->active->framesize;
         if      (change == '-')
         {
             size.y--;
@@ -623,8 +612,7 @@ extern uint8_t growshrink_active_window(struct World * world, char change)
         uint8_t x = resize_active_win(world->wmeta, size);
         struct WinConf * wcp = get_winconf_by_win(world, world->wmeta->active);
         if (   1 == wcp->width_type
-            && world->wmeta->active->frame.size.x
-               > world->wmeta->padframe.size.x)
+            && world->wmeta->active->framesize.x > world->wmeta->padsize.x)
         {
             wcp->width_type = 0;
         }