Fix oversights from 735f2d9

This commit is contained in:
Chris Thrasher 2024-06-19 02:54:16 +00:00
parent 447e7b3844
commit f05baef521

View File

@ -462,7 +462,7 @@ bool eventProcess(sf::Event& event)
touchFd = fileDescriptor;
break;
case ABS_MT_TRACKING_ID:
atSlot(currentSlot).id = inputEvent.value;
atSlot(currentSlot).id = inputEvent.value >= 0 ? std::optional(inputEvent.value) : std::nullopt;
touchFd = fileDescriptor;
break;
case ABS_MT_POSITION_X:
@ -657,7 +657,7 @@ bool isTouchDown(unsigned int finger)
{
return std::any_of(touchSlots.cbegin(),
touchSlots.cend(),
[finger](const TouchSlot& slot) { return slot.id == static_cast<int>(finger); });
[finger](const TouchSlot& slot) { return slot.id == finger; });
}
@ -666,7 +666,7 @@ Vector2i getTouchPosition(unsigned int finger)
{
for (const auto& slot : touchSlots)
{
if (slot.id == static_cast<int>(finger))
if (slot.id == finger)
return slot.pos;
}