ControllerInterface: Implement ChangeWindow on DInput without recreating the devices

Also polished DInput code in general to try and mitigate issue 11702.
Added a lot of logging and comments.
This commit is contained in:
Filoppi
2021-05-15 12:20:20 +03:00
parent dcc345400e
commit a0ecca1a84
8 changed files with 140 additions and 37 deletions

View File

@ -16,6 +16,7 @@ namespace ciface::DInput
void InitKeyboardMouse(IDirectInput8* const idi8, HWND hwnd);
using RelativeMouseState = RelativeInputState<Common::TVec3<LONG>>;
void SetKeyboardMouseWindow(HWND hwnd);
class KeyboardMouse : public Core::Device
{
@ -96,13 +97,13 @@ private:
public:
void UpdateInput() override;
KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIRECTINPUTDEVICE8 mo_device,
HWND hwnd);
KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIRECTINPUTDEVICE8 mo_device);
~KeyboardMouse();
std::string GetName() const override;
std::string GetSource() const override;
int GetSortPriority() const override;
bool IsVirtualDevice() const override;
private:
void UpdateCursorInput();
@ -110,8 +111,6 @@ private:
const LPDIRECTINPUTDEVICE8 m_kb_device;
const LPDIRECTINPUTDEVICE8 m_mo_device;
const HWND m_hwnd;
DWORD m_last_update;
State m_state_in;
};