X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=inline;f=src%2Fclient%2Fmisc.c;fp=src%2Fclient%2Fmisc.c;h=7022c6f25c751945dc9b0ea746e16212d49c8767;hb=0b7798939c0193fd794985b503737e40d8602313;hp=be6faeb9c7a0e5e5ddf2a4ce21e998d97bb53df9;hpb=1c20e240bb704cddfa80b60dfa20863218edc6d8;p=plomrogue
diff --git a/src/client/misc.c b/src/client/misc.c
index be6faeb..7022c6f 100644
--- a/src/client/misc.c
+++ b/src/client/misc.c
@@ -1,18 +1,19 @@
/* src/client/misc.c */
#include "misc.h"
-#include /* delwin(), getmaxy(), getmaxx(), newpad() */
-#include /* uint8_t, uint16_t, uint32_t */
-#include "../common/rexit.h" /* exit_err() */
+#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 "map_window.h" /* for map_center() */
-#include "wincontrol.h" /* init_winconfs(), init_wins(),
- * sorted_wintoggle_and_activate()
+#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 */
@@ -33,15 +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();
- char * err_s = "load_interface_conf() makes illegaly large virtual screen.";
- char * err_m = "load_interface_conf(): memory alloc error via newpad().";
- uint32_t maxy_test = getmaxy(world.wmeta.screen);
- uint32_t maxx_test = getmaxx(world.wmeta.screen);
- exit_err(maxy_test > UINT16_MAX || maxx_test > UINT16_MAX, err_s);
- world.wmeta.padsize.y = maxy_test;
- world.wmeta.padsize.x = maxx_test;
- world.wmeta.pad = newpad(world.wmeta.padsize.y, 1);
- exit_err(NULL == world.wmeta.pad, err_m);
+ make_pad();
init_wins();
sorted_wintoggle_and_activate();
set_cleanup_flag(CLEANUP_INTERFACE);
@@ -64,6 +57,56 @@ extern void unload_interface_conf()
+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]);
+ }
+ }
+}
+
+
+
extern void reload_interface_conf()
{
unload_interface_conf();