ImageControl *ctrl = 0;
-ImageControl::ImageControl(TimerQueueManager *timermanager,
- const ScreenInfo *scrn,
- bool _dither, int _cpc,
- unsigned long cache_timeout,
- unsigned long cmax) {
+ImageControl::ImageControl(const ScreenInfo *scrn,
+ bool _dither, int _cpc,
+ unsigned long cache_timeout,
+ unsigned long cmax) {
if (! ctrl) ctrl = this;
screeninfo = scrn;
setColorsPerChannel(_cpc);
cache_max = cmax;
- if (cache_timeout) {
- timer = new Timer(timermanager, (TimeoutHandler)timeout, this);
- timer->setTimeout(cache_timeout);
- timer->start();
- } else {
+ if (cache_timeout)
+ timer = new Timer(cache_timeout, (Timer::TimeoutHandler)timeout, this);
+ else
timer = (Timer *) 0;
- }
colors = (XColor *) 0;
ncolors = 0;
colormap = screeninfo->colormap();
int count;
- XPixmapFormatValues *pmv = XListPixmapFormats(Display::display,
+ XPixmapFormatValues *pmv = XListPixmapFormats(**display,
&count);
if (pmv) {
bits_per_pixel = 0;
}
for (i = 0; i < ncolors; i++) {
- if (! XAllocColor(Display::display, colormap, &colors[i])) {
+ if (! XAllocColor(**display, colormap, &colors[i])) {
fprintf(stderr, "couldn't alloc color %i %i %i\n",
colors[i].red, colors[i].green, colors[i].blue);
colors[i].flags = 0;
for (i = 0; i < incolors; i++)
icolors[i].pixel = i;
- XQueryColors(Display::display, colormap, icolors, incolors);
+ XQueryColors(**display, colormap, icolors, incolors);
for (i = 0; i < ncolors; i++) {
if (! colors[i].flags) {
unsigned long chk = 0xffffffff, pixel, close = 0;
colors[i].green = icolors[close].green;
colors[i].blue = icolors[close].blue;
- if (XAllocColor(Display::display, colormap,
+ if (XAllocColor(**display, colormap,
&colors[i])) {
colors[i].flags = DoRed|DoGreen|DoBlue;
break;
colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);;
colors[i].flags = DoRed|DoGreen|DoBlue;
- if (! XAllocColor(Display::display, colormap,
+ if (! XAllocColor(**display, colormap,
&colors[i])) {
fprintf(stderr, "couldn't alloc color %i %i %i\n",
colors[i].red, colors[i].green, colors[i].blue);
for (i = 0; i < incolors; i++)
icolors[i].pixel = i;
- XQueryColors(Display::display, colormap, icolors, incolors);
+ XQueryColors(**display, colormap, icolors, incolors);
for (i = 0; i < ncolors; i++) {
if (! colors[i].flags) {
unsigned long chk = 0xffffffff, pixel, close = 0;
colors[i].green = icolors[close].green;
colors[i].blue = icolors[close].blue;
- if (XAllocColor(Display::display, colormap,
+ if (XAllocColor(**display, colormap,
&colors[i])) {
colors[i].flags = DoRed|DoGreen|DoBlue;
break;
for (int i = 0; i < ncolors; i++)
*(pixels + i) = (*(colors + i)).pixel;
- XFreeColors(Display::display, colormap, pixels, ncolors, 0);
+ XFreeColors(**display, colormap, pixels, ncolors, 0);
delete [] colors;
}
CacheContainer::iterator it = cache.begin();
const CacheContainer::iterator end = cache.end();
for (; it != end; ++it)
- XFreePixmap(Display::display, it->pixmap);
+ XFreePixmap(**display, it->pixmap);
}
- if (timer) {
- timer->stop();
+ if (timer)
delete timer;
- }
}
void ImageControl::installRootColormap(void) {
int ncmap = 0;
Colormap *cmaps =
- XListInstalledColormaps(Display::display, window, &ncmap);
+ XListInstalledColormaps(**display, window, &ncmap);
if (cmaps) {
bool install = True;
install = False;
if (install)
- XInstallColormap(Display::display, colormap);
+ XInstallColormap(**display, colormap);
XFree(cmaps);
}
CacheCleaner() {}
inline void operator()(const ImageControl::CachedImage& image) const {
if (ref_check(image))
- XFreePixmap(Display::display, image.pixmap);
+ XFreePixmap(**display, image.pixmap);
}
};