Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#228 [PATCH] configurable clock update interval to reduce wakeups

open
nobody
5
2010-10-11
2010-10-11
Timo Lindfors
No

[Patch also attached]

From 4617021c95e5ddc1fdb15a39a412f65a02fe3f41 Mon Sep 17 00:00:00 2001
From: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Date: Mon, 11 Oct 2010 14:28:08 +0300
Subject: [PATCH] Add new option TaskBarClockUpdateInterval for reducing wakeups from idle

Currently icewm wakes up every second to update the clock even if it
only shows hours and minutes. Detecting if %S is used is hard. This
patch implements an option that lets the user to manually specify how
often he wants the clock to update itself. Future improvement would of
course be to synchronize this to real time somehow.
---
src/aclock.cc | 2 +-
src/default.h | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/aclock.cc b/src/aclock.cc
index 1cf2f7b..b4a2888 100644
--- a/src/aclock.cc
+++ b/src/aclock.cc
@@ -57,7 +57,7 @@ YClock::YClock(YWindow *aParent): YWindow(aParent) {
toolTipUTC = false;
transparent = -1;

- clockTimer = new YTimer(1000);
+ clockTimer = new YTimer(taskBarClockUpdateInterval);
clockTimer->setTimerListener(this);
clockTimer->startTimer();
autoSize();
diff --git a/src/default.h b/src/default.h
index 2951b46..5a83523 100644
--- a/src/default.h
+++ b/src/default.h
@@ -175,6 +175,7 @@ XSV(const char *, logoutCancelCommand, 0)
XSV(const char *, shutdownCommand, 0)
XSV(const char *, rebootCommand, 0)
XIV(int, taskBarCPUDelay, 500)
+XIV(int, taskBarClockUpdateInterval, 1000)
XIV(int, taskBarNetSamples, 20)
XIV(int, taskBarNetDelay, 500)
XSV(const char *, cpuCommand, "x-terminal-emulator -name top -title Process\\ Status -e top")
@@ -365,6 +366,7 @@ cfoption icewm_preferences[] = {
#ifdef CONFIG_TASKBAR
OIV("TaskBarCPUSamples", &taskBarCPUSamples, 2, 1000, "Width of CPU Monitor"),
OIV("TaskBarCPUDelay", &taskBarCPUDelay, 10, (60*60*1000), "Delay between CPU Monitor samples in ms"),
+ OIV("TaskBarClockUpdateInterval", &taskBarClockUpdateInterval, 10, (60*60*1000), "Clock update interval in ms"),
OIV("TaskBarNetSamples", &taskBarNetSamples, 2, 1000, "Width of Net Monitor"),
OIV("TaskBarNetDelay", &taskBarNetDelay, 10, (60*60*1000), "Delay between Net Monitor samples in ms"),
OIV("TaskbarButtonWidthDivisor", &taskBarButtonWidthDivisor, 1, 25, "default number of tasks in taskbar"),
--
1.7.1

Discussion