diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2018-12-16 09:30:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-16 09:30:20 +0100 |
commit | 70f833ff49c5944774d26b553aa85a7f7189d4b4 (patch) | |
tree | e3e97df98772c854ee7c3175d4588634f8fea165 | |
parent | 4c17e7769e5af6817e0c405438a36e5a552b21d9 (diff) | |
parent | 337f71a95da616125ade2fa5b4f3434662e067ad (diff) |
Merge pull request #15032 from lrusak/libinput-absolute-motion
libinput: add support for absolute pointer motion
-rw-r--r-- | xbmc/platform/linux/input/LibInputHandler.cpp | 3 | ||||
-rw-r--r-- | xbmc/platform/linux/input/LibInputPointer.cpp | 17 | ||||
-rw-r--r-- | xbmc/platform/linux/input/LibInputPointer.h | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/xbmc/platform/linux/input/LibInputHandler.cpp b/xbmc/platform/linux/input/LibInputHandler.cpp index c7dbac7d43..d2e93d308b 100644 --- a/xbmc/platform/linux/input/LibInputHandler.cpp +++ b/xbmc/platform/linux/input/LibInputHandler.cpp @@ -181,6 +181,9 @@ void CLibInputHandler::ProcessEvent(libinput_event *ev) case LIBINPUT_EVENT_POINTER_MOTION: m_pointer->ProcessMotion(libinput_event_get_pointer_event(ev)); break; + case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: + m_pointer->ProcessMotionAbsolute(libinput_event_get_pointer_event(ev)); + break; case LIBINPUT_EVENT_POINTER_AXIS: m_pointer->ProcessAxis(libinput_event_get_pointer_event(ev)); break; diff --git a/xbmc/platform/linux/input/LibInputPointer.cpp b/xbmc/platform/linux/input/LibInputPointer.cpp index 82c1a25471..591a5c6fd0 100644 --- a/xbmc/platform/linux/input/LibInputPointer.cpp +++ b/xbmc/platform/linux/input/LibInputPointer.cpp @@ -96,6 +96,23 @@ void CLibInputPointer::ProcessMotion(libinput_event_pointer *e) appPort->OnEvent(event); } +void CLibInputPointer::ProcessMotionAbsolute(libinput_event_pointer *e) +{ + m_pos.X = static_cast<int>(libinput_event_pointer_get_absolute_x_transformed(e, CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth())); + m_pos.Y = static_cast<int>(libinput_event_pointer_get_absolute_y_transformed(e, CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight())); + + XBMC_Event event; + event.type = XBMC_MOUSEMOTION; + event.motion.x = static_cast<uint16_t>(m_pos.X); + event.motion.y = static_cast<uint16_t>(m_pos.Y); + + CLog::Log(LOGDEBUG, "CLibInputPointer::%s - event.type: %i, event.motion.x: %i, event.motion.y: %i", __FUNCTION__, event.type, event.motion.x, event.motion.y); + + std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->OnEvent(event); +} + void CLibInputPointer::ProcessAxis(libinput_event_pointer *e) { unsigned char scroll = 0; diff --git a/xbmc/platform/linux/input/LibInputPointer.h b/xbmc/platform/linux/input/LibInputPointer.h index aa7c8b90a3..608b438abe 100644 --- a/xbmc/platform/linux/input/LibInputPointer.h +++ b/xbmc/platform/linux/input/LibInputPointer.h @@ -24,6 +24,7 @@ public: void ProcessButton(libinput_event_pointer *e); void ProcessMotion(libinput_event_pointer *e); + void ProcessMotionAbsolute(libinput_event_pointer *e); void ProcessAxis(libinput_event_pointer *e); private: |