Description: wxWidgets 3.2 compatibility
Bug-Debian: https://bugs.debian.org/1019819
Forwarded: no
Author: Scott Talbert <swt@techie.net>
Last-Update: 2022-10-23

--- a/src/main.cpp
+++ b/src/main.cpp
@@ -625,14 +625,16 @@ END_EVENT_TABLE()
 
 TestGLCanvas::TestGLCanvas(wxWindow *_parent, wxWindowID id,
     const wxPoint& pos, const wxSize& size, long style, const wxString& name)
-    : wxGLCanvas(_parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name)
+    : wxGLCanvas(_parent, id, NULL, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name)
 {
   initdone=false;
   shownHQ=false;
+  m_glRC = new wxGLContext(this);
 }
 
 TestGLCanvas::~TestGLCanvas()
 {
+  delete m_glRC;
 }
 
 
@@ -660,11 +662,7 @@ void TestGLCanvas::OnPaint( wxPaintEvent
     /* must always be here */
     wxPaintDC dc(this);
 
-#ifndef __WXMOTIF__
-    if (!GetContext()) return;
-#endif
-
-    SetCurrent();
+    SetCurrent(*m_glRC);
 
     if (!initdone) {
       static bool once=false;
@@ -702,18 +700,12 @@ void TestGLCanvas::OnPaint( wxPaintEvent
 void TestGLCanvas::OnSize(wxSizeEvent& event)
 {
 
-    // this is also necessary to update the context on some platforms
-    wxGLCanvas::OnSize(event);
-
     // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
     
     GetClientSize(&winx, &winy);
     mainCanvas.SetVideoSize(winx);
-#ifndef __WXMOTIF__
-    if ( GetContext() )
-#endif
     {
-        SetCurrent();
+        SetCurrent(*m_glRC);
         glViewport(0, 0, (GLint) winx, (GLint) winy);
     }
 }
--- a/src/main.h
+++ b/src/main.h
@@ -141,6 +141,7 @@ public:
     
 private:
     //wxWindow *parent;
+    wxGLContext *m_glRC;
     DECLARE_EVENT_TABLE()
 };
 
