summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/calcurse.c5
-rw-r--r--src/calcurse.h1
-rw-r--r--src/sigs.c5
-rw-r--r--src/vars.c3
4 files changed, 14 insertions, 0 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index dd5abf5..7b94b9b 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -625,6 +625,11 @@ int main(int argc, char **argv)
wins_reset();
}
+ if (want_reload) {
+ want_reload = 0;
+ key_generic_reload();
+ }
+
key = keys_getch(win[KEY].p, &count, &reg);
switch (key) {
case KEY_GENERIC_REDRAW:
diff --git a/src/calcurse.h b/src/calcurse.h
index 4a6ea24..ce19183 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -1096,6 +1096,7 @@ extern unsigned colorize;
extern int foreground, background;
extern enum ui_mode ui_mode;
extern int read_only;
+extern int want_reload;
extern const char *datefmt_str[DATE_FORMATS];
extern int days[12];
extern const char *monthnames[12];
diff --git a/src/sigs.c b/src/sigs.c
index 18abcba..a95d9ab 100644
--- a/src/sigs.c
+++ b/src/sigs.c
@@ -86,6 +86,10 @@ static void generic_hdlr(int sig)
}
exit(EXIT_SUCCESS);
break;
+ case SIGUSR1:
+ want_reload = 1;
+ ungetch(KEY_RESIZE);
+ break;
}
}
@@ -112,6 +116,7 @@ void sigs_init()
if (!sigs_set_hdlr(SIGCHLD, generic_hdlr)
|| !sigs_set_hdlr(SIGWINCH, generic_hdlr)
|| !sigs_set_hdlr(SIGTERM, generic_hdlr)
+ || !sigs_set_hdlr(SIGUSR1, generic_hdlr)
|| !sigs_set_hdlr(SIGINT, SIG_IGN))
exit_calcurse(1);
}
diff --git a/src/vars.c b/src/vars.c
index 16b892a..39fbb87 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -61,6 +61,9 @@ enum ui_mode ui_mode = UI_CMDLINE;
/* Don't save anything if this is set. */
int read_only = 0;
+/* Applications can trigger a reload by sending SIGUSR1. */
+int want_reload = 0;
+
/* Strings describing each input date format. */
const char *datefmt_str[DATE_FORMATS];