Generate a size event for wxGLCanvas when it is realized

This ensures that a wxSizeEvent handler can set the initial viewport size correctly.
Fixes the initial display of the pyramid sample with GTK2.
This commit is contained in:
Paul Cornett
2019-06-12 22:19:17 -07:00
parent 7d5b467633
commit 780b8720c0
2 changed files with 9 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11 class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11
{ {
typedef wxGLCanvasX11 BaseType;
public: public:
wxGLCanvas(wxWindow *parent, wxGLCanvas(wxWindow *parent,
const wxGLAttributes& dispAttrs, const wxGLAttributes& dispAttrs,
@@ -110,6 +111,7 @@ public:
// implementation from now on // implementation from now on
void OnInternalIdle() wxOVERRIDE; void OnInternalIdle() wxOVERRIDE;
virtual void GTKHandleRealized() wxOVERRIDE;
bool m_exposed; bool m_exposed;
#ifdef __WXGTK3__ #ifdef __WXGTK3__

View File

@@ -332,6 +332,13 @@ Window wxGLCanvas::GetXWindow() const
return window ? GDK_WINDOW_XID(window) : 0; return window ? GDK_WINDOW_XID(window) : 0;
} }
void wxGLCanvas::GTKHandleRealized()
{
BaseType::GTKHandleRealized();
SendSizeEvent();
}
void wxGLCanvas::OnInternalIdle() void wxGLCanvas::OnInternalIdle()
{ {
if (m_exposed) if (m_exposed)