summaryrefslogtreecommitdiff
path: root/src/custom.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-06-28 11:05:05 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-06-28 18:22:43 +0200
commitfec37db06bbbdff79bc9816046a76e0b29e173b4 (patch)
tree2b7a6349b3bc7dd8c22be72518bb4576040e9596 /src/custom.c
parent6636232bc7bb3148ca82dcac3e52ce02212f4b68 (diff)
downloadcalcurse-fec37db06bbbdff79bc9816046a76e0b29e173b4.zip
Avoid redundant redraws on resize
Use a global flag to record whether the terminal was resized instead of redrawing everything each time a KEY_RESIZE is read. Add some additional checks to help_write_pad() as invalid actions may be passed now due to using signals instead of virtual key presses. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/custom.c')
-rw-r--r--src/custom.c72
1 files changed, 41 insertions, 31 deletions
diff --git a/src/custom.c b/src/custom.c
index 188ded2..9531eaa 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -549,12 +549,6 @@ custom_layout_config (void)
need_reset = 0;
switch (ch)
{
- case KEY_RESIZE:
- endwin ();
- wins_refresh ();
- curs_set (0);
- need_reset = 1;
- break;
case KEY_GENERIC_HELP:
help_wins_init (&hwin, 0, 0,
(notify_bar ()) ? row - 3 : row - 2, col);
@@ -588,6 +582,16 @@ custom_layout_config (void)
need_reset = 1;
break;
}
+
+ if (resize)
+ {
+ resize = 0;
+ endwin ();
+ wins_refresh ();
+ curs_set (0);
+ need_reset = 1;
+ }
+
display_layout_config (&conf_win, mark, cursor, need_reset);
}
wins_set_layout (mark + 1);
@@ -863,13 +867,6 @@ custom_color_config (void)
switch (ch)
{
- case KEY_RESIZE:
- endwin ();
- wins_refresh ();
- curs_set (0);
- need_reset = 1;
- break;
-
case KEY_GENERIC_SELECT:
colorize = 1;
need_reset = 1;
@@ -905,6 +902,16 @@ custom_color_config (void)
need_reset = 1;
break;
}
+
+ if (resize)
+ {
+ resize = 0;
+ endwin ();
+ wins_refresh ();
+ curs_set (0);
+ need_reset = 1;
+ }
+
display_color_config (&conf_win, &mark_fore, &mark_back, cursor,
need_reset, theme_changed);
}
@@ -1114,24 +1121,6 @@ custom_general_config (struct conf *conf)
switch (ch)
{
- case KEY_RESIZE:
- wins_get_config ();
- wins_reset ();
- wins_scrollwin_delete (&cwin);
- wins_scrollwin_init (&cwin);
- custom_set_swsiz (&cwin);
- wins_show (cwin.win.p, cwin.label);
- cwin.first_visible_line = 0;
- delwin (win[STA].p);
- win[STA].p = newwin (win[STA].h, win[STA].w, win[STA].y,
- win[STA].x);
- keypad (win[STA].p, TRUE);
- if (notify_bar ())
- {
- notify_reinit_bar ();
- notify_update_bar ();
- }
- break;
case CTRL ('N'):
wins_scrollwin_down (&cwin, 1);
break;
@@ -1191,6 +1180,27 @@ custom_general_config (struct conf *conf)
status_mesg (number_str, keys);
break;
}
+
+ if (resize)
+ {
+ resize = 0;
+ wins_reset ();
+ wins_scrollwin_delete (&cwin);
+ wins_scrollwin_init (&cwin);
+ custom_set_swsiz (&cwin);
+ wins_show (cwin.win.p, cwin.label);
+ cwin.first_visible_line = 0;
+ delwin (win[STA].p);
+ win[STA].p = newwin (win[STA].h, win[STA].w, win[STA].y,
+ win[STA].x);
+ keypad (win[STA].p, TRUE);
+ if (notify_bar ())
+ {
+ notify_reinit_bar ();
+ notify_update_bar ();
+ }
+ }
+
status_mesg (number_str, keys);
cwin.total_lines = print_general_options (cwin.pad.p, conf);
wins_scrollwin_display (&cwin);