Fix 3D canvas blank area during window resize after wxWidgets 3.3.2 upgrade

This commit is contained in:
SoftFever
2026-03-28 15:46:34 +08:00
parent 779a36bf8b
commit c06a0223a7
2 changed files with 14 additions and 3 deletions

View File

@@ -4739,11 +4739,19 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
void GLCanvas3D::on_paint(wxPaintEvent& evt)
{
if (m_initialized)
if (m_initialized) {
#ifdef __WXMSW__
// Idle events are not dispatched during the Windows resize modal loop,
// so render immediately to avoid blank frames.
_refresh_if_shown_on_screen();
m_dirty = false;
#else
m_dirty = true;
else
#endif
} else {
// Call render directly, so it gets initialized immediately, not from On Idle handler.
this->render();
}
}
void GLCanvas3D::force_set_focus() {

View File

@@ -428,7 +428,10 @@ wxGLCanvas* OpenGLManager::create_wxglcanvas(wxWindow& parent)
if (! can_multisample())
attribList[12] = 0;
return new wxGLCanvas(&parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
wxGLCanvas* canvas = new wxGLCanvas(&parent, wxID_ANY, attribList, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
// The GL canvas paints its entire surface, so background erasing is unnecessary.
canvas->SetBackgroundStyle(wxBG_STYLE_PAINT);
return canvas;
}
void OpenGLManager::detect_multisample(int* attribList)