diff options
| author | Michael M <mchtly@gmail.com> | 2017-11-04 07:36:30 -0700 |
|---|---|---|
| committer | Michael M <mchtly@gmail.com> | 2017-11-10 13:37:42 -0800 |
| commit | 1ed7532af850691eea8d7eee502f59ed20a37694 (patch) | |
| tree | 12160efda662a6145e68657cd3f6dc76c73ce3f8 /Source/Core/InputCommon/ControllerInterface | |
| parent | 7355b5f70d2bdf68c356873f2311025a81c7972a (diff) | |
ControllerInterface: HotplugCallbacks -> DevicesChangedCallbacks
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | 7 |
2 files changed, 13 insertions, 14 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 4f35c4a989..1552cd7dc2 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -188,7 +188,7 @@ void ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device NOTICE_LOG(SERIALINTERFACE, "Added device: %s", device->GetQualifiedName().c_str()); m_devices.emplace_back(std::move(device)); } - InvokeHotplugCallbacks(); + InvokeDevicesChangedCallbacks(); } void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::Device*)> callback) @@ -205,7 +205,7 @@ void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::De }); m_devices.erase(it, m_devices.end()); } - InvokeHotplugCallbacks(); + InvokeDevicesChangedCallbacks(); } // @@ -225,23 +225,23 @@ void ControllerInterface::UpdateInput() } // -// RegisterHotplugCallback +// RegisterDevicesChangedCallback // -// Register a callback to be called from the input backends' hotplug thread -// when there is a new device +// Register a callback to be called when a device is added or removed (as from the input backends' +// hotplug thread), or when devices are refreshed // -void ControllerInterface::RegisterHotplugCallback(std::function<void()> callback) +void ControllerInterface::RegisterDevicesChangedCallback(std::function<void()> callback) { - m_hotplug_callbacks.emplace_back(std::move(callback)); + m_devices_changed_callbacks.emplace_back(std::move(callback)); } // -// InvokeHotplugCallbacks +// InvokeDevicesChangedCallbacks // // Invoke all callbacks that were registered // -void ControllerInterface::InvokeHotplugCallbacks() const +void ControllerInterface::InvokeDevicesChangedCallbacks() const { - for (const auto& callback : m_hotplug_callbacks) + for (const auto& callback : m_devices_changed_callbacks) callback(); } diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index eb94a8de67..e70c135b3e 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -53,12 +53,11 @@ public: bool IsInit() const { return m_is_init; } void UpdateInput(); - void RegisterHotplugCallback(std::function<void(void)> callback); + void RegisterDevicesChangedCallback(std::function<void(void)> callback); + void InvokeDevicesChangedCallbacks() const; private: - void InvokeHotplugCallbacks() const; - - std::vector<std::function<void()>> m_hotplug_callbacks; + std::vector<std::function<void()>> m_devices_changed_callbacks; bool m_is_init; void* m_hwnd; }; |
