all repos — openbox @ 68a6fce53badb38ba3dc387c4b5c86c02801f657

openbox fork - make it a bit more like ryudo

dont try free the widget's pixmap until it is no longer in use
Dana Jansens danakj@orodu.net
commit

68a6fce53badb38ba3dc387c4b5c86c02801f657

parent

24e20d5ed6f07f61bbc8ee2bdeac377ca2373bdb

M otk/focuslabel.ccotk/focuslabel.cc

@@ -67,7 +67,7 @@ }

} display->renderControl(_screen)-> - drawString(_surface, *ft, x, 0, *text_color, t); + drawString(*_surface, *ft, x, 0, *text_color, t); } }
M otk/label.ccotk/label.cc

@@ -61,7 +61,7 @@ }

} display->renderControl(_screen)-> - drawString(_surface, *ft, x, 0, *style()->getTextUnfocus(), t); + drawString(*_surface, *ft, x, 0, *style()->getTextUnfocus(), t); } }
M otk/rendertest.ccotk/rendertest.cc

@@ -13,7 +13,7 @@ otk::Application app(argc, argv);

otk::AppWidget foo(&app); foo.resize(600, 500); - otk::RenderColor color(0, 0xff, 0x20, 0x20); + otk::RenderColor color(0, 0, 0xff, 0xff); otk::RenderTexture tex(false, otk::RenderTexture::Flat, false,
M otk/surface.ccotk/surface.cc

@@ -39,7 +39,6 @@ }

void Surface::setPixmap(XImage *image) { - printf("SET PIXMAP\n"); assert(image->width == _size.x()); assert(image->height == _size.y());
M otk/truerendercontrol.ccotk/truerendercontrol.cc

@@ -132,5 +132,7 @@ // sf.setPixmap(RenderColor(_screen, 0xff, 0xff, 0));

delete [] im->data; im->data = NULL; - XDestroyImage(im);} + XDestroyImage(im); +} + }
M otk/widget.ccotk/widget.cc

@@ -25,7 +25,7 @@ _grabbed_keyboard(false), _stretchable_vert(false),

_stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1), _screen(parent->screen()), _fixed_width(false), _fixed_height(false), - _surface(parent->screen(), _rect.size()), + _surface(0), _event_dispatcher(parent->eventDispatcher()) { assert(parent);

@@ -46,7 +46,7 @@ _grabbed_mouse(false), _grabbed_keyboard(false),

_stretchable_vert(false), _stretchable_horz(false), _texture(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(style->getScreen(), _rect.size()), + _surface(0), _event_dispatcher(event_dispatcher) { assert(event_dispatcher);

@@ -261,12 +261,16 @@ {

if (!_texture) return; printf("RENDER\n"); - _surface = Surface(_screen, _rect.size()); - display->renderControl(_screen)->drawBackground(_surface, *_texture); + Surface *s = _surface; // save the current surface + + _surface = new Surface(_screen, _rect.size()); + display->renderControl(_screen)->drawBackground(*_surface, *_texture); renderForeground(); - XSetWindowBackgroundPixmap(**display, _window, _surface.pixmap()); + XSetWindowBackgroundPixmap(**display, _window, _surface->pixmap()); + + delete s; // delete the old surface *after* its pixmap isn't in use anymore } void Widget::adjust(void)
M otk/widget.hhotk/widget.hh

@@ -167,7 +167,7 @@

bool _fixed_width; bool _fixed_height; - Surface _surface; + Surface *_surface; EventDispatcher *_event_dispatcher; };