mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-10 10:10:58 +02:00
Merge pull request #13781 from Dentomologist/controllerinterface_fix_windows_deadlock
ControllerInterface: Fix Windows deadlock
This commit is contained in:
@@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
#include <hidclass.h>
|
#include <hidclass.h>
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
#include "Common/Flag.h"
|
#include "Common/Flag.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "InputCommon/ControllerInterface/DInput/DInput.h"
|
#include "InputCommon/ControllerInterface/DInput/DInput.h"
|
||||||
@@ -20,7 +18,6 @@
|
|||||||
|
|
||||||
#pragma comment(lib, "OneCoreUAP.Lib")
|
#pragma comment(lib, "OneCoreUAP.Lib")
|
||||||
|
|
||||||
static std::mutex s_populate_mutex;
|
|
||||||
// TODO is this really needed?
|
// TODO is this really needed?
|
||||||
static Common::Flag s_first_populate_devices_asked;
|
static Common::Flag s_first_populate_devices_asked;
|
||||||
static HCMNOTIFICATION s_notify_handle;
|
static HCMNOTIFICATION s_notify_handle;
|
||||||
@@ -52,7 +49,6 @@ _Pre_satisfies_(EventDataSize >= sizeof(CM_NOTIFY_EVENT_DATA)) static DWORD CALL
|
|||||||
// listen for it.
|
// listen for it.
|
||||||
if (s_first_populate_devices_asked.IsSet())
|
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
|
// 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
|
// whether a device was added or removed, to avoid removing old, still connected, devices
|
||||||
g_controller_interface.PlatformPopulateDevices([&] {
|
g_controller_interface.PlatformPopulateDevices([&] {
|
||||||
@@ -96,17 +92,18 @@ InputBackend::InputBackend(ControllerInterface* controller_interface)
|
|||||||
|
|
||||||
void InputBackend::PopulateDevices()
|
void InputBackend::PopulateDevices()
|
||||||
{
|
{
|
||||||
std::lock_guard lk_population(s_populate_mutex);
|
g_controller_interface.PlatformPopulateDevices([this] {
|
||||||
s_first_populate_devices_asked.Set();
|
s_first_populate_devices_asked.Set();
|
||||||
ciface::DInput::PopulateDevices(GetHWND());
|
ciface::DInput::PopulateDevices(GetHWND());
|
||||||
ciface::XInput::PopulateDevices();
|
ciface::XInput::PopulateDevices();
|
||||||
ciface::WGInput::PopulateDevices();
|
ciface::WGInput::PopulateDevices();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputBackend::HandleWindowChange()
|
void InputBackend::HandleWindowChange()
|
||||||
{
|
{
|
||||||
std::lock_guard lk_population(s_populate_mutex);
|
g_controller_interface.PlatformPopulateDevices(
|
||||||
ciface::DInput::ChangeWindow(GetHWND());
|
[this] { ciface::DInput::ChangeWindow(GetHWND()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
InputBackend::~InputBackend()
|
InputBackend::~InputBackend()
|
||||||
|
Reference in New Issue
Block a user