+#if defined(KEY_RESIZE) && HAVE_WRESIZE
+ case KEY_RESIZE:
+ /* resizeterm already did "something" reasonable, but it cannot
+ * know much about layout. So let's make it nicer.
+ */
+ panel_wide = COLS - (visible_cards * OFFSET_CARD);
+ panel_high = LINES - (visible_cards * OFFSET_CARD) - 5;
+
+ form_wide = panel_wide - 2;
+ form_high = panel_high - 2;
+
+ y = (visible_cards - 1) * OFFSET_CARD;
+ x = 0;
+
+ show_legend();
+ for (p = all_cards; p != 0; p = p->link) {
+ FIELD **oldf = form_fields(p->form);
+ WINDOW *olds = form_sub(p->form);
+
+ if (!isVisible(p))
+ continue;
+ win = form_win(p->form);
+
+ /* move and resize the card as needed
+ * FIXME: if the windows are shrunk too much, this won't do
+ */
+ mvwin(win, y, x);
+ wresize(win, panel_high, panel_wide);
+
+ /* reconstruct each form. Forms are not resizable, and
+ * there appears to be no good way to reload the text in
+ * a resized window.
+ */
+ werase(win);
+
+ unpost_form(p->form);
+ free_form(p->form);
+
+ p->form = new_form(make_fields(p, form_high, form_wide));
+ set_form_win(p->form, win);
+ set_form_sub(p->form, derwin(win, form_high, form_wide,
+ 1, 1));
+ post_form(p->form);
+
+ free_form_fields(oldf);
+ delwin(olds);
+
+ box(win, 0, 0);
+
+ y -= OFFSET_CARD;
+ x += OFFSET_CARD;
+ }
+ break;
+#endif