[Pkg-wmaker-commits] [wmgtemp] 09/45: Imported Upstream version 0.8

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:58:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmgtemp.

commit 33bea762b3163723b76eb61efb97537a26cb8de1
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Fri Jan 30 20:33:39 2015 -0600

    Imported Upstream version 0.8
---
 Artistic                       |  0
 BUGS                           |  0
 CREDITS                        |  0
 INSTALL                        |  0
 Makefile                       |  8 +++--
 README                         |  0
 TODO                           |  0
 examples/wmgtemprc             |  0
 src/Makefile                   |  5 +--
 src/wmgeneral/list.c           |  0
 src/wmgeneral/list.h           |  0
 src/wmgeneral/misc.c           |  0
 src/wmgeneral/misc.h           |  0
 src/wmgeneral/wmgeneral.c      |  0
 src/wmgeneral/wmgeneral.h      |  0
 src/wmgtemp-interface-mask.xbm |  0
 src/wmgtemp-interface.xpm      |  0
 src/wmgtemp.c                  | 78 +++++++++++++++++++++++++++++++++++-------
 wmgtemp.1                      |  8 ++++-
 19 files changed, 81 insertions(+), 18 deletions(-)

diff --git a/Artistic b/Artistic
old mode 100755
new mode 100644
diff --git a/BUGS b/BUGS
old mode 100755
new mode 100644
diff --git a/CREDITS b/CREDITS
old mode 100755
new mode 100644
diff --git a/INSTALL b/INSTALL
old mode 100755
new mode 100644
diff --git a/Makefile b/Makefile
old mode 100755
new mode 100644
index 02f77fb..1d5e696
--- a/Makefile
+++ b/Makefile
@@ -9,5 +9,9 @@ depend:
 	( cd src && $(MAKE) depend )
 
 install:    
-	( cd src && $(MAKE) install )
-	$(INSTALL) -m 755 -c $(MANPAGE) $(MANINSTDIR)/$(MANPAGE)
\ No newline at end of file
+	( cd src && $(MAKE) install INSTDIR=$(INSTDIR) )
+	$(INSTALL) -d $(MANINSTDIR)
+	$(INSTALL) -m 755 -c $(MANPAGE) $(MANINSTDIR)/$(MANPAGE)
+
+clean:
+	( cd src && $(MAKE) clean)
diff --git a/README b/README
old mode 100755
new mode 100644
diff --git a/TODO b/TODO
old mode 100755
new mode 100644
diff --git a/examples/wmgtemprc b/examples/wmgtemprc
old mode 100755
new mode 100644
diff --git a/src/Makefile b/src/Makefile
old mode 100755
new mode 100644
index 5e2647d..49a761d
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,6 +1,7 @@
 CC      = gcc
 INSTALL = /usr/bin/install
-LDFLAGS = -L/usr/X11R6/lib -lXpm -lXext -lX11 -lsensors
+LIB     = lib
+LDFLAGS = -L/usr/X11R6/$(LIB) -lXpm -lXext -lX11 -lsensors
 BINARY  = wmgtemp
 CCFLAGS = -Wall -g
 INSTDIR = /usr/local/bin
@@ -28,4 +29,4 @@ depend:
 count:
 	@ wc -l *.c *.h | sort
 
-include .deps
\ No newline at end of file
+include .deps
diff --git a/src/wmgeneral/list.c b/src/wmgeneral/list.c
old mode 100755
new mode 100644
diff --git a/src/wmgeneral/list.h b/src/wmgeneral/list.h
old mode 100755
new mode 100644
diff --git a/src/wmgeneral/misc.c b/src/wmgeneral/misc.c
old mode 100755
new mode 100644
diff --git a/src/wmgeneral/misc.h b/src/wmgeneral/misc.h
old mode 100755
new mode 100644
diff --git a/src/wmgeneral/wmgeneral.c b/src/wmgeneral/wmgeneral.c
old mode 100755
new mode 100644
diff --git a/src/wmgeneral/wmgeneral.h b/src/wmgeneral/wmgeneral.h
old mode 100755
new mode 100644
diff --git a/src/wmgtemp-interface-mask.xbm b/src/wmgtemp-interface-mask.xbm
old mode 100755
new mode 100644
diff --git a/src/wmgtemp-interface.xpm b/src/wmgtemp-interface.xpm
old mode 100755
new mode 100644
diff --git a/src/wmgtemp.c b/src/wmgtemp.c
old mode 100755
new mode 100644
index 064139b..aa31aa4
--- a/src/wmgtemp.c
+++ b/src/wmgtemp.c
@@ -5,6 +5,8 @@
 #include <unistd.h>
 #include <sys/param.h>
 #include <sys/types.h>
+#include <sys/poll.h>
+#include <time.h>
 #include <X11/Xlib.h>
 #include <X11/xpm.h>
 #include <X11/extensions/shape.h>
@@ -144,12 +146,14 @@ int main(int argc, char **argv) {
     feature1 = feature2 = 0;
     
     while((feature = sensors_get_all_features(*name, &feature1, &feature2)) != NULL) {
-      if(strcmp(feature->name, (const char *)sensor_feature1) == 0 && sensors_get_ignored(*name, feature->number)) {
+      if(strcmp(feature->name, (const char *)sensor_feature1) == 0 
+         && sensors_get_ignored(*name, feature->number)) {
 	SENSOR_DEF_CPU = feature->number;
 	BitOn(SENSOR_DISP, CPU);
 	chip_found = 1;
       }
-      if(strcmp(feature->name, (const char *)sensor_feature2) == 0 && sensors_get_ignored(*name, feature->number)) {
+      if(strcmp(feature->name, (const char *)sensor_feature2) == 0 
+         && sensors_get_ignored(*name, feature->number)) {
 	SENSOR_DEF_SYS = feature->number;
 	BitOn(SENSOR_DISP, SYS);
 	chip_found = 1;
@@ -214,8 +218,8 @@ int main(int argc, char **argv) {
   RedrawWindow();
     
   // Set up signal handler
-  signal(SIGALRM, do_sensors);
-  alarm(delay);
+//  signal(SIGALRM, do_sensors);
+//  alarm(delay);
 
   process_xevents();
   
@@ -245,10 +249,49 @@ void draw_scale_indicator() {
 
 void process_xevents() {
   int button_area = 0;
-
+  int* xfds = NULL;
+  int fdcount = 0;
+  struct pollfd* pfds = NULL;
   XEvent Event;
+  Status ret;
+  time_t lastupdate = 0;
+    
+  ret = XInternalConnectionNumbers(display, &xfds, &fdcount);
+  if(!ret) {
+    fdcount = 0;
+    if(xfds) {
+      XFree(xfds);
+    }
+    xfds = NULL;
+  }
+  
+  int i;
+  pfds = (struct pollfd*)malloc((fdcount+1)*sizeof(struct pollfd));
+  if(!pfds) {
+    perror("malloc");
+    exit(EXIT_FAILURE);
+  }
+  
+  for(i=0; i < fdcount; ++i) {
+    pfds[i].fd = xfds[i];
+    pfds[i].events = POLLIN | POLLPRI;
+  }
+  
+  if(xfds) {
+    XFree(xfds);
+  }
+  
+  pfds[fdcount].fd = ConnectionNumber(display);
+  pfds[fdcount].events = POLLIN | POLLPRI;
   
   while(1) {
+    poll(pfds, fdcount + 1, delay * 1000);
+    
+    if(time(NULL) - lastupdate >= delay) {
+      lastupdate = time(NULL);
+      do_sensors(0);
+    }
+    
     while(XPending(display)) {
       XNextEvent(display, &Event);
       switch(Event.type) {
@@ -337,12 +380,11 @@ void process_xevents() {
 	break;
       }
     }
-    usleep(100000);
   }
 }
 
 void do_sensors(int val) {
-  alarm(delay);
+//  alarm(delay);
 
   update_sensor_data();
   update_display();
@@ -412,12 +454,22 @@ void update_display() {
     // Clear a line
     copyXPMArea(65, 0, 1, 39, j + 2, 12);
     
-    // Draw the temperatures on the graph.
-    if(IsOn(SENSOR_DISP, CPU)) {
-      add_to_graph(cpu_history[j], CPU, 1, range_upper - range_lower, j + 2);
+    if(sys_history[j] < cpu_history[j]) {
+      // Draw the temperatures on the graph.
+      if(IsOn(SENSOR_DISP, CPU)) {
+        add_to_graph(cpu_history[j], CPU, 1, range_upper - range_lower, j + 2);
+      }
+      if(IsOn(SENSOR_DISP, SYS)) {
+        add_to_graph(sys_history[j], SYS, 0, range_upper - range_lower, j + 2);
+      }
     }
-    if(IsOn(SENSOR_DISP, SYS)) {
-      add_to_graph(sys_history[j], SYS, 0, range_upper - range_lower, j + 2);
+    else {
+      if(IsOn(SENSOR_DISP, SYS)) {
+        add_to_graph(sys_history[j], SYS, 0, range_upper - range_lower, j + 2);
+      }
+      if(IsOn(SENSOR_DISP, CPU)) {
+        add_to_graph(cpu_history[j], CPU, 1, range_upper - range_lower, j + 2);
+      }
     }
   }
   
@@ -575,7 +627,7 @@ int init_sensors() {
   FILE *config_file;
   int res;
 
-  config_file = fopen("/etc/sensors.conf", "r");
+  config_file = fopen"/etc/sensors.conf", "r");
 
   if(config_file == NULL) {
     fprintf(stderr, "Error opening /etc/sensors.conf\n");
diff --git a/wmgtemp.1 b/wmgtemp.1
old mode 100755
new mode 100644
index 4250d47..0f1a945
--- a/wmgtemp.1
+++ b/wmgtemp.1
@@ -6,7 +6,11 @@ wmgtemp \- Temperature sensor dock app for Window Maker
 .B wmgtemp
 .I "[options]"
 .SH "DESCRIPTION"
-wmgtemp is a dock-app for Window Maker that graphically displays the CPU and System temperatures using the lm_sensors package. It displays the CPU and System temperature values, a scaling graph of temperature history, high-temperature warning lights and temperatures in celcius, fahrenheit or kelvin.
+wmgtemp is a dock-app for Window Maker that graphically displays the CPU and
+System temperatures using the lm_sensors package. It displays the CPU and
+System temperature values, a scaling graph of temperature history,
+high-temperature warning lights and temperatures in degrees Celsius,
+Fahrenheit or Kelvin.
 .PP
 The temperature graph is auto scaling, meaning that if the max or min temperature boundary is crossed the graph will be scaled to display the temperature. A red line marks the upper boundary whereas a blue line indicates the lower boundary. When all the temperatures being displayed are within the boundaries the graph will be scaled back to the preset values for min/max and the boundary indicator lines will be removed.
 .PP
@@ -129,6 +133,8 @@ You may change the scale the temperatures are displayed in by clicking on either
 Blank lines in the config file cause a Segmentation Fault.
 .PP
 .SH SEE ALSO
+.BR sensors.conf (5),
+.BR libsensors (3),
 .BR wmaker (1x)
 .SH AUTHOR
 wmgtemp was written by Roger Dunce <kronos at fluxcode.net>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmgtemp.git



More information about the Pkg-wmaker-commits mailing list