Reworked the 3DConnexion interfacing code to run the device

enumeration / connect / disconnect and read out at the background
thread only.
This commit is contained in:
bubnikv 2020-03-04 11:36:36 +01:00
parent a87ba5d6a6
commit 0b96855c2e
8 changed files with 603 additions and 593 deletions

View file

@ -109,7 +109,8 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
return;
}
if(m_plater) m_plater->stop_jobs();
if (m_plater)
m_plater->stop_jobs();
// Weird things happen as the Paint messages are floating around the windows being destructed.
// Avoid the Paint messages by hiding the main window.
@ -117,6 +118,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
// In addition, there were some crashes due to the Paint events sent to already destructed windows.
this->Show(false);
// Stop the background thread (Windows and Linux).
// Disconnect from a 3DConnextion driver (OSX).
m_plater->get_mouse3d_controller().shutdown();
// Store the device parameter database back to appconfig.
m_plater->get_mouse3d_controller().save_config(*wxGetApp().app_config);
// Save the slic3r.ini.Usually the ini file is saved from "on idle" callback,
// but in rare cases it may not have been called yet.
wxGetApp().app_config->save();