X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fclient%2Fmisc.c;h=7022c6f25c751945dc9b0ea746e16212d49c8767;hb=0b7798939c0193fd794985b503737e40d8602313;hp=0b052deb0cf5b614184fc09bd7ff5ba5ea9c0b71;hpb=dd9d65ee727ac7e95801da0f8b5bae7009811802;p=plomrogue
diff --git a/src/client/misc.c b/src/client/misc.c
index 0b052de..7022c6f 100644
--- a/src/client/misc.c
+++ b/src/client/misc.c
@@ -1,15 +1,19 @@
/* src/client/misc.c */
#include "misc.h"
+#include /* delwin(), endwin(), refresh() */
#include /* uint8_t, uint16_t */
+#include /* memset(), strlen() */
#include "cleanup.h" /* for set_cleanup_flag() */
#include "keybindings.h" /* init_keybindings(), free_keybindings(),
* save_keybindings()
*/
-#include "wincontrol.h" /* init_winconfs(), init_wins(),
- * sorted_wintoggle_and_activate()
+#include "map_window.h" /* for map_center() */
+#include "wincontrol.h" /* struct WinConf, init_winconfs(), init_wins(),
+ * sorted_wintoggle_and_activate(), get_win_by_id(),
+ * get_winconf_by_win(), toggle_window()
*/
-#include "windows.h" /* suspend_win() */
+#include "windows.h" /* struct Win, make_pad(), suspend_win(), free_win() */
#include "world.h" /* global world */
@@ -30,6 +34,7 @@ extern void load_interface_conf()
init_keybindings("confclient/keybindings_wingeom", &world.kb_wingeom);
init_keybindings("confclient/keybindings_winkeys", &world.kb_winkeys);
init_winconfs();
+ make_pad();
init_wins();
sorted_wintoggle_and_activate();
set_cleanup_flag(CLEANUP_INTERFACE);
@@ -47,6 +52,57 @@ extern void unload_interface_conf()
suspend_win(world.wmeta.active);
}
free_winconfs();
+ delwin(world.wmeta.pad);
+}
+
+
+
+extern void winch_called(int signal)
+{
+ world.winch = 1;
+}
+
+
+
+extern void reset_windows()
+{
+ endwin(); /* "[S]tandard way" to recalibrate ncurses post SIGWINCH, says */
+ refresh(); /* . */
+ struct Win * w_p = world.wmeta.chain_start;
+ char win_ids[strlen(world.winconf_db.winconf_ids) + 1];
+ memset(win_ids, '\0', strlen(world.winconf_db.winconf_ids) + 1);
+ uint8_t i = 0;
+ char active = '\0';
+ for (; NULL != w_p; w_p = w_p->next, i++)
+ {
+ struct WinConf * wc_p = get_winconf_by_win(w_p);
+ win_ids[i] = wc_p->id;
+ if (w_p == world.wmeta.active)
+ {
+ active = wc_p->id;
+ }
+ }
+ while (0 != world.wmeta.active)
+ {
+ w_p = world.wmeta.active;
+ suspend_win(w_p);
+ free_win(w_p);
+ }
+ delwin(world.wmeta.pad);
+ make_pad();
+ init_wins();
+ if (strlen(win_ids) < 1)
+ {
+ return;
+ }
+ for (i = 0; i < strlen(win_ids); i++)
+ {
+ toggle_window(win_ids[i]);
+ if (active == win_ids[i])
+ {
+ world.wmeta.active = get_win_by_id(win_ids[i]);
+ }
+ }
}
@@ -55,6 +111,7 @@ extern void reload_interface_conf()
{
unload_interface_conf();
load_interface_conf();
+ map_center();
}