aboutsummaryrefslogtreecommitdiffstats
path: root/src/wins.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-05-19 10:54:50 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-05-19 10:54:50 +0200
commit990897b2f098f3ed898919e3e66c8830c2e3b450 (patch)
tree8d26aa7ef9195f387e688621447345a20cd2144a /src/wins.c
parente026481f11554580b234618e6a80242a6a9a50b1 (diff)
downloadcalcurse-990897b2f098f3ed898919e3e66c8830c2e3b450.tar.gz
calcurse-990897b2f098f3ed898919e3e66c8830c2e3b450.zip
Resize panels properly
Rewrite the panel resize code and remove the code that reinitializes the caption and the selected item when the window is resized. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/wins.c')
-rw-r--r--src/wins.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/wins.c b/src/wins.c
index 0c12d8e..0d8160a 100644
--- a/src/wins.c
+++ b/src/wins.c
@@ -396,28 +396,34 @@ void wins_scrollwin_ensure_visible(struct scrollwin *sw, unsigned line)
sw->line_off = line - inner_h + 1;
}
-void wins_reinit_panels(void)
+void wins_resize_panels(void)
{
- wins_scrollwin_delete(&sw_cal);
- listbox_delete(&lb_apt);
- listbox_delete(&lb_todo);
wins_get_config();
- wins_init_panels();
+ wins_scrollwin_resize(&sw_cal, win[CAL].y, win[CAL].x,
+ CALHEIGHT + (conf.compact_panels ? 2 : 4),
+ wins_sbar_width());
+ listbox_resize(&lb_apt, win[APP].y, win[APP].x, win[APP].h,
+ win[APP].w);
+ listbox_resize(&lb_todo, win[TOD].y, win[TOD].x, win[TOD].h,
+ win[TOD].w);
}
/*
* Delete the existing windows and recreate them with their new
* size and placement.
*/
-void wins_reinit(void)
+void wins_resize(void)
{
- wins_scrollwin_delete(&sw_cal);
- listbox_delete(&lb_apt);
- listbox_delete(&lb_todo);
+ wins_resize_panels();
+
delwin(win[STA].p);
delwin(win[KEY].p);
- wins_get_config();
- wins_init();
+ win[STA].p = newwin(win[STA].h, win[STA].w, win[STA].y, win[STA].x);
+ win[KEY].p = newwin(1, 1, 1, 1);
+
+ keypad(win[STA].p, TRUE);
+ keypad(win[KEY].p, TRUE);
+
if (notify_bar())
notify_reinit_bar();
}
@@ -540,7 +546,7 @@ void wins_reset_noupdate(void)
endwin();
wins_refresh();
curs_set(0);
- wins_reinit();
+ wins_resize();
}
/* Reset the screen, needed when resizing terminal for example. */
@@ -572,7 +578,7 @@ void wins_unprepare_external(void)
curs_set(0);
ui_mode = UI_CURSES;
wins_refresh();
- wins_reinit();
+ wins_resize();
wins_update(FLAG_ALL);
if (notify_bar())
notify_start_main_thread();