Merge c613d3ca10
into 4d0cf1315e
This commit is contained in:
commit
3ca39c174d
|
@ -10,8 +10,6 @@
|
|||
|
||||
#include <hidclass.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "Common/Flag.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "InputCommon/ControllerInterface/DInput/DInput.h"
|
||||
|
@ -20,7 +18,6 @@
|
|||
|
||||
#pragma comment(lib, "OneCoreUAP.Lib")
|
||||
|
||||
static std::mutex s_populate_mutex;
|
||||
// TODO is this really needed?
|
||||
static Common::Flag s_first_populate_devices_asked;
|
||||
static HCMNOTIFICATION s_notify_handle;
|
||||
|
@ -52,7 +49,6 @@ _Pre_satisfies_(EventDataSize >= sizeof(CM_NOTIFY_EVENT_DATA)) static DWORD CALL
|
|||
// listen for it.
|
||||
if (s_first_populate_devices_asked.IsSet())
|
||||
{
|
||||
std::lock_guard lk_population(s_populate_mutex);
|
||||
// TODO: we could easily use the message passed alongside this event, which tells
|
||||
// whether a device was added or removed, to avoid removing old, still connected, devices
|
||||
g_controller_interface.PlatformPopulateDevices([&] {
|
||||
|
@ -96,17 +92,18 @@ InputBackend::InputBackend(ControllerInterface* controller_interface)
|
|||
|
||||
void InputBackend::PopulateDevices()
|
||||
{
|
||||
std::lock_guard lk_population(s_populate_mutex);
|
||||
s_first_populate_devices_asked.Set();
|
||||
ciface::DInput::PopulateDevices(GetHWND());
|
||||
ciface::XInput::PopulateDevices();
|
||||
ciface::WGInput::PopulateDevices();
|
||||
g_controller_interface.PlatformPopulateDevices([this] {
|
||||
s_first_populate_devices_asked.Set();
|
||||
ciface::DInput::PopulateDevices(GetHWND());
|
||||
ciface::XInput::PopulateDevices();
|
||||
ciface::WGInput::PopulateDevices();
|
||||
});
|
||||
}
|
||||
|
||||
void InputBackend::HandleWindowChange()
|
||||
{
|
||||
std::lock_guard lk_population(s_populate_mutex);
|
||||
ciface::DInput::ChangeWindow(GetHWND());
|
||||
g_controller_interface.PlatformPopulateDevices(
|
||||
[this] { ciface::DInput::ChangeWindow(GetHWND()); });
|
||||
}
|
||||
|
||||
InputBackend::~InputBackend()
|
||||
|
|
Loading…
Reference in New Issue