diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-14 12:56:25 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2013-02-18 21:04:22 (GMT) |
commit | 295bb1919bc748d369eb8b5597c1cd12577d3176 (patch) | |
tree | b7782bada32a49febe4dc275216629e3528249bd /src/FbTk | |
parent | 4ea546a91e7188ad6a95931637b7b928abd38342 (diff) | |
download | fluxbox_pavel-295bb1919bc748d369eb8b5597c1cd12577d3176.zip fluxbox_pavel-295bb1919bc748d369eb8b5597c1cd12577d3176.tar.bz2 |
Attach a modifiedSig handler to the session.cacheLife resource
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/ImageControl.cc | 18 | ||||
-rw-r--r-- | src/FbTk/ImageControl.hh | 4 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc index c99ef9a..510ea35 100644 --- a/src/FbTk/ImageControl.cc +++ b/src/FbTk/ImageControl.cc | |||
@@ -175,7 +175,7 @@ struct ImageControl::Cache { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | ImageControl::ImageControl(int screen_num, | 177 | ImageControl::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 * FbTk::FbTime::IN_MILLISECONDS); | 191 | m_timer.setCommand(clean_cache); |
192 | RefCount<Command<void> > clean_cache(new SimpleCommand<ImageControl>(*this, &ImageControl::cleanCache)); | 192 | setCacheTimeout(cache_timeout * FbTk::FbTime::IN_MILLISECONDS); |
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 | ||
221 | void 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 | ||
225 | Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, | 229 | Pixmap 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; | |||
42 | class ImageControl: private NotCopyable { | 42 | class ImageControl: private NotCopyable { |
43 | public: | 43 | public: |
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(); } |