summaryrefslogtreecommitdiff
path: root/otk/imagecontrol.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-11-03 14:29:34 +0000
committerDana Jansens <danakj@orodu.net>2002-11-03 14:29:34 +0000
commit9259ec5732851dd66f7c598d629e3808ac7ab3d8 (patch)
tree5452b84b8937cde5f6977f26c24361cc1c0a5f08 /otk/imagecontrol.cc
parentad80ef0f667e3b72d9e35d7a93451a1e2dfa0ab6 (diff)
new timer infrastructure. takes a function pointer for the timeout, with a void* parameter (useful for holding a class instance!)
Diffstat (limited to 'otk/imagecontrol.cc')
-rw-r--r--otk/imagecontrol.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/otk/imagecontrol.cc b/otk/imagecontrol.cc
index 7120f1cf..8cc6b2af 100644
--- a/otk/imagecontrol.cc
+++ b/otk/imagecontrol.cc
@@ -41,7 +41,8 @@ static unsigned long bsqrt(unsigned long x) {
BImageControl *ctrl = 0;
-BImageControl::BImageControl(const ScreenInfo *scrn,
+BImageControl::BImageControl(OBTimerQueueManager *timermanager,
+ const ScreenInfo *scrn,
bool _dither, int _cpc,
unsigned long cache_timeout,
unsigned long cmax) {
@@ -53,12 +54,11 @@ BImageControl::BImageControl(const ScreenInfo *scrn,
cache_max = cmax;
if (cache_timeout) {
- // XXX: FIX THIS
- timer = 0;/*new BTimer(this);
+ timer = new OBTimer(timermanager, (OBTimeoutHandler)timeout, this);
timer->setTimeout(cache_timeout);
- timer->start();*/
+ timer->start();
} else {
- timer = (ob::OBTimer *) 0;
+ timer = (OBTimer *) 0;
}
colors = (XColor *) 0;
@@ -420,7 +420,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
"forcing cleanout\n");
#endif // DEBUG
- timeout();
+ timeout(this);
}
return pixmap;
@@ -440,7 +440,7 @@ void BImageControl::removeImage(Pixmap pixmap) {
}
if (! timer)
- timeout();
+ timeout(this);
}
@@ -553,10 +553,10 @@ struct CacheCleaner {
};
-void BImageControl::timeout(void) {
+void BImageControl::timeout(BImageControl *t) {
CacheCleaner cleaner;
- std::for_each(cache.begin(), cache.end(), cleaner);
- cache.remove_if(cleaner.ref_check);
+ std::for_each(t->cache.begin(), t->cache.end(), cleaner);
+ t->cache.remove_if(cleaner.ref_check);
}
}