Browse Source

hack to make decorators work

rdb 14 years ago
parent
commit
700c299844
1 changed files with 10 additions and 0 deletions
  1. 10 0
      panda/src/rocket/rocketRegion.cxx

+ 10 - 0
panda/src/rocket/rocketRegion.cxx

@@ -33,6 +33,12 @@ RocketRegion(GraphicsOutput *window, const LVecBase4 &dr_dimensions,
              const string &context_name) :
              const string &context_name) :
   DisplayRegion(window, dr_dimensions) {
   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;
   int pl, pr, pb, pt;
   get_pixels(pl, pr, pb, pt);
   get_pixels(pl, pr, pb, pt);
   Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
   Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
@@ -59,6 +65,10 @@ RocketRegion(GraphicsOutput *window, const LVecBase4 &dr_dimensions,
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 RocketRegion::
 RocketRegion::
 ~RocketRegion() {
 ~RocketRegion() {
+  if (Rocket::Core::GetRenderInterface() == &_interface) {
+    Rocket::Core::SetRenderInterface(NULL);
+  }
+
   if (_context != NULL) {
   if (_context != NULL) {
     if (_context->GetReferenceCount() > 1) {
     if (_context->GetReferenceCount() > 1) {
       _context->RemoveReference();
       _context->RemoveReference();