mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 18:27:58 -06:00
Windows specific refactoring of Mouse3DController and RemovableDriveManager.
PrusaSlicer newly registers by Windows operating system for HID USB plug / unplug notifications and for Volume attach / detach notifications, and the background threads of the two respective services are waken up on these Windows notifications. The RemovableDriveManager also wakes up every 30 seconds to cope with the drives ejected from Windows Explorer or from another application, for example Cura, for which Windows OS does not send out notifications.
This commit is contained in:
parent
3684eea53d
commit
2f6326a2eb
10 changed files with 207 additions and 109 deletions
|
@ -84,6 +84,11 @@ public:
|
|||
// It would be better to make this method private and friend to RemovableDriveManagerMM, but RemovableDriveManagerMM is an ObjectiveC class.
|
||||
void update();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Called by Win32 Volume arrived / detached callback.
|
||||
void volumes_changed();
|
||||
#endif // _WIN32
|
||||
|
||||
private:
|
||||
bool m_initialized { false };
|
||||
wxEvtHandler* m_callback_evt_handler { nullptr };
|
||||
|
@ -95,6 +100,9 @@ private:
|
|||
std::condition_variable m_thread_stop_condition;
|
||||
mutable std::mutex m_thread_stop_mutex;
|
||||
bool m_stop { false };
|
||||
#ifdef _WIN32
|
||||
std::atomic<bool> m_wakeup { false };
|
||||
#endif /* _WIN32 */
|
||||
#endif // REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
|
||||
|
||||
// Called from update() to enumerate removable drives.
|
||||
|
@ -114,10 +122,7 @@ private:
|
|||
// Set with set_and_verify_last_save_path() to a removable drive path to be ejected.
|
||||
std::string m_last_save_path;
|
||||
|
||||
#if _WIN32
|
||||
//registers for notifications by creating invisible window
|
||||
//void register_window_msw();
|
||||
#elif __APPLE__
|
||||
#if __APPLE__
|
||||
void register_window_osx();
|
||||
void unregister_window_osx();
|
||||
void list_devices(std::vector<DriveData> &out) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue