Couple fixes for the top_time stuff.
authorBrenden Matthews <brenden@rty.ca>
Sun, 8 Feb 2009 17:13:54 +0000 (10:13 -0700)
committerBrenden Matthews <brenden@rty.ca>
Sun, 8 Feb 2009 17:13:54 +0000 (10:13 -0700)
ChangeLog
configure.ac.in
src/conky.c
src/top.c

index 7635951..5aa2bb3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-02-08
+       * Refactor top code, add top_time to sort by process cpu time (thanks
+       sohalt).
+
 2008-12-20
        * Add if_match object comparing strings, floats and ints
 
index d7ed523..2855eeb 100644 (file)
@@ -318,16 +318,21 @@ dnl
 AC_ARG_ENABLE([nvidia],
                AC_HELP_STRING([--enable-nvidia], [enable if you want nvidia support @<:@default=no@:>@]),
                [want_nvidia="$enableval"], [want_nvidia=no])
-AM_CONDITIONAL(BUILD_NVIDIA, test x$want_nvidia = xyes)
 if test x$want_nvidia = xyes; then
-       AC_CHECK_HEADERS([NVCtrl/NVCtrl.h], [], AC_MSG_ERROR([NVCtrl/NVCtrl.h header not found]))
+    if test "x$want_x11" != "xyes"; then
+               # do nada
+               want_nvidia=no
+       else
+               AC_CHECK_HEADERS([NVCtrl/NVCtrl.h], [], AC_MSG_ERROR([NVCtrl/NVCtrl.h header not found]))
 dnl AC_CHECK_LIB([XNVCtrl], [XNVCTRLQueryVersion], [] ,[AC_MSG_ERROR([grrr])] )
 dnl AC_CHECK_LIB([XNVCtrl], [XNVCTRLCheckTargetData], [], [AC_MSG_ERROR([grr])])
 dnl ## am I Stupid ??
 dnl ## it won't find the lib for some reason!?
-       LIBS="$LIBS -lXNVCtrl"
-               AC_DEFINE(NVIDIA, 1, [Define if you want nvidia support])
+               LIBS="$LIBS -lXNVCtrl"
+                       AC_DEFINE(NVIDIA, 1, [Define if you want nvidia support])
+       fi
 fi
+AM_CONDITIONAL(BUILD_NVIDIA, test x$want_nvidia = xyes)
 
 dnl
 dnl IMLIB2
index 1558dbb..db3247c 100644 (file)
@@ -3671,15 +3671,15 @@ static void generate_text_internal(char *p, int p_max_size,
 {
        struct text_object *obj;
 
+       /* for the OBJ_top* handler */
+       struct process **needed = 0;
+
 #ifdef HAVE_ICONV
        char buff_in[p_max_size];
        buff_in[0] = 0;
        iconv_converting = 0;
 #endif
 
-       /* for the OBJ_top* handler */
-       struct process **needed;
-
        p[0] = 0;
        for (obj = root.next; obj && p_max_size > 0; obj = obj->next) {
 
@@ -5124,11 +5124,11 @@ static void generate_text_internal(char *p, int p_max_size,
                         * times, we have this special handler. */
                        break;
                        case OBJ_top:
-                               needed = cur->cpu;
+                               if (!needed) needed = cur->cpu;
                        case OBJ_top_mem:
-                               needed = cur->memu;
+                               if (!needed) needed = cur->memu;
                        case OBJ_top_time:
-                               needed = cur->time;
+                               if (!needed) needed = cur->time;
 
                                {
                                        char *timeval;
index 075334c..fd0c4eb 100644 (file)
--- a/src/top.c
+++ b/src/top.c
@@ -524,7 +524,7 @@ static void sp_acopy(struct sorted_process *sp_head, struct process **ar, int ma
  * ****************************************************************** */
 
 void process_find_top(struct process **cpu, struct process **mem,
-               struct process **time)
+               struct process **ptime)
 {
        struct sorted_process *spc_head = NULL, *spc_tail = NULL, *spc_cur = NULL;
        struct sorted_process *spm_head = NULL, *spm_tail = NULL, *spm_cur = NULL;
@@ -567,5 +567,5 @@ void process_find_top(struct process **cpu, struct process **mem,
        if (top_mem)
                sp_acopy(spm_head, mem, MAX_SP);
        if (top_time)
-               sp_acopy(spt_head, time, MAX_SP);
+               sp_acopy(spt_head, ptime, MAX_SP);
 }