mirror of https://github.com/microsoft/vcpkg.git
56 lines
1.8 KiB
Diff
56 lines
1.8 KiB
Diff
diff --git a/Src/Keyboard.cpp b/Src/Keyboard.cpp
|
|
index 95d6ce0..e183877 100644
|
|
--- a/Src/Keyboard.cpp
|
|
+++ b/Src/Keyboard.cpp
|
|
@@ -191,15 +191,18 @@ private:
|
|
_In_ IGameInputDevice *,
|
|
_In_ uint64_t,
|
|
_In_ GameInputDeviceStatus currentStatus,
|
|
- _In_ GameInputDeviceStatus) noexcept
|
|
+ _In_ GameInputDeviceStatus previousStatus) noexcept
|
|
{
|
|
auto impl = reinterpret_cast<Keyboard::Impl*>(context);
|
|
|
|
- if (currentStatus & GameInputDeviceConnected)
|
|
+ const bool wasConnected = (previousStatus & GameInputDeviceConnected) != 0;
|
|
+ const bool isConnected = (currentStatus & GameInputDeviceConnected) != 0;
|
|
+
|
|
+ if (isConnected && !wasConnected)
|
|
{
|
|
++impl->mConnected;
|
|
}
|
|
- else if (impl->mConnected > 0)
|
|
+ else if (!isConnected && wasConnected && impl->mConnected > 0)
|
|
{
|
|
--impl->mConnected;
|
|
}
|
|
diff --git a/Src/Mouse.cpp b/Src/Mouse.cpp
|
|
index c38625f..315a3ce 100644
|
|
--- a/Src/Mouse.cpp
|
|
+++ b/Src/Mouse.cpp
|
|
@@ -320,15 +320,18 @@ private:
|
|
_In_ IGameInputDevice *,
|
|
_In_ uint64_t,
|
|
_In_ GameInputDeviceStatus currentStatus,
|
|
- _In_ GameInputDeviceStatus) noexcept
|
|
+ _In_ GameInputDeviceStatus previousStatus) noexcept
|
|
{
|
|
auto impl = reinterpret_cast<Mouse::Impl*>(context);
|
|
|
|
- if (currentStatus & GameInputDeviceConnected)
|
|
+ const bool wasConnected = (previousStatus & GameInputDeviceConnected) != 0;
|
|
+ const bool isConnected = (currentStatus & GameInputDeviceConnected) != 0;
|
|
+
|
|
+ if (isConnected && !wasConnected)
|
|
{
|
|
++impl->mConnected;
|
|
}
|
|
- else if (impl->mConnected > 0)
|
|
+ else if (!isConnected && wasConnected && impl->mConnected > 0)
|
|
{
|
|
--impl->mConnected;
|
|
}
|
|
--
|
|
2.49.0.vfs.0.0
|
|
|