about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-05 00:38:50 +0000
committerJames Booth <boothj5@gmail.com>2013-01-05 00:38:50 +0000
commitb84051701daab555f1987fee9519ddabc3b2d32e (patch)
tree3a4b9486bd1d34e403afc7d54365f29644852fd1
parent83aa2212f5eff3577d041b367fc702cea8fb4a20 (diff)
downloadprofani-tty-b84051701daab555f1987fee9519ddabc3b2d32e.tar.gz
Added comments to ui_get_idle_time
-rw-r--r--src/windows.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/windows.c b/src/windows.c
index ae00ee54..f709231f 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -187,8 +187,8 @@ _ui_draw_win_title(void)
 
     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);
@@ -200,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,11 +208,16 @@ ui_get_idle_time(void)
         unsigned long result = info->idle;
         XFree(info);
         return result;
+
+    // if we couldn't get a screensaverinfo, use profanity interaction idle time
+    // this may occur if compiled with libxss, but then run in a bare terminal
     } else {
         gdouble seconds_elapsed = g_timer_elapsed(ui_idle_time, NULL);
         unsigned long ms_elapsed = seconds_elapsed * 1000.0;
         return ms_elapsed;
     }
+
+// if not compiled with libxss, just use profanity interaction idle time
 #else
     gdouble seconds_elapsed = g_timer_elapsed(ui_idle_time, NULL);
     unsigned long ms_elapsed = seconds_elapsed * 1000.0;