[Pkg-wmaker-commits] [wmsun] 37/73: wmsun: Smart display refresh for fewer wake-ups and better responsiveness.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Aug 28 12:04:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmsun.
commit 9598b06eeb77e70ea17ac4383b678397c94d3b0a
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Sun Jun 14 17:04:52 2015 -0500
wmsun: Smart display refresh for fewer wake-ups and better responsiveness.
Patch by Peter Colberg <peterc at gmx.net> for Debian bug #446681 [1].
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=446681
---
wmsun.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/wmsun.c b/wmsun.c
index ba4a95d..3f38497 100644
--- a/wmsun.c
+++ b/wmsun.c
@@ -61,7 +61,7 @@
/*
* Delay between refreshes (in microseconds)
*/
-#define DELAY 10000L
+#define DELAY 1000000L
#define WMSUN_VERSION "1.03"
#define DegPerRad 57.29577951308232087680
@@ -108,6 +108,8 @@ int main(int argc, char *argv[]) {
long CurrentLocalTime, CurrentGMTTime, date;
double UT, val, LTRise, LTSet, LocalHour, hour24();
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
*/
RedrawWindow();
- usleep(DELAY);
+ timeout.tv_sec = DELAY / 1000000L;
+ timeout.tv_usec = DELAY % 1000000L;
+ select(ConnectionNumber(display) + 1, &xfdset, NULL, NULL, &timeout);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmsun.git
More information about the Pkg-wmaker-commits
mailing list