Skip to content

Commit

Permalink
Add standard X & Y events for EV_ABS
Browse files Browse the repository at this point in the history
Touchscreen emulates a mouse and sends ABS_X & ABS_Y
  • Loading branch information
fiskn authored Oct 1, 2020
1 parent ac2c264 commit 79166e4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/SFML/Window/Unix/DRM/InputImplUDev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,18 @@ namespace
}
else if ( ie.type == EV_ABS )
{
bool posChange = false;
switch ( ie.code )
{
case ABS_X:
mousePos.x = ie.value;
posChange = true;
break;

case ABS_Y:
mousePos.y = ie.value;
posChange = true;
break;
case ABS_MT_SLOT:
currentSlot = ie.value;
touchFd = *itr;
Expand All @@ -488,6 +498,13 @@ namespace
touchFd = *itr;
break;
}
if ( posChange )
{
ev.type = sf::Event::MouseMoved;
ev.mouseMove.x = mousePos.x;
ev.mouseMove.y = mousePos.y;
return true;
}
}
else if ( ie.type == EV_SYN && ie.code == SYN_REPORT &&
*itr == touchFd)
Expand Down

0 comments on commit 79166e4

Please sign in to comment.