- if (_bg_pixmap)
- XSetWindowBackgroundPixmap(otk::OBDisplay::display, _window, _bg_pixmap);
- else {
- unsigned int pix = _texture->color().pixel();
- if (pix != _bg_pixel) {
- _bg_pixel = pix;
- XSetWindowBackground(otk::OBDisplay::display, _window, pix);
- }
- }
+ Surface *s = _surface; // save the current surface
+
+ _surface = new Surface(_screen, _rect.size());
+ display->renderControl(_screen)->drawBackground(*_surface, *_texture);
+
+ renderForeground(); // for inherited types to render onto the _surface
+
+ XSetWindowBackgroundPixmap(**display, _window, _surface->pixmap());
+
+ delete s; // delete the old surface *after* its pixmap isn't in use anymore