antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright ./Makefile.in ./configure src/wmarmon...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright ./Makefile.in ./configure src/wmarmon...
Date: Sun, 03 Jul 2005 14:05:33 -0400

CVSROOT:        /cvsroot/antiright
Module name:    antiright
Branch:         
Changes by:     Jeffrey Bedard <address@hidden> 05/07/03 18:05:33

Modified files:
        .              : Makefile.in configure 
        src/wmarmon    : wmarmon.c 

Log message:
        2.9 Release

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/Makefile.in.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/configure.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/antiright/antiright/src/wmarmon/wmarmon.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: antiright/Makefile.in
diff -u antiright/Makefile.in:1.40 antiright/Makefile.in:1.41
--- antiright/Makefile.in:1.40  Sat Jun 25 06:13:36 2005
+++ antiright/Makefile.in       Sun Jul  3 18:05:33 2005
@@ -25,7 +25,7 @@
 
 # The above line is where variables will be defined. 
 CFLAGS += $(INCLUDE) $(DEFS) -Wall -W -g
-programs=arshell arcd vdesk afract wmar
+programs=arshell arcd vdesk afract wmar wmarmon
 
 all: $(programs)
 
Index: antiright/configure
diff -u antiright/configure:1.52 antiright/configure:1.53
--- antiright/configure:1.52    Sat Jun 25 06:13:36 2005
+++ antiright/configure Sun Jul  3 18:05:33 2005
@@ -24,7 +24,7 @@
 #
 ###############################################################################
 
-VERSION=2.8
+VERSION=2.9
 DEFS="$DEFS -DPACKAGE_STRING='\"AntiRight_$VERSION\"'"
 
 ICONDIR=/usr/X11R6/include/X11/bitmaps/antiright
Index: antiright/src/wmarmon/wmarmon.c
diff -u antiright/src/wmarmon/wmarmon.c:1.3 antiright/src/wmarmon/wmarmon.c:1.4
--- antiright/src/wmarmon/wmarmon.c:1.3 Sat Jul  2 01:27:00 2005
+++ antiright/src/wmarmon/wmarmon.c     Sun Jul  3 18:05:33 2005
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/sysinfo.h>
+#include <time.h>
 
 /* This is a debug marking function.  */
 #define ARBUG                                          \
@@ -44,7 +45,6 @@
 Window iconwin;
 char *swap;
 char *users;
-char commands[17][16];
 
 char*
 antiright_pipe_read(char *command_string)
@@ -99,12 +99,32 @@
 }
 
 void
+get_values()
+{
+       if(swap != NULL)
+         {
+           free(swap);
+         }
+       swap=
+         antiright_pipe_read("echo `free | grep Swap"
+                             " | awk '{print $4}'`/1024 | bc");
+       swap[strlen(swap)-1]='\0';
+       if(users != NULL)
+         {
+           free(users);
+         }
+       users=antiright_pipe_read("users | wc | awk '{print $2}'");
+       users[strlen(users)-1]='\0';
+}
+
+void
 expose()
 {
   char *string;
   double load[3];
   char *hostname=getenv("HOSTNAME");
   
+  get_values();
   arshell_set_foreground(220, 218, 213);
   XFillRectangle(display, iconwin, gc, 0, 0, 64, 64);
   getloadavg(load, 3);
@@ -135,6 +155,43 @@
   
   XFlush(display);
 }
+void
+event_loop()
+{
+  time_t time0, time1;
+  XEvent event;
+  int done=0;
+  time(&time0);
+  time(&time1);
+  expose();
+  while(!done)
+    {
+      while(XPending(display))
+       {
+         XNextEvent(display, &event);
+         switch(event.type)
+           {
+           case Expose:
+             expose();
+             break;
+           case ButtonPress:
+             break;
+           case ButtonRelease:
+             break;
+           }
+       }
+      time(&time1);
+      if(difftime(time1, time0)>1)
+      {
+       time(&time0);
+       expose();
+      }
+      else
+       {
+         usleep(1000);
+       }
+    }
+}
 
 int
 main(int argc, char **argv)
@@ -145,8 +202,6 @@
   /*XTextProperty name;*/
   XGCValues    gcv;
   unsigned long        gcm;
-  int done=0;
-  /*XEvent event;*/
   
   display=XOpenDisplay((char*)getenv("DISPLAY"));
   if(display == NULL)
@@ -190,8 +245,6 @@
               | PointerMotionMask | StructureNotifyMask | EnterWindowMask 
               | LeaveWindowMask 
               | KeyPressMask | KeyReleaseMask);
-  /*XSetWMName(display, window, &name);*/
-  
   gcm = GCForeground | GCBackground | GCGraphicsExposures;
   gcv.foreground = BlackPixel(display, DefaultScreen(display));
   gcv.background = WhitePixel(display, DefaultScreen(display));
@@ -204,34 +257,11 @@
   mywmhints.window_group = window;
   mywmhints.flags = StateHint | IconWindowHint | IconPositionHint 
     | WindowGroupHint;
-  
-  
-  XSetWMHints(display, window, &mywmhints); 
-
-
+  XSetWMHints(display, window, &mywmhints);
   XSetCommand(display, window, argv, argc); 
   XMapWindow(display, window);
-  
   expose();
-  
-  while(!done)
-    {
-      if(swap != NULL)
-       {
-         free(swap);
-       }
-      swap=
-       antiright_pipe_read("echo `free | grep Swap"
-                           " | awk '{print $4}'`/1024 | bc");
-      swap[strlen(swap)-1]='\0';
-      if(users != NULL)
-       {
-         free(users);
-       }
-      users=antiright_pipe_read("users | wc | awk '{print $2}'");
-      users[strlen(users)-1]='\0';
-      expose();
-      sleep(1);
-    }
+  event_loop();
   XCloseDisplay(display);
+  return(0);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]