summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/calcurse.c2
-rw-r--r--src/calcurse.h4
-rw-r--r--src/custom.c2
-rw-r--r--src/wins.c32
4 files changed, 23 insertions, 17 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index de0d5a5..95a6dea 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -589,7 +589,7 @@ int main(int argc, char **argv)
io_load_keys(conf.pager);
io_load_todo();
io_load_app();
- wins_reinit();
+ wins_resize();
/*
* Refresh the hidden key handler window here to prevent wgetch() from
* implicitly calling wrefresh() later (causing ncurses race conditions).
diff --git a/src/calcurse.h b/src/calcurse.h
index b33bbf5..cb083df 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -1101,8 +1101,8 @@ void wins_scrollwin_display(struct scrollwin *);
void wins_scrollwin_up(struct scrollwin *, int);
void wins_scrollwin_down(struct scrollwin *, int);
void wins_scrollwin_ensure_visible(struct scrollwin *, unsigned);
-void wins_reinit(void);
-void wins_reinit_panels(void);
+void wins_resize(void);
+void wins_resize_panels(void);
void wins_show(WINDOW *, const char *);
void wins_get_config(void);
void wins_update_border(int);
diff --git a/src/custom.c b/src/custom.c
index 688ca21..4fc3fb5 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -303,7 +303,7 @@ void custom_sidebar_config(void)
resize = 0;
wins_reset();
} else {
- wins_reinit_panels();
+ wins_resize_panels();
wins_update_border(FLAG_ALL);
wins_update_panels(FLAG_ALL);
keys_display_bindings_bar(win[STA].p, bindings,
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();