X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fwidget.cc;h=2e2ec2ca7b634dbceaa9b27b93a09569201ffdb9;hb=75e8fc2705d9c606a702eb7057e9e503be90618b;hp=e53e3585e395b792173362b5c696a31345412a24;hpb=f29a2e9b0733e94e2cc27e6f4310ca62f8f07296;p=chaz%2Fopenbox diff --git a/otk/widget.cc b/otk/widget.cc index e53e3585..2e2ec2ca 100644 --- a/otk/widget.cc +++ b/otk/widget.cc @@ -23,8 +23,10 @@ Widget::Widget(Widget *parent, Direction direction) _visible(false), _grabbed_mouse(false), _grabbed_keyboard(false), _stretchable_vert(false), _stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0), - _bcolor(0), _bwidth(0), _screen(parent->screen()), _fixed_width(false), - _fixed_height(false), _event_dispatcher(parent->eventDispatcher()) + _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1), _screen(parent->screen()), + _fixed_width(false), _fixed_height(false), + _surface(0), + _event_dispatcher(parent->eventDispatcher()) { assert(parent); parent->addChild(this); @@ -42,8 +44,9 @@ Widget::Widget(EventDispatcher *event_dispatcher, Style *style, _bevel_width(bevel_width), _ignore_config(0), _visible(false), _grabbed_mouse(false), _grabbed_keyboard(false), _stretchable_vert(false), _stretchable_horz(false), _texture(0), - _bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), + _bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1), _screen(style->getScreen()), _fixed_width(false), _fixed_height(false), + _surface(0), _event_dispatcher(event_dispatcher) { assert(event_dispatcher); @@ -256,19 +259,18 @@ void Widget::ungrabKeyboard(void) void Widget::render(void) { if (!_texture) return; + printf("RENDER\n"); - _bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap); + Surface *s = _surface; // save the current surface + + _surface = new Surface(_screen, _rect.size()); + display->renderControl(_screen)->drawBackground(*_surface, *_texture); - if (_bg_pixmap) { - XSetWindowBackgroundPixmap(**display, _window, _bg_pixmap); - _bg_pixel = None; - } else { - unsigned int pix = _texture->color().pixel(); - if (pix != _bg_pixel) { - _bg_pixel = pix; - XSetWindowBackground(**display, _window, pix); - } - } + renderForeground(); + + XSetWindowBackgroundPixmap(**display, _window, _surface->pixmap()); + + delete s; // delete the old surface *after* its pixmap isn't in use anymore } void Widget::adjust(void) @@ -465,8 +467,7 @@ void Widget::setEventDispatcher(EventDispatcher *disp) void Widget::exposeHandler(const XExposeEvent &e) { EventHandler::exposeHandler(e); - _dirty = true; - update(); +// XClearArea(**display, _window, e.x, e.y, e.width, e.height, false); } void Widget::configureHandler(const XConfigureEvent &e)