X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Ffocus-manager%2Ffocus-manager-impl.cpp;h=cb1ce25410e9479bcefd0ca10db64351d6dc9465;hp=a52d48022aec0c5803c8f03f0b5f40938312912f;hb=16e2b98c54081905fa9e26e017e96672581c9f34;hpb=54be5f49c53acf0cf6f62fd409d1fda6e07c8637 diff --git a/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp b/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp index a52d480..cb1ce25 100644 --- a/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp +++ b/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp @@ -548,16 +548,6 @@ bool FocusManager::GetWrapMode() const return mIsWrapped; } -void FocusManager::SetEndCapFeedbackEnabled(bool enabled) -{ - mIsEndcapFeedbackEnabled = enabled; -} - -bool FocusManager::GetEndCapFeedbackEnabled() const -{ - return mIsEndcapFeedbackEnabled; -} - void FocusManager::SetFocusIndicatorActor(Actor indicator) { mFocusIndicatorActor = indicator; @@ -576,22 +566,22 @@ bool FocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapp if( (forward && ++focusIDIter == mFocusIDContainer.end()) || (!forward && focusIDIter-- == mFocusIDContainer.begin()) ) { - if(wrapped) + if(mIsEndcapFeedbackEnabled) { - if(mIsEndcapFeedbackEnabled) + if(mIsEndcapFeedbackPlayed == false) { - if(mIsEndcapFeedbackPlayed == false) - { - // play sound & skip to move once - Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); - soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE); + // play sound & skip moving once + Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); + soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE); - mIsEndcapFeedbackPlayed = true; - return true; - } - mIsEndcapFeedbackPlayed = false; + mIsEndcapFeedbackPlayed = true; + return true; } + mIsEndcapFeedbackPlayed = false; + } + if(wrapped) + { if(forward) { focusIDIter = mFocusIDContainer.begin(); @@ -604,12 +594,6 @@ bool FocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapp } else { - if(mIsEndcapFeedbackEnabled) - { - Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); - soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE); - } - DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Overshot\n", __FUNCTION__, __LINE__); // Send notification for handling overshooted situation mFocusOvershotSignalV2.Emit(GetCurrentFocusActor(), forward ? Toolkit::FocusManager::OVERSHOT_NEXT : Toolkit::FocusManager::OVERSHOT_PREVIOUS); @@ -708,10 +692,11 @@ bool FocusManager::ChangeAccessibilityStatus() return true; } -bool FocusManager::AccessibilityActionNext() +bool FocusManager::AccessibilityActionNext(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { + mIsEndcapFeedbackEnabled = allowEndFeedback; return MoveFocusForward(); } else @@ -720,10 +705,11 @@ bool FocusManager::AccessibilityActionNext() } } -bool FocusManager::AccessibilityActionPrevious() +bool FocusManager::AccessibilityActionPrevious(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { + mIsEndcapFeedbackEnabled = allowEndFeedback; return MoveFocusBackward(); } else @@ -772,7 +758,7 @@ bool FocusManager::AccessibilityActionRead(bool allowReadAgain) return ret; } -bool FocusManager::AccessibilityActionReadNext() +bool FocusManager::AccessibilityActionReadNext(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { @@ -784,7 +770,7 @@ bool FocusManager::AccessibilityActionReadNext() } } -bool FocusManager::AccessibilityActionReadPrevious() +bool FocusManager::AccessibilityActionReadPrevious(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { @@ -858,6 +844,21 @@ bool FocusManager::AccessibilityActionBack() return mIsAccessibilityTtsEnabled; } +bool FocusManager::AccessibilityActionTouch(const TouchEvent& touchEvent) +{ + bool handled = false; + + // TODO: Need to convert the touchevent for the focused actor? + + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor()); + if(control) + { + handled = control.GetImplementation().OnAccessibilityTouch(touchEvent); + } + + return handled; +} + bool FocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent) { bool handled = false; @@ -877,13 +878,21 @@ bool FocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent } } + // Gesture::Finished (Up) events are delivered with previous (Motion) event position + // Use the real previous position; otherwise we may incorrectly get a ZERO velocity + if ( Gesture::Finished != panEvent.state ) + { + // Store the previous position for next Gesture::Finished iteration. + mPreviousPosition = panEvent.previousPosition; + } + Actor rootActor = Stage::GetCurrent().GetRootLayer(); Dali::PanGesture pan(panEvent.state); pan.time = panEvent.time; pan.numberOfTouches = panEvent.numberOfTouches; pan.screenPosition = panEvent.currentPosition; - pan.screenDisplacement = panEvent.previousPosition - panEvent.currentPosition; + pan.screenDisplacement = mPreviousPosition - panEvent.currentPosition; pan.screenVelocity.x = pan.screenDisplacement.x / panEvent.timeDelta; pan.screenVelocity.y = pan.screenDisplacement.y / panEvent.timeDelta; @@ -898,7 +907,7 @@ bool FocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent pan.position = localCurrent; Vector2 localPrevious; - control.ScreenToLocal( localPrevious.x, localPrevious.y, panEvent.previousPosition.x, panEvent.previousPosition.y ); + control.ScreenToLocal( localPrevious.x, localPrevious.y, mPreviousPosition.x, mPreviousPosition.y ); pan.displacement = localCurrent - localPrevious; pan.velocity.x = pan.displacement.x / panEvent.timeDelta;