wmsun: Smart display refresh for fewer wake-ups and better responsiveness.
Patch by Peter Colberg <peterc@gmx.net> for Debian bug #446681 [1]. [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=446681
This commit is contained in:
		
							parent
							
								
									c968d3f755
								
							
						
					
					
						commit
						debdd1b74e
					
				
					 1 changed files with 11 additions and 2 deletions
				
			
		| 
						 | 
					@ -61,7 +61,7 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 *  Delay between refreshes (in microseconds)
 | 
					 *  Delay between refreshes (in microseconds)
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define DELAY 10000L
 | 
					#define DELAY 1000000L
 | 
				
			||||||
#define WMSUN_VERSION "1.03"
 | 
					#define WMSUN_VERSION "1.03"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DegPerRad       57.29577951308232087680
 | 
					#define DegPerRad       57.29577951308232087680
 | 
				
			||||||
| 
						 | 
					@ -108,6 +108,8 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
    long		CurrentLocalTime, CurrentGMTTime, date;
 | 
					    long		CurrentLocalTime, CurrentGMTTime, date;
 | 
				
			||||||
    double		UT, val, LTRise, LTSet, LocalHour, hour24();
 | 
					    double		UT, val, LTRise, LTSet, LocalHour, hour24();
 | 
				
			||||||
    int			H, M;
 | 
					    int			H, M;
 | 
				
			||||||
 | 
					    struct timeval	timeout;
 | 
				
			||||||
 | 
					    fd_set		xfdset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -254,6 +256,11 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 *  Add X display to file descriptor set for polling.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						FD_ZERO(&xfdset);
 | 
				
			||||||
 | 
						FD_SET(ConnectionNumber(display), &xfdset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -285,7 +292,9 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
	 *  Redraw and wait for next update
 | 
						 *  Redraw and wait for next update
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	RedrawWindow();
 | 
						RedrawWindow();
 | 
				
			||||||
	usleep(DELAY);
 | 
						timeout.tv_sec = DELAY / 1000000L;
 | 
				
			||||||
 | 
						timeout.tv_usec = DELAY % 1000000L;
 | 
				
			||||||
 | 
						select(ConnectionNumber(display) + 1, &xfdset, NULL, NULL, &timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue