From ded0d049e9892d604d336e4608bda9a064bcbddb Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Fri, 28 Aug 2020 17:40:05 +0900 Subject: [PATCH] DSSeat: fix to set winX/winY for DSInputEvent::TouchMoveEvent Change-Id: Ifb2f9e83c9eae2746805ef360231c4258bdbb762 Signed-off-by: Sung-Jin Park --- src/DSSeat/DSSeat.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/DSSeat/DSSeat.cpp b/src/DSSeat/DSSeat.cpp index 599d32b..ed929fa 100644 --- a/src/DSSeat/DSSeat.cpp +++ b/src/DSSeat/DSSeat.cpp @@ -451,6 +451,10 @@ void DSSeat::__onPointerEvent(DSInputMouseEvent *ev) void DSSeat::__onTouchEvent(DSInputTouchEvent *ev) { + int winX; + int winY; + stPosition pos; + if (__touch == nullptr) { DSLOG_DBG("DSSeat", "No touch device exists. Touch events will be dropped."); @@ -467,10 +471,6 @@ void DSSeat::__onTouchEvent(DSInputTouchEvent *ev) //set the window as touch focus window if (window) { - int winX; - int winY; - stPosition pos; - pos = window->getPosition(); winX = ev->getX() - pos.x; winY = ev->getY() - pos.y; @@ -482,6 +482,19 @@ void DSSeat::__onTouchEvent(DSInputTouchEvent *ev) //TODO : emit touch focus changed signal } + else if (ev->getType() == DSInputEvent::TouchMoveEvent) + { + auto window = __touch->getFocus(); + + if (window) + { + pos = window->getPosition(); + winX = ev->getX() - pos.x; + winY = ev->getY() - pos.y; + ev->setWinX(winX); + ev->setWinY(winY); + } + } __dswlSeat->setCurrentEventTime(ev->getTimestamp()); __touch->processEvent(ev, nullptr); -- 2.7.4