mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-05 06:34:25 -04:00
Make device list change warning callback
This will be helpful for keeping plugins from crashing Commit amended to change callback function name for consistency by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
@@ -172,6 +172,12 @@ void ResourceManager::RegisterDeviceListChangeCallback(DeviceListChangeCallback
|
||||
DeviceListChangeCallbackArgs.push_back(new_callback_arg);
|
||||
}
|
||||
|
||||
void ResourceManager::RegisterDeviceListWarningCallback(DeviceListWarningCallback new_callback, void *new_callback_arg)
|
||||
{
|
||||
DeviceListWarningCallbacks.push_back(new_callback);
|
||||
DeviceListWarningCallbackArgs.push_back(new_callback_arg);
|
||||
}
|
||||
|
||||
void ResourceManager::RegisterI2CBusListChangeCallback(I2CBusListChangeCallback new_callback, void * new_callback_arg)
|
||||
{
|
||||
I2CBusListChangeCallbacks.push_back(new_callback);
|
||||
@@ -188,6 +194,11 @@ void ResourceManager::DeviceListChanged()
|
||||
{
|
||||
DeviceListChangeMutex.lock();
|
||||
|
||||
for(unsigned int callback_idx = 0; callback_idx < (int)DeviceListWarningCallbacks.size(); callback_idx++)
|
||||
{
|
||||
DeviceListWarningCallbacks[callback_idx](DeviceListWarningCallbackArgs[callback_idx]);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Insert hardware controllers into controller list |
|
||||
\*-------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user