[wxVTK] wxVTK/src wxVTKRenderWindowInteractor.cxx, 1.44, 1.45 wxVTKRenderWindowInteractor.h, 1.21,
Brought to you by:
malat
From: Sander N. <svn...@us...> - 2008-12-03 10:31:52
|
Update of /cvsroot/wxvtk/wxVTK/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17726/src Modified Files: wxVTKRenderWindowInteractor.cxx wxVTKRenderWindowInteractor.h Log Message: ENH: Added implementations of InternalCreateTimer and InternalDestroyTimer so timers will again work with VTK 5.2 ENH: To fix display issues with GTK2 (first render fails and incorrect z-ordering), wxVTKRenderWindowInteractor now also derives from wxGLCanvas for wxGTK 2.8. To solve the crashes that result from this change we now explicitly set the DisplayId on the RenderWindow. This will prevent VTK from destroying the X Display (which was the cause of the crashes). As a side result the wxVTKNotebook sample no longer has to call SetDisplayId anymore. Index: wxVTKRenderWindowInteractor.h =================================================================== RCS file: /cvsroot/wxvtk/wxVTK/src/wxVTKRenderWindowInteractor.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wxVTKRenderWindowInteractor.h 10 Aug 2008 22:58:28 -0000 1.21 --- wxVTKRenderWindowInteractor.h 3 Dec 2008 10:31:46 -0000 1.22 *************** *** 56,67 **** #include "vtkRenderWindow.h" - // Apparently since wxGTK 2.8.0 one can finally use wxWindow (just as in any - // other port): - // MM: tested on 2008/04/08: experienced some heavy flickering with wx-widget 2.6.0 - // using a wxWindow instead of wxGLCanvas fixed the symptoms - //#if (!wxCHECK_VERSION(2, 6, 0)) - #if (!wxCHECK_VERSION(2, 8, 0)) #define USE_WXGLCANVAS - #endif #if defined(__WXGTK__) && defined(USE_WXGLCANVAS) --- 56,60 ---- *************** *** 160,163 **** --- 153,160 ---- protected: + virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration); + virtual int InternalDestroyTimer(int platformTimerId); + + protected: wxTimer timer; int ActiveButton; Index: wxVTKRenderWindowInteractor.cxx =================================================================== RCS file: /cvsroot/wxvtk/wxVTK/src/wxVTKRenderWindowInteractor.cxx,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** wxVTKRenderWindowInteractor.cxx 20 Oct 2008 11:24:06 -0000 1.44 --- wxVTKRenderWindowInteractor.cxx 3 Dec 2008 10:31:46 -0000 1.45 *************** *** 286,294 **** // it's a one shot timer if (!timer.Start(10, TRUE)) ! assert(false); return 1; } //--------------------------------------------------------------------------- int wxVTKRenderWindowInteractor::DestroyTimer() --- 286,309 ---- // it's a one shot timer if (!timer.Start(10, TRUE)) ! return 0; return 1; } + //------------------------------------------------------------------ + int wxVTKRenderWindowInteractor::InternalCreateTimer(int timerId, int timerType, + unsigned long duration) + { + if (!timer.Start(duration, timerType == OneShotTimer)) + return 0; + + return ID_wxVTKRenderWindowInteractor_TIMER; + } + //------------------------------------------------------------------ + int wxVTKRenderWindowInteractor::InternalDestroyTimer(int platformTimerId) + { + timer.Stop(); + return 1; + } //--------------------------------------------------------------------------- int wxVTKRenderWindowInteractor::DestroyTimer() *************** *** 304,312 **** #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0) ! // new style ! InvokeEvent(vtkCommand::TimerEvent, NULL); #else ! // old style ! InteractorStyle->OnTimer(); #endif } --- 319,328 ---- #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0) ! // new style ! int timerId = this->GetCurrentTimerId(); ! this->InvokeEvent(vtkCommand::TimerEvent, &timerId); #else ! // old style ! InteractorStyle->OnTimer(); #endif } *************** *** 375,378 **** --- 391,400 ---- RenderWindow->SetParentId(reinterpret_cast<void *>(this->GetParent()->GetHWND())); #endif //__WXMSW__ + + // This is another hack to prevent the VTK Render Window from closing the display. + // If VTK closes the display, ~wxContext chashes while trying to destroy its + // glContext (because the display is closed). The Get -> Set makes this VTK + // object think someone else is responsible for the display. + this->RenderWindow->SetDisplayId(this->RenderWindow->GetGenericDisplayId()); } // get vtk to render to the wxWindows |