From 79166e4532f6fa85538b9b5f3e665605182e3d9f Mon Sep 17 00:00:00 2001 From: fiskn Date: Thu, 1 Oct 2020 21:45:41 +0100 Subject: [PATCH] Add standard X & Y events for EV_ABS Touchscreen emulates a mouse and sends ABS_X & ABS_Y --- src/SFML/Window/Unix/DRM/InputImplUDev.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/SFML/Window/Unix/DRM/InputImplUDev.cpp b/src/SFML/Window/Unix/DRM/InputImplUDev.cpp index 6003a666..c3ffd76a 100644 --- a/src/SFML/Window/Unix/DRM/InputImplUDev.cpp +++ b/src/SFML/Window/Unix/DRM/InputImplUDev.cpp @@ -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; @@ -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)