diff --git a/src/fe-common/core/fe-windows.c b/src/fe-common/core/fe-windows.c index 46c1593b..7952f29b 100644 --- a/src/fe-common/core/fe-windows.c +++ b/src/fe-common/core/fe-windows.c @@ -575,7 +575,7 @@ static void sig_server_disconnected(SERVER_REC *server) } } -static void window_print_daychange(WINDOW_REC *window, struct tm *tm) +void window_print_daychange(WINDOW_REC *window, struct tm *tm) { THEME_REC *theme; TEXT_DEST_REC dest; @@ -664,9 +664,9 @@ static void sig_print_text(void) daycheck = 2; signal_remove("print text", (SIGNAL_FUNC) sig_print_text); - /* day changed, print notice about it to every window */ + /* day changed, notify every window */ for (tmp = windows; tmp != NULL; tmp = tmp->next) - window_print_daychange(tmp->data, tm); + ((WINDOW_REC *)(tmp->data))->daychanged = 1; } static int sig_check_daychange(void) diff --git a/src/fe-common/core/fe-windows.h b/src/fe-common/core/fe-windows.h index 32d6cfcd..0ba63509 100644 --- a/src/fe-common/core/fe-windows.h +++ b/src/fe-common/core/fe-windows.h @@ -35,6 +35,7 @@ struct _WINDOW_REC { unsigned int immortal:1; unsigned int sticky_refnum:1; unsigned int destroying:1; + unsigned int daychanged:1; /* window-specific command line history */ HISTORY_REC *history; @@ -82,6 +83,7 @@ WINDOW_REC *window_find_item(SERVER_REC *server, const char *name); int window_refnum_prev(int refnum, int wrap); int window_refnum_next(int refnum, int wrap); int windows_refnum_last(void); +void window_print_daychange(WINDOW_REC *window, struct tm *tm); int window_refnum_cmp(WINDOW_REC *w1, WINDOW_REC *w2); GSList *windows_get_sorted(void); diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index ba6f3242..13c28483 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -167,10 +167,19 @@ static void print_line(TEXT_DEST_REC *dest, const char *text) { THEME_REC *theme; char *str, *tmp, *stripped; + time_t t; + struct tm *tm; g_return_if_fail(dest != NULL); g_return_if_fail(text != NULL); + if(dest->window->daychanged) { + dest->window->daychanged = 0; + t = time(NULL); + tm = localtime(&t); + window_print_daychange(dest->window, tm); + } + theme = window_get_theme(dest->window); tmp = format_get_level_tag(theme, dest); str = !theme->info_eol ? format_add_linestart(text, tmp) :