Improve and document wxGLCanvas::CreateSurface()
This function must be called to be able to re-create the EGL drawing surface after the window layout have changed, such as after a reparent of the canvas or of it's grandparents. Make it suitable for use in this case by re-creating the surface if there already was one and document this function to make it part of the public API. Closes #23366.
This commit is contained in:
parent
e1c3962aa9
commit
23ccdb23c8
2 changed files with 19 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue