aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-14 12:56:25 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-11-01 09:57:22 (GMT)
commite945aceb6aa71db200dfb8db659f3248bb62af68 (patch)
treeb1428d78b17dd9b1332fa02196d811d282a24e7f /src/FbTk
parent70b63f6aee4a612e34c729d5d19e5b0e0626fc7e (diff)
downloadfluxbox_paul-e945aceb6aa71db200dfb8db659f3248bb62af68.zip
fluxbox_paul-e945aceb6aa71db200dfb8db659f3248bb62af68.tar.bz2
Attach a modifiedSig handler to the session.cacheLife resource
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/ImageControl.cc18
-rw-r--r--src/FbTk/ImageControl.hh4
2 files changed, 14 insertions, 8 deletions
diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc
index a5e5cd1..9eaec31 100644
--- a/src/FbTk/ImageControl.cc
+++ b/src/FbTk/ImageControl.cc
@@ -175,7 +175,7 @@ struct ImageControl::Cache {
175}; 175};
176 176
177ImageControl::ImageControl(int screen_num, 177ImageControl::ImageControl(int screen_num,
178 int cpc, unsigned long cache_timeout, unsigned long cmax): 178 int cpc, unsigned int cache_timeout, unsigned long cmax):
179 m_colors_per_channel(cpc), 179 m_colors_per_channel(cpc),
180 m_screen_num(screen_num) { 180 m_screen_num(screen_num) {
181 181
@@ -187,12 +187,9 @@ ImageControl::ImageControl(int screen_num,
187 187
188 cache_max = cmax; 188 cache_max = cmax;
189 189
190 if (cache_timeout && s_timed_cache) { 190 RefCount<Command<void> > clean_cache(new SimpleCommand<ImageControl>(*this, &ImageControl::cleanCache));
191 m_timer.setTimeout(cache_timeout); 191 m_timer.setCommand(clean_cache);
192 RefCount<Command<void> > clean_cache(new SimpleCommand<ImageControl>(*this, &ImageControl::cleanCache)); 192 setCacheTimeout(cache_timeout);
193 m_timer.setCommand(clean_cache);
194 m_timer.start();
195 }
196 193
197 createColorTable(); 194 createColorTable();
198} 195}
@@ -221,6 +218,13 @@ ImageControl::~ImageControl() {
221 } 218 }
222} 219}
223 220
221void ImageControl::setCacheTimeout(unsigned int cache_timeout) {
222 if (cache_timeout && s_timed_cache) {
223 m_timer.setTimeout(cache_timeout * 60000l);
224 m_timer.start();
225 } else
226 m_timer.stop();
227}
224 228
225Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, 229Pixmap ImageControl::searchCache(unsigned int width, unsigned int height,
226 const Texture &text, FbTk::Orientation orient) const { 230 const Texture &text, FbTk::Orientation orient) const {
diff --git a/src/FbTk/ImageControl.hh b/src/FbTk/ImageControl.hh
index 747525b..1795bbf 100644
--- a/src/FbTk/ImageControl.hh
+++ b/src/FbTk/ImageControl.hh
@@ -42,9 +42,11 @@ class Texture;
42class ImageControl: private NotCopyable { 42class ImageControl: private NotCopyable {
43public: 43public:
44 ImageControl(int screen_num, int colors_per_channel = 4, 44 ImageControl(int screen_num, int colors_per_channel = 4,
45 unsigned long cache_timeout = 300000l, unsigned long cache_max = 200l); 45 unsigned int cache_timeout = 5, unsigned long cache_max = 200l);
46 virtual ~ImageControl(); 46 virtual ~ImageControl();
47 47
48 void setCacheTimeout(unsigned int cache_timeout);
49
48 int depth() const { return m_screen_depth; } 50 int depth() const { return m_screen_depth; }
49 int colorsPerChannel() const { return m_colors_per_channel; } 51 int colorsPerChannel() const { return m_colors_per_channel; }
50 size_t nrColors() const { return m_colors.size(); } 52 size_t nrColors() const { return m_colors.size(); }