From 71198e3928f934dd03ec624f4b36e66581ff77be Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 9 Sep 2021 10:41:33 +0200 Subject: [PATCH] #3385 macOS compatibility --- src/creawxVTKRenderWindowInteractor.cxx | 31 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/creawxVTKRenderWindowInteractor.cxx b/src/creawxVTKRenderWindowInteractor.cxx index 4eff58d..6bc66c2 100644 --- a/src/creawxVTKRenderWindowInteractor.cxx +++ b/src/creawxVTKRenderWindowInteractor.cxx @@ -63,8 +63,8 @@ // AKT: wxOSX 2.9.x defines __WXOSX_COCOA__ rather than __WXCOCOA__ #ifdef __WXOSX_COCOA__ - #import - #define __WXCOCOA__ + #import + #define __WXCOCOA__ #endif #if defined(__WXMAC__) && wxCHECK_VERSION(2,9,0) @@ -103,7 +103,6 @@ wxWindow* wxGetTopLevelParent(wxWindow *win) // To access objc calls on cocoa #ifdef __WXCOCOA__ #ifdef VTK_USE_COCOA -//EED #import // This trick is no longer need in VTK CVS, should get rid of that: #define id Id #else @@ -224,7 +223,11 @@ namespace crea END_EVENT_TABLE() //EED win Compilation why??: vtkCxxRevisionMacro(wxVTKRenderWindowInteractor, "$Revision$") -vtkInstantiatorNewMacro(wxVTKRenderWindowInteractor) + +//EED2020-04-10 +#if VTK_MAJOR_VERSION < 8 + vtkInstantiatorNewMacro(wxVTKRenderWindowInteractor) +#endif #if defined(__WXGTK__) && defined(USE_WXGLCANVAS) static int wxvtk_attributes[]={ @@ -391,12 +394,20 @@ void wxVTKRenderWindowInteractor::UpdateSize(int x, int y) Size[0] = x; Size[1] = y; // and our RenderWindow's size + +#ifdef __WXCOCOA__ + #ifdef VTK_USE_COCOA + #else + #endif //VTK_USE_COCOA +#else RenderWindow->SetSize(x, y); +#endif //__WXCOCOA__ + #if defined(__WXMSW__) this->Refresh(); #endif //__WXMSW__ - } - } + } // if x y + } // if RenderWindow } //--------------------------------------------------------------------------- int wxVTKRenderWindowInteractor::CreateTimer(int WXUNUSED(timertype)) @@ -501,7 +512,11 @@ long wxVTKRenderWindowInteractor::GetHandleHack() void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) { //must always be here - wxPaintDC pDC(this); +//EED2021-08-26 +#ifdef __WXCOCOA__ +#else + wxPaintDC pDC(this); +#endif //do it here rather than in the cstor: this is safer. if(!Handle) @@ -517,8 +532,6 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) #else RenderWindow->SetWindowId(reinterpret_cast(Handle)); #endif - - // Cocoa // this->GetNSView() <-> DisplayId -- 2.47.1