diff options
-rw-r--r-- | src/windows.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/windows.c b/src/windows.c index e81fcaaf..d8017e2b 100644 --- a/src/windows.c +++ b/src/windows.c @@ -177,18 +177,19 @@ _ui_draw_win_title(void) gint unread = _win_get_unread(); if (unread != 0) { - sprintf(new_win_title, "%c]0;%s%s (%d) - %s%c", '\033', "Profanity", version_str->str, unread, jid, '\007'); + snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%s (%d) - %s%c", '\033', "Profanity", version_str->str, unread, jid, '\007'); } else { - sprintf(new_win_title, "%c]0;%s%s - %s%c", '\033', "Profanity", version_str->str, jid, '\007'); + snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%s - %s%c", '\033', "Profanity", version_str->str, jid, '\007'); } } else { - sprintf(new_win_title, "%c]0;%s%s%c", '\033', "Profanity", version_str->str, '\007'); + snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%s%c", '\033', "Profanity", version_str->str, '\007'); } g_string_free(version_str, TRUE); - // draw if change if (g_strcmp0(win_title, new_win_title) != 0) { + // print to x-window title bar + printf(new_win_title); if (win_title != NULL) { free(win_title); } @@ -199,6 +200,7 @@ _ui_draw_win_title(void) unsigned long ui_get_idle_time(void) { +// if compiled with libxss, get the x sessions idle time #ifdef HAVE_LIBXSS XScreenSaverInfo *info = XScreenSaverAllocInfo(); if (info != NULL && display != NULL) { @@ -207,6 +209,7 @@ ui_get_idle_time(void) XFree(info); return result; } +// if no libxss or xss idle time failed, use profanity idle time #endif gdouble seconds_elapsed = g_timer_elapsed(ui_idle_time, NULL); unsigned long ms_elapsed = seconds_elapsed * 1000.0; |