diff --git a/interface/wx/glcanvas.h b/interface/wx/glcanvas.h index 0b0e1f7bd7..20e55b3763 100644 --- a/interface/wx/glcanvas.h +++ b/interface/wx/glcanvas.h @@ -887,6 +887,19 @@ public: const wxString& name = "GLCanvas", const wxPalette& palette = wxNullPalette); + + /** + Re-creates EGLSurface. To be used after a reparent or other + changes that may invalidate the EGL drawing surface. + + Only available when wxUSE_GLCANVAS_EGL is enabled. + + @return @true if surface is successfully recreated + + @since 3.2.3 + */ + bool CreateSurface(); + /** Determines if a canvas having the specified attributes is available. This only applies for visual attributes, not rendering context attributes. diff --git a/src/unix/glegl.cpp b/src/unix/glegl.cpp index 5e94e99876..97e6237ca5 100644 --- a/src/unix/glegl.cpp +++ b/src/unix/glegl.cpp @@ -458,6 +458,12 @@ bool wxGLCanvasEGL::CreateSurface() return false; } + if ( m_surface != EGL_NO_SURFACE ) + { + eglDestroySurface(m_surface, m_display); + m_surface = EGL_NO_SURFACE; + } + GdkWindow *window = GTKGetDrawingWindow(); #ifdef GDK_WINDOWING_X11 if (wxGTKImpl::IsX11(window))