mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
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:
@@ -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++)
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user