Postpone post_init() until opengl is initialized on all systems.

Revert on win
This commit is contained in:
David Kocik 2023-03-01 13:33:44 +01:00
parent e09bdef952
commit dfe735fb6c
2 changed files with 6 additions and 9 deletions

View file

@ -887,13 +887,9 @@ wxGLContext* GUI_App::init_glcontext(wxGLCanvas& canvas)
bool GUI_App::init_opengl() bool GUI_App::init_opengl()
{ {
#ifdef __linux__
bool status = m_opengl_mgr.init_gl(); bool status = m_opengl_mgr.init_gl();
m_opengl_initialized = true; m_opengl_initialized = true;
return status; return status;
#else
return m_opengl_mgr.init_gl();
#endif
} }
// gets path to PrusaSlicer.ini, returns semver from first line comment // gets path to PrusaSlicer.ini, returns semver from first line comment
@ -1370,12 +1366,15 @@ bool GUI_App::on_init_inner()
// An ugly solution to GH #5537 in which GUI_App::init_opengl (normally called from events wxEVT_PAINT // An ugly solution to GH #5537 in which GUI_App::init_opengl (normally called from events wxEVT_PAINT
// and wxEVT_SET_FOCUS before GUI_App::post_init is called) wasn't called before GUI_App::post_init and OpenGL wasn't initialized. // and wxEVT_SET_FOCUS before GUI_App::post_init is called) wasn't called before GUI_App::post_init and OpenGL wasn't initialized.
#ifdef __linux__ // Since issue #9774 Where same problem occured on MacOS Ventura, we decided to have this check on MacOS as well.
if (! m_post_initialized && m_opengl_initialized) {
#ifdef __linux__ || __APPLE__
if (!m_post_initialized && m_opengl_initialized) {
#else #else
if (! m_post_initialized) { if (!m_post_initialized) {
#endif #endif
m_post_initialized = true; m_post_initialized = true;
#ifdef WIN32 #ifdef WIN32
this->mainframe->register_win32_callbacks(); this->mainframe->register_win32_callbacks();
#endif #endif

View file

@ -127,9 +127,7 @@ private:
bool m_last_app_conf_lower_version{ false }; bool m_last_app_conf_lower_version{ false };
EAppMode m_app_mode{ EAppMode::Editor }; EAppMode m_app_mode{ EAppMode::Editor };
bool m_is_recreating_gui{ false }; bool m_is_recreating_gui{ false };
#ifdef __linux__
bool m_opengl_initialized{ false }; bool m_opengl_initialized{ false };
#endif
wxColour m_color_label_modified; wxColour m_color_label_modified;
wxColour m_color_label_sys; wxColour m_color_label_sys;