Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2020-03-06 17:10:58 +0300
committerbubnikv <bubnikv@gmail.com>2020-03-06 17:10:58 +0300
commitb3b800de656db89d0b50ca574b15eea0796383f7 (patch)
treefa565ba37d036a30ccfedea6cef713be47bc17f8 /src/slic3r/GUI/Event.hpp
parent85bf78f7e779d838404bef0854bc7c29fd20dbbb (diff)
Refactoring of RemovableDriveManager:
1) On Windows and Linux, the device enumeration now runs at a background thread, while it ran on the UI thread on idle, which may have been blocking on some rare Windows setups, see GH #3515 #3733 #3746 #3766 2) On OSX, the device enumeration now relies on OS callback, no polling is required. 3) Refactored for cleaner interface.
Diffstat (limited to 'src/slic3r/GUI/Event.hpp')
-rw-r--r--src/slic3r/GUI/Event.hpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/slic3r/GUI/Event.hpp b/src/slic3r/GUI/Event.hpp
index 429ef99b0..b9816a747 100644
--- a/src/slic3r/GUI/Event.hpp
+++ b/src/slic3r/GUI/Event.hpp
@@ -40,11 +40,19 @@ template<class T, size_t N> struct ArrayEvent : public wxEvent
return new ArrayEvent<T, N>(GetEventType(), data, GetEventObject());
}
};
-template<class T> struct ArrayEvent<T, 1> : public wxEvent
+
+template<class T> struct Event : public wxEvent
{
T data;
- ArrayEvent(wxEventType type, T data, wxObject* origin = nullptr)
+ Event(wxEventType type, const T &data, wxObject* origin = nullptr)
+ : wxEvent(0, type), data(std::move(data))
+ {
+ m_propagationLevel = wxEVENT_PROPAGATE_MAX;
+ SetEventObject(origin);
+ }
+
+ Event(wxEventType type, T&& data, wxObject* origin = nullptr)
: wxEvent(0, type), data(std::move(data))
{
m_propagationLevel = wxEVENT_PROPAGATE_MAX;
@@ -53,13 +61,10 @@ template<class T> struct ArrayEvent<T, 1> : public wxEvent
virtual wxEvent* Clone() const
{
- return new ArrayEvent<T, 1>(GetEventType(), data, GetEventObject());
+ return new Event<T>(GetEventType(), data, GetEventObject());
}
};
-template <class T> using Event = ArrayEvent<T, 1>;
-
-
}
}