X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Ftizen%2Faccessibility-adaptor-impl-tizen.cpp;h=588cfaec1ffccec67343037d4c19435141cde504;hb=af8299cccb06727e1a57f02118406f113a9cc973;hp=c9c0b000c487de441f654fb25e7400e85ef86207;hpb=b13f88d09ab13bfe979b1f12abcb20488904ce11;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp b/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp index c9c0b00..588cfae 100644 --- a/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp +++ b/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp @@ -23,9 +23,6 @@ #include #include -#include -#include -#include // INTERNAL INCLUDES #include @@ -43,7 +40,6 @@ namespace Adaptor namespace { -// TODO: Update vconf-key.h ? const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS = "db/setting/accessibility/atspi"; bool GetEnabledVConf() @@ -81,25 +77,6 @@ void AccessibilityOnOffNotification(keynode_t* node, void* data) } } -BaseHandle Create() -{ - BaseHandle handle( AccessibilityAdaptor::Get() ); - - if ( !handle ) - { - Dali::SingletonService service( SingletonService::Get() ); - if ( service ) - { - Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() ); - service.Register( typeid( adaptor ), adaptor ); - handle = adaptor; - } - } - - return handle; -} -TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ ); - } // unnamed namespace Dali::AccessibilityAdaptor AccessibilityAdaptor::Get() @@ -116,170 +93,30 @@ Dali::AccessibilityAdaptor AccessibilityAdaptor::Get() // If so, downcast the handle adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) ); } - } - - return adaptor; -} - -Vector2 AccessibilityAdaptor::GetReadPosition() const -{ - return mReadPosition; -} - -void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler) -{ - mActionHandler = &handler; -} - -void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler) -{ - if( mAccessibilityGestureDetector ) - { - mAccessibilityGestureDetector->SetGestureHandler(handler); - } -} - -bool AccessibilityAdaptor::HandleActionClearFocusEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->ClearAccessibilityFocus(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp) -{ - bool ret = false; - - // We always need to emit a scroll signal, whether it's only a hover or not, - // so always send the action to the action handler. - if( mActionHandler ) - { - Dali::TouchEvent event(timeStamp); - event.points.push_back(point); - ret = mActionHandler->AccessibilityActionScroll( event ); - } - - Integration::TouchEvent touchEvent; - Integration::HoverEvent hoverEvent; - Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent); - if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth) // hover event is ignored - { - // Process the touch event in accessibility gesture detector - if( mAccessibilityGestureDetector ) + else { - mAccessibilityGestureDetector->SendEvent(touchEvent); - ret = true; - } - } + adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() ); + AccessibilityAdaptor& adaptorImpl = AccessibilityAdaptor::GetImplementation( adaptor ); - return ret; -} + bool isEnabled = GetEnabledVConf(); -bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) -{ - bool ret = false; + if( isEnabled ) + { + adaptorImpl.EnableAccessibility(); + } + DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" ); - Dali::TouchEvent touchEvent(timeStamp); - touchEvent.points.push_back(point); + vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl ); + vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl ); - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionTouch(touchEvent); - } - return ret; -} - -bool AccessibilityAdaptor::HandleActionBackEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionBack(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -void AccessibilityAdaptor::HandleActionEnableEvent() -{ - EnableAccessibility(); -} - -void AccessibilityAdaptor::HandleActionDisableEvent() -{ - DisableAccessibility(); -} - -void AccessibilityAdaptor::EnableAccessibility() -{ - if(mIsEnabled == false) - { - mIsEnabled = true; - - if( mActionHandler ) - { - mActionHandler->ChangeAccessibilityStatus(); - } - } -} - -void AccessibilityAdaptor::DisableAccessibility() -{ - if(mIsEnabled == true) - { - mIsEnabled = false; - - if( mActionHandler ) - { - mActionHandler->ChangeAccessibilityStatus(); - } - - // Destroy the TtsPlayer if exists. - if ( Adaptor::IsAvailable() ) - { - Dali::Adaptor& adaptor = Dali::Adaptor::Get(); - Adaptor& adaptorIpml = Adaptor::GetImplementation( adaptor ); - adaptorIpml.DestroyTtsPlayer( Dali::TtsPlayer::SCREEN_READER ); + service.Register( typeid( adaptor ), adaptor ); } } -} - -bool AccessibilityAdaptor::IsEnabled() const -{ - return mIsEnabled; -} -void AccessibilityAdaptor::SetIndicator(Indicator* indicator) -{ - mIndicator = indicator; -} - -AccessibilityAdaptor::AccessibilityAdaptor() -: mIsEnabled(false), - mActionHandler(NULL), - mIndicator(NULL), - mIndicatorFocused(false) -{ - mIsEnabled = GetEnabledVConf(); - DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, mIsEnabled ? "ENABLED" : "DISABLED" ); - - vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, this ); - vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, this ); - - mAccessibilityGestureDetector = new AccessibilityGestureDetector(); + return adaptor; } -AccessibilityAdaptor::~AccessibilityAdaptor() +void AccessibilityAdaptor::OnDestroy() { vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification ); vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification );