summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/calcurse.c12
-rw-r--r--src/calcurse.h1
-rw-r--r--src/custom.c72
-rw-r--r--src/help.c63
-rw-r--r--src/notify.c33
-rw-r--r--src/sigs.c1
-rw-r--r--src/vars.c1
7 files changed, 106 insertions, 77 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 15ee1bd..662f185 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -179,9 +179,7 @@ main (int argc, char **argv)
break;
case KEY_GENERIC_REDRAW:
- case KEY_RESIZE:
- do_update = 0;
- wins_reset ();
+ resize = 1;
break;
case KEY_GENERIC_CHANGE_VIEW:
@@ -567,6 +565,14 @@ main (int argc, char **argv)
apoint_hilt_set (1);
}
}
+
+ if (resize)
+ {
+ resize = 0;
+ do_update = 0;
+ wins_reset ();
+ }
+
if (do_update)
wins_update ();
}
diff --git a/src/calcurse.h b/src/calcurse.h
index 34de7ed..6642ae9 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -864,6 +864,7 @@ void psleep (unsigned);
/* vars.c */
extern int col, row;
+extern int resize;
extern unsigned colorize;
extern enum ui_mode ui_mode;
extern int days[12];
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);
diff --git a/src/help.c b/src/help.c
index edc916e..3f4f7c7 100644
--- a/src/help.c
+++ b/src/help.c
@@ -107,7 +107,7 @@ help_write_pad (struct window *win, char *title, char *text, enum key action)
erase_window_part (win->p, rownum, colnum, BUFSIZ, win->w);
custom_apply_attr (win->p, ATTR_HIGHEST);
mvwprintw (win->p, rownum, colnum, "%s", title);
- if ((int) action != KEY_RESIZE) {
+ if ((int) action != KEY_RESIZE && action < NBKEYS) {
switch (action)
{
case KEY_END_OF_WEEK:
@@ -131,8 +131,12 @@ help_write_pad (struct window *win, char *title, char *text, enum key action)
break;
default:
bindings = keys_action_allkeys (action);
- colnum = win->w - strlen (bindings_title) - strlen (bindings);
- mvwprintw (win->p, rownum, colnum, bindings_title, bindings);
+
+ if (bindings)
+ {
+ colnum = win->w - strlen (bindings_title) - strlen (bindings);
+ mvwprintw (win->p, rownum, colnum, bindings_title, bindings);
+ }
}
}
colnum = 0;
@@ -744,34 +748,35 @@ help_screen (void)
erase_window_part (hwin.win.p, 1, hwin.pad.y, col - 2,
hwin.win.h - 2);
- if ((int) ch == KEY_RESIZE) {
- wins_get_config ();
- help_wins_reset (&hwin);
- hwin.first_visible_line = 0;
- hwin.total_lines = help_write_pad (&hwin.pad, hscr[oldpage].title,
- hscr[oldpage].text, ch);
- need_resize = 1;
+ switch (ch) {
+ case KEY_GENERIC_SCROLL_DOWN:
+ wins_scrollwin_down (&hwin, 1);
+ break;
+
+ case KEY_GENERIC_SCROLL_UP:
+ wins_scrollwin_up (&hwin, 1);
+ break;
+
+ default:
+ page = wanted_page (ch);
+ if (page != NOPAGE) {
+ hwin.first_visible_line = 0;
+ hwin.total_lines = help_write_pad (&hwin.pad, hscr[page].title,
+ hscr[page].text, ch);
+ oldpage = page;
+ }
}
- else {
- switch (ch) {
- case KEY_GENERIC_SCROLL_DOWN:
- wins_scrollwin_down (&hwin, 1);
- break;
-
- case KEY_GENERIC_SCROLL_UP:
- wins_scrollwin_up (&hwin, 1);
- break;
-
- default:
- page = wanted_page (ch);
- if (page != NOPAGE) {
- hwin.first_visible_line = 0;
- hwin.total_lines = help_write_pad (&hwin.pad, hscr[page].title,
- hscr[page].text, ch);
- oldpage = page;
- }
+
+ if (resize)
+ {
+ resize = 0;
+ wins_get_config ();
+ help_wins_reset (&hwin);
+ hwin.first_visible_line = 0;
+ hwin.total_lines = help_write_pad (&hwin.pad, hscr[oldpage].title,
+ hscr[oldpage].text, ch);
+ need_resize = 1;
}
- }
wins_scrollwin_display (&hwin);
ch = keys_getch (win[STA].p);
diff --git a/src/notify.c b/src/notify.c
index d66cf80..14a5f0c 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -728,20 +728,6 @@ notify_config_bar (void)
switch (ch)
{
- case KEY_RESIZE:
- wins_get_config ();
- wins_reset ();
- reinit_conf_win (&cwin);
- 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;
@@ -815,6 +801,25 @@ notify_config_bar (void)
dmon.log = !dmon.log;
break;
}
+
+ if (resize)
+ {
+ resize = 0;
+ wins_get_config ();
+ wins_reset ();
+ reinit_conf_win (&cwin);
+ 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 ();
+ }
+ clearok (curscr, TRUE);
+ }
+
status_mesg (number_str, keys);
cwin.total_lines = print_config_options (cwin.pad.p);
wins_scrollwin_display (&cwin);
diff --git a/src/sigs.c b/src/sigs.c
index dabb1cb..a5f7e54 100644
--- a/src/sigs.c
+++ b/src/sigs.c
@@ -59,6 +59,7 @@ generic_hdlr (int sig)
;
break;
case SIGWINCH:
+ resize = 1;
clearok (curscr, TRUE);
(void)ungetch (KEY_RESIZE);
break;
diff --git a/src/vars.c b/src/vars.c
index 3a790f1..4b1d7cd 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -43,6 +43,7 @@
* variables to store window size
*/
int col = 0, row = 0;
+int resize = 0;
/* variable to tell if the terminal supports color */
unsigned colorize = 0;