From 700c2998443f3fc42dc9f47e480cc16fc8fa7736 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 29 Feb 2012 12:51:36 +0000 Subject: [PATCH] hack to make decorators work --- panda/src/rocket/rocketRegion.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/panda/src/rocket/rocketRegion.cxx b/panda/src/rocket/rocketRegion.cxx index febefb091e..433de05a92 100644 --- a/panda/src/rocket/rocketRegion.cxx +++ b/panda/src/rocket/rocketRegion.cxx @@ -33,6 +33,12 @@ RocketRegion(GraphicsOutput *window, const LVecBase4 &dr_dimensions, const string &context_name) : DisplayRegion(window, dr_dimensions) { + // A hack I don't like. libRocket's decorator system has + // a bug somewhere, and this seems to be a workaround. + if (Rocket::Core::GetRenderInterface() == NULL) { + Rocket::Core::SetRenderInterface(&_interface); + } + int pl, pr, pb, pt; get_pixels(pl, pr, pb, pt); Rocket::Core::Vector2i dimensions (pr - pl, pt - pb); @@ -59,6 +65,10 @@ RocketRegion(GraphicsOutput *window, const LVecBase4 &dr_dimensions, //////////////////////////////////////////////////////////////////// RocketRegion:: ~RocketRegion() { + if (Rocket::Core::GetRenderInterface() == &_interface) { + Rocket::Core::SetRenderInterface(NULL); + } + if (_context != NULL) { if (_context->GetReferenceCount() > 1) { _context->RemoveReference();