From e83b0793131adcfc5b9a92239ba8403db5febb47 Mon Sep 17 00:00:00 2001 From: "taeyoon0.lee" Date: Tue, 7 Mar 2017 14:06:15 +0900 Subject: [PATCH] [3.0] Replaced deprecated touch api in indicator Change-Id: I18ade74308b0c446bfa025d073355d18c5782846 --- adaptors/ecore/common/ecore-indicator-impl.cpp | 45 ++++++++++++-------------- adaptors/ecore/common/ecore-indicator-impl.h | 10 +++--- adaptors/tizen/ecore-indicator-impl-tizen.cpp | 45 ++++++++++++-------------- 3 files changed, 45 insertions(+), 55 deletions(-) diff --git a/adaptors/ecore/common/ecore-indicator-impl.cpp b/adaptors/ecore/common/ecore-indicator-impl.cpp index 30b6c00..6eaefb9 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.cpp +++ b/adaptors/ecore/common/ecore-indicator-impl.cpp @@ -34,8 +34,7 @@ #include #include -#include -#include +#include #include #include @@ -253,9 +252,9 @@ struct IpcDataEvMouseMove unsigned int timestamp; Evas_Event_Flags event_flags; - IpcDataEvMouseMove(const Dali::TouchPoint& touchPoint, unsigned long timestamp) - : x(static_cast(touchPoint.local.x)), - y(static_cast(touchPoint.local.y)), + IpcDataEvMouseMove(const Dali::TouchData& touchData, unsigned long timestamp) + : x(static_cast(touchData.GetLocalPosition( 0 ).x)), + y(static_cast(touchData.GetLocalPosition( 0 ).y)), flags(EVAS_BUTTON_NONE), mask(0), timestamp(static_cast(timestamp)), @@ -518,7 +517,7 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat // Indicator image handles the touch event including "leave" mIndicatorContentActor.SetLeaveRequired( true ); - mIndicatorContentActor.TouchedSignal().Connect( this, &Indicator::OnTouched ); + mIndicatorContentActor.TouchSignal().Connect( this, &Indicator::OnTouched ); mIndicatorContentActor.SetColor( Color::BLACK ); mIndicatorActor = Dali::Actor::New(); @@ -562,7 +561,7 @@ Indicator::~Indicator() if(mEventActor) { - mEventActor.TouchedSignal().Disconnect( this, &Indicator::OnTouched ); + mEventActor.TouchSignal().Disconnect( this, &Indicator::OnTouched ); } Disconnect(); } @@ -732,21 +731,19 @@ bool Indicator::SendMessage( int messageDomain, int messageId, const void *data, } } -bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEvent) +bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchData& touchData) { if( mServerConnection ) { - const TouchPoint& touchPoint = touchEvent.GetPoint( 0 ); - // Send touch event to indicator server when indicator is showing if( CheckVisibleState() || mIsShowing ) { - switch( touchPoint.state ) + switch( touchData.GetState( 0 ) ) { case Dali::PointState::DOWN: { - IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time ); - IpcDataEvMouseDown ipcDown( touchEvent.time ); + IpcDataEvMouseMove ipcMove( touchData, touchData.GetTime() ); + IpcDataEvMouseDown ipcDown( touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) ); mServerConnection->SendEvent( OP_EV_MOUSE_DOWN, &ipcDown, sizeof(ipcDown) ); @@ -760,7 +757,7 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv case Dali::PointState::MOTION: { - IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time ); + IpcDataEvMouseMove ipcMove( touchData, touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) ); } break; @@ -768,7 +765,7 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv case Dali::PointState::UP: case Dali::PointState::INTERRUPTED: { - IpcDataEvMouseUp ipcUp( touchEvent.time ); + IpcDataEvMouseUp ipcUp( touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_UP, &ipcUp, sizeof(ipcUp) ); if( mVisible == Dali::Window::AUTO ) @@ -779,11 +776,11 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv } break; - case Dali::TouchPoint::Leave: + case Dali::PointState::LEAVE: { - IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time ); + IpcDataEvMouseMove ipcMove( touchData, touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) ); - IpcDataEvMouseUp ipcOut( touchEvent.time ); + IpcDataEvMouseUp ipcOut( touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_OUT, &ipcOut, sizeof(ipcOut) ); } break; @@ -1533,7 +1530,7 @@ void Indicator::ShowIndicator(float duration) if( mVisible == Dali::Window::AUTO ) { // check the stage touch - Dali::Stage::GetCurrent().TouchedSignal().Connect( this, &Indicator::OnStageTouched ); + Dali::Stage::GetCurrent().TouchSignal().Connect( this, &Indicator::OnStageTouched ); } } else @@ -1546,7 +1543,7 @@ void Indicator::ShowIndicator(float duration) if( mVisible == Dali::Window::AUTO ) { // check the stage touch - Dali::Stage::GetCurrent().TouchedSignal().Disconnect( this, &Indicator::OnStageTouched ); + Dali::Stage::GetCurrent().TouchSignal().Disconnect( this, &Indicator::OnStageTouched ); } } } @@ -1625,19 +1622,17 @@ void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture ) } } -void Indicator::OnStageTouched(const Dali::TouchEvent& touchEvent) +void Indicator::OnStageTouched(const Dali::TouchData& touchData) { - const TouchPoint& touchPoint = touchEvent.GetPoint( 0 ); - // when stage is touched while indicator is showing temporary, hide it if( mIsShowing && ( CheckVisibleState() == false || mVisible == Dali::Window::AUTO ) ) { - switch( touchPoint.state ) + switch( touchData.GetState( 0 ) ) { case Dali::PointState::DOWN: { // if touch point is inside the indicator, indicator is not hidden - if( mImageHeight < int(touchPoint.screen.y) ) + if( mImageHeight < int(touchData.GetScreenPosition( 0 ).y) ) { ShowIndicator( HIDE_NOW ); } diff --git a/adaptors/ecore/common/ecore-indicator-impl.h b/adaptors/ecore/common/ecore-indicator-impl.h index b144fda..544e92b 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.h +++ b/adaptors/ecore/common/ecore-indicator-impl.h @@ -227,12 +227,12 @@ private: /** * Touch event callback. - * It should pass the valid touch event to indicator server + * It should pass the valid touch data to indicator server * * @param[in] indicator The indicator actor that was touched - * @param[in] touchEvent The touch event + * @param[in] touchData The touch data */ - bool OnTouched(Dali::Actor indicator, const TouchEvent& touchEvent); + bool OnTouched(Dali::Actor indicator, const TouchData& touchData); /** * Pan gesture callback. @@ -247,9 +247,9 @@ private: * Touch event callback on stage. * If stage is touched, hide showing indicator image * - * @param[in] touchEvent The touch event + * @param[in] touchEvent The touch data */ - void OnStageTouched(const Dali::TouchEvent& touchEvent); + void OnStageTouched(const Dali::TouchData& touchData); /** * Connect to the indicator service diff --git a/adaptors/tizen/ecore-indicator-impl-tizen.cpp b/adaptors/tizen/ecore-indicator-impl-tizen.cpp index 52fef73..aea9df4 100644 --- a/adaptors/tizen/ecore-indicator-impl-tizen.cpp +++ b/adaptors/tizen/ecore-indicator-impl-tizen.cpp @@ -30,8 +30,7 @@ #include #include -#include -#include +#include #include #include #include @@ -264,9 +263,9 @@ struct IpcDataEvMouseMove unsigned int timestamp; Evas_Event_Flags event_flags; - IpcDataEvMouseMove(const Dali::TouchPoint& touchPoint, unsigned long timestamp) - : x(static_cast(touchPoint.local.x)), - y(static_cast(touchPoint.local.y)), + IpcDataEvMouseMove(const Dali::TouchData& touchData, unsigned long timestamp) + : x(static_cast(touchData.GetLocalPosition( 0 ).x)), + y(static_cast(touchData.GetLocalPosition( 0 ).y)), flags(EVAS_BUTTON_NONE), mask(0), timestamp(static_cast(timestamp)), @@ -534,7 +533,7 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat // Indicator image handles the touch event including "leave" mIndicatorContentActor.SetLeaveRequired( true ); - mIndicatorContentActor.TouchedSignal().Connect( this, &Indicator::OnTouched ); + mIndicatorContentActor.TouchSignal().Connect( this, &Indicator::OnTouched ); mIndicatorContentActor.SetColor( Color::BLACK ); mIndicatorActor = Dali::Actor::New(); @@ -578,7 +577,7 @@ Indicator::~Indicator() if(mEventActor) { - mEventActor.TouchedSignal().Disconnect( this, &Indicator::OnTouched ); + mEventActor.TouchSignal().Disconnect( this, &Indicator::OnTouched ); } Disconnect(); } @@ -751,21 +750,19 @@ bool Indicator::SendMessage( int messageDomain, int messageId, const void *data, } } -bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEvent) +bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchData& touchData) { if( mServerConnection ) { - const TouchPoint& touchPoint = touchEvent.GetPoint( 0 ); - // Send touch event to indicator server when indicator is showing if( CheckVisibleState() || mIsShowing ) { - switch( touchPoint.state ) + switch( touchData.GetState( 0 ) ) { case Dali::PointState::DOWN: { - IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time ); - IpcDataEvMouseDown ipcDown( touchEvent.time ); + IpcDataEvMouseMove ipcMove( touchData, touchData.GetTime() ); + IpcDataEvMouseDown ipcDown( touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) ); mServerConnection->SendEvent( OP_EV_MOUSE_DOWN, &ipcDown, sizeof(ipcDown) ); @@ -779,7 +776,7 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv case Dali::PointState::MOTION: { - IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time ); + IpcDataEvMouseMove ipcMove( touchData, touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) ); } break; @@ -787,7 +784,7 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv case Dali::PointState::UP: case Dali::PointState::INTERRUPTED: { - IpcDataEvMouseUp ipcUp( touchEvent.time ); + IpcDataEvMouseUp ipcUp( touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_UP, &ipcUp, sizeof(ipcUp) ); if( mVisible == Dali::Window::AUTO ) @@ -798,11 +795,11 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv } break; - case Dali::TouchPoint::Leave: + case Dali::PointState::LEAVE: { - IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time ); + IpcDataEvMouseMove ipcMove( touchData, touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) ); - IpcDataEvMouseUp ipcOut( touchEvent.time ); + IpcDataEvMouseUp ipcOut( touchData.GetTime() ); mServerConnection->SendEvent( OP_EV_MOUSE_OUT, &ipcOut, sizeof(ipcOut) ); } break; @@ -1640,7 +1637,7 @@ void Indicator::ShowIndicator(float duration) if( mVisible == Dali::Window::AUTO ) { // check the stage touch - Dali::Stage::GetCurrent().TouchedSignal().Connect( this, &Indicator::OnStageTouched ); + Dali::Stage::GetCurrent().TouchSignal().Connect( this, &Indicator::OnStageTouched ); } } else @@ -1653,7 +1650,7 @@ void Indicator::ShowIndicator(float duration) if( mVisible == Dali::Window::AUTO ) { // check the stage touch - Dali::Stage::GetCurrent().TouchedSignal().Disconnect( this, &Indicator::OnStageTouched ); + Dali::Stage::GetCurrent().TouchSignal().Disconnect( this, &Indicator::OnStageTouched ); } } } @@ -1732,19 +1729,17 @@ void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture ) } } -void Indicator::OnStageTouched(const Dali::TouchEvent& touchEvent) +void Indicator::OnStageTouched(const Dali::TouchData& touchData) { - const TouchPoint& touchPoint = touchEvent.GetPoint( 0 ); - // when stage is touched while indicator is showing temporary, hide it if( mIsShowing && ( CheckVisibleState() == false || mVisible == Dali::Window::AUTO ) ) { - switch( touchPoint.state ) + switch( touchData.GetState( 0 ) ) { case Dali::PointState::DOWN: { // if touch point is inside the indicator, indicator is not hidden - if( mImageHeight < int(touchPoint.screen.y) ) + if( mImageHeight < int( touchData.GetScreenPosition( 0 ).y ) ) { ShowIndicator( HIDE_NOW ); } -- 2.7.4