From ee4fc9fdd65977027d963a6d6d5234e462df424a Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Mon, 29 Jun 2015 09:04:15 +0100 Subject: [PATCH] Fix for selection handles. Selection handles may remain pressed after the power button is pressed. * The TouchEvent with Interrupt state is not handled. Actually Dali core does not send this event when the power button is pressed. This patch is a work-around to fix the issue. Would be a proper solution send the TouchEvent with the Interrupt state when the power button is pressed? Change-Id: Ide9e69f74eb73f3ed1ce6d0ff918bd1177ba783c Signed-off-by: Victor Cebollada --- .../internal/text/decorator/text-decorator.cpp | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 0eb1caf..cf450ef 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -903,7 +903,8 @@ struct Decorator::Impl : public ConnectionTracker mHandle[GRAB_HANDLE].actor.SetImage( imagePressed ); } } - else if( TouchPoint::Up == point.state ) + else if( ( TouchPoint::Up == point.state ) || + ( TouchPoint::Interrupted == point.state ) ) { mHandle[GRAB_HANDLE].pressed = false; Image imageReleased = mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED]; @@ -936,7 +937,8 @@ struct Decorator::Impl : public ConnectionTracker mHandle[LEFT_SELECTION_HANDLE].actor.SetImage( imagePressed ); } } - else if( TouchPoint::Up == point.state ) + else if( ( TouchPoint::Up == point.state ) || + ( TouchPoint::Interrupted == point.state ) ) { mHandle[LEFT_SELECTION_HANDLE].pressed = false; Image imageReleased = mHandleImages[flip ? RIGHT_SELECTION_HANDLE : LEFT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED]; @@ -969,7 +971,8 @@ struct Decorator::Impl : public ConnectionTracker mHandle[RIGHT_SELECTION_HANDLE].actor.SetImage( imagePressed ); } } - else if( TouchPoint::Up == point.state ) + else if( ( TouchPoint::Up == point.state ) || + ( TouchPoint::Interrupted == point.state ) ) { Image imageReleased = mHandleImages[flip ? LEFT_SELECTION_HANDLE : RIGHT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED]; mHandle[RIGHT_SELECTION_HANDLE].pressed = false; @@ -1348,6 +1351,20 @@ float Decorator::GetCursorBlinkDuration() const void Decorator::SetHandleActive( HandleType handleType, bool active ) { mImpl->mHandle[handleType].active = active; + + if( !active ) + { + // TODO: this is a work-around. + // The problem is the handle actor does not receive the touch event with the Interrupt + // state when the power button is pressed and the application goes to background. + mImpl->mHandle[handleType].pressed = false; + Image imageReleased = mImpl->mHandleImages[handleType][HANDLE_IMAGE_RELEASED]; + ImageActor imageActor = mImpl->mHandle[handleType].actor; + if( imageReleased && imageActor ) + { + imageActor.SetImage( imageReleased ); + } + } } bool Decorator::IsHandleActive( HandleType handleType ) const -- 2.7.4