This commit is contained in:
Dennis Kaarsemaker 2017-06-07 10:23:39 +00:00 committed by GitHub
commit b50391e3f8
3 changed files with 14 additions and 3 deletions

View file

@ -677,7 +677,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; THEME_REC *theme;
TEXT_DEST_REC dest; TEXT_DEST_REC dest;
@ -766,9 +766,9 @@ static void sig_print_text(void)
daycheck = 2; daycheck = 2;
signal_remove("print text", (SIGNAL_FUNC) sig_print_text); 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) 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) static int sig_check_daychange(void)

View file

@ -35,6 +35,7 @@ struct _WINDOW_REC {
unsigned int immortal:1; unsigned int immortal:1;
unsigned int sticky_refnum:1; unsigned int sticky_refnum:1;
unsigned int destroying:1; unsigned int destroying:1;
unsigned int daychanged:1;
/* window-specific command line history */ /* window-specific command line history */
HISTORY_REC *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_prev(int refnum, int wrap);
int window_refnum_next(int refnum, int wrap); int window_refnum_next(int refnum, int wrap);
int windows_refnum_last(void); 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); int window_refnum_cmp(WINDOW_REC *w1, WINDOW_REC *w2);
GSList *windows_get_sorted(void); GSList *windows_get_sorted(void);

View file

@ -167,10 +167,19 @@ static void print_line(TEXT_DEST_REC *dest, const char *text)
{ {
THEME_REC *theme; THEME_REC *theme;
char *str, *tmp, *stripped; char *str, *tmp, *stripped;
time_t t;
struct tm *tm;
g_return_if_fail(dest != NULL); g_return_if_fail(dest != NULL);
g_return_if_fail(text != 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); theme = window_get_theme(dest->window);
tmp = format_get_level_tag(theme, dest); tmp = format_get_level_tag(theme, dest);
str = !theme->info_eol ? format_add_linestart(text, tmp) : str = !theme->info_eol ? format_add_linestart(text, tmp) :