InputManager: Remove default Pointer-0 device on raw input startup

And re-add it on shutdown.

Fix the duplicate devices in the list.
This commit is contained in:
Stenzek
2026-01-14 00:29:12 +10:00
parent 2cb7bace03
commit 991db9e49a
2 changed files with 12 additions and 1 deletions

View File

@@ -2316,7 +2316,8 @@ InputManager::DeviceList InputManager::EnumerateDevices()
mouse_key.source_type = InputSourceType::Pointer;
ret.emplace_back(keyboard_key, "Keyboard", TRANSLATE_STR("InputManager", "Keyboard"));
ret.emplace_back(mouse_key, GetPointerDeviceName(0), TRANSLATE_STR("InputManager", "Mouse"));
if (!IsUsingRawInput())
ret.emplace_back(mouse_key, GetPointerDeviceName(0), TRANSLATE_STR("InputManager", "Mouse"));
for (u32 i = FIRST_EXTERNAL_INPUT_SOURCE; i < LAST_EXTERNAL_INPUT_SOURCE; i++)
{

View File

@@ -7,6 +7,8 @@
#include "core/gpu_thread.h"
#include "util/translation.h"
#include "common/assert.h"
#include "common/error.h"
#include "common/log.h"
@@ -48,6 +50,10 @@ bool Win32RawInputSource::Initialize(const SettingsInterface& si, std::unique_lo
return false;
}
// "Disconnect" the normal Mouse device added by InputManager.
Host::OnInputDeviceDisconnected(MakeGenericControllerDeviceKey(InputSourceType::Pointer, 0),
InputManager::GetPointerDeviceName(0));
ReloadDevices();
return true;
}
@@ -61,6 +67,10 @@ void Win32RawInputSource::Shutdown()
CloseDevices();
UnregisterRawInput();
DestroyDummyWindow();
// Restore the normal Mouse device. If we're shutting down, this won't do much.
Host::OnInputDeviceConnected(MakeGenericControllerDeviceKey(InputSourceType::Pointer, 0),
InputManager::GetPointerDeviceName(0), TRANSLATE_SV("InputManager", "Mouse"));
}
void Win32RawInputSource::PollEvents()