File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -191,15 +191,18 @@ class Keyboard::Impl
191
191
_In_ IGameInputDevice *,
192
192
_In_ uint64_t ,
193
193
_In_ GameInputDeviceStatus currentStatus,
194
- _In_ GameInputDeviceStatus) noexcept
194
+ _In_ GameInputDeviceStatus previousStatus ) noexcept
195
195
{
196
196
auto impl = reinterpret_cast <Keyboard::Impl*>(context);
197
197
198
- if (currentStatus & GameInputDeviceConnected)
198
+ const bool wasConnected = (previousStatus & GameInputDeviceConnected) != 0 ;
199
+ const bool isConnected = (currentStatus & GameInputDeviceConnected) != 0 ;
200
+
201
+ if (isConnected && !wasConnected)
199
202
{
200
203
++impl->mConnected ;
201
204
}
202
- else if (impl->mConnected > 0 )
205
+ else if (!isConnected && wasConnected && impl->mConnected > 0 )
203
206
{
204
207
--impl->mConnected ;
205
208
}
Original file line number Diff line number Diff line change @@ -320,15 +320,18 @@ class Mouse::Impl
320
320
_In_ IGameInputDevice *,
321
321
_In_ uint64_t ,
322
322
_In_ GameInputDeviceStatus currentStatus,
323
- _In_ GameInputDeviceStatus) noexcept
323
+ _In_ GameInputDeviceStatus previousStatus ) noexcept
324
324
{
325
325
auto impl = reinterpret_cast <Mouse::Impl*>(context);
326
326
327
- if (currentStatus & GameInputDeviceConnected)
327
+ const bool wasConnected = (previousStatus & GameInputDeviceConnected) != 0 ;
328
+ const bool isConnected = (currentStatus & GameInputDeviceConnected) != 0 ;
329
+
330
+ if (isConnected && !wasConnected)
328
331
{
329
332
++impl->mConnected ;
330
333
}
331
- else if (impl->mConnected > 0 )
334
+ else if (!isConnected && wasConnected && impl->mConnected > 0 )
332
335
{
333
336
--impl->mConnected ;
334
337
}
You can’t perform that action at this time.
0 commit comments