From: Paul Wisbey Date: Wed, 16 Dec 2015 11:00:14 +0000 (+0000) Subject: Reduced the amount of AccessibilityAdaptor copy 'n' paste X-Git-Tag: dali_1.1.15~4 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=d738d9889a07023673f4dd092a6776bff4f7116e Reduced the amount of AccessibilityAdaptor copy 'n' paste The 'mobile' version is different since it forwards events to the indicator. There is currently no reason to have a different version for X11 vs Wayland. Change-Id: I370b26763867beca7b8064a1b3e9b6a243f8a098 --- diff --git a/adaptors/wayland/accessibility-adaptor-impl-wl.cpp b/adaptors/common/accessibility-adaptor-impl.cpp similarity index 67% rename from adaptors/wayland/accessibility-adaptor-impl-wl.cpp rename to adaptors/common/accessibility-adaptor-impl.cpp index d5a166f..1729b15 100644 --- a/adaptors/wayland/accessibility-adaptor-impl-wl.cpp +++ b/adaptors/common/accessibility-adaptor-impl.cpp @@ -19,13 +19,10 @@ #include "accessibility-adaptor-impl.h" // EXTERNAL INCLUDES -#include -#include -#include -#include - #include #include +#include +#include #include // INTERNAL INCLUDES @@ -40,6 +37,87 @@ namespace Internal namespace Adaptor { +namespace // unnamed namespace +{ + +#if defined(DEBUG_ENABLED) +Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR"); +#endif + +} // unnamed namespace + +AccessibilityAdaptor::AccessibilityAdaptor() +: mReadPosition(), + mActionHandler( NULL ), + mIndicator( NULL ), + mIsEnabled( false ), + mIndicatorFocused( false ) +{ + mAccessibilityGestureDetector = new AccessibilityGestureDetector(); +} + +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& adaptorImpl = Adaptor::GetImplementation( adaptor ); + adaptorImpl.DestroyTtsPlayer( Dali::TtsPlayer::SCREEN_READER ); + } + } +} + +bool AccessibilityAdaptor::IsEnabled() const +{ + return mIsEnabled; +} + +Vector2 AccessibilityAdaptor::GetReadPosition() const +{ + return mReadPosition; +} + +void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler) +{ + mActionHandler = &handler; +} + +void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler) +{ + if( mAccessibilityGestureDetector ) + { + mAccessibilityGestureDetector->SetGestureHandler(handler); + } +} + +void AccessibilityAdaptor::SetIndicator(IndicatorInterface* indicator) +{ + mIndicator = indicator; +} + bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback) { bool ret = false; @@ -91,55 +169,9 @@ bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, mReadPosition.x = x; mReadPosition.y = y; - Dali::AccessibilityAdaptor handle( this ); - - bool indicatorFocused = false; - - // Check whether the Indicator is focused - if( mIndicator && mIndicator->IsConnected() ) - { - // Check the position and size of Indicator actor - Dali::Actor indicatorActor = mIndicator->GetActor(); - Vector3 position = Vector3(0.0f, 0.0f, 0.0f); - Vector3 size = indicatorActor.GetCurrentSize(); - - if(mReadPosition.x >= position.x && - mReadPosition.x <= position.x + size.width && - mReadPosition.y >= position.y && - mReadPosition.y <= position.y + size.height) - { - indicatorFocused = true; - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Indicator area!!!!\n", __FUNCTION__, __LINE__); - } - } - - if( mIndicator ) - { - if( !mIndicatorFocused && indicatorFocused ) - { - // If Indicator is focused, the focus should be cleared in Dali focus chain. - if( mActionHandler ) - { - mActionHandler->ClearAccessibilityFocus(); - } - } - else if( mIndicatorFocused && !indicatorFocused ) - { - } - - mIndicatorFocused = indicatorFocused; - - // Send accessibility READ action information to Indicator - if( mIndicatorFocused ) - { - } - } - - if( mActionHandler && !mIndicatorFocused) + if( mActionHandler ) { - // If Indicator is not focused, the accessibility actions should be handled by the registered - // accessibility action handler (e.g. focus manager) - ret = mActionHandler->AccessibilityActionRead(allowReadAgain); + ret = mActionHandler->AccessibilityActionRead( allowReadAgain ); DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); } @@ -150,8 +182,6 @@ bool AccessibilityAdaptor::HandleActionReadNextEvent(bool allowEndFeedback) { bool ret = false; - Dali::AccessibilityAdaptor handle( this ); - if( mActionHandler ) { ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback); @@ -194,8 +224,6 @@ bool AccessibilityAdaptor::HandleActionDownEvent() { bool ret = false; - Dali::AccessibilityAdaptor handle( this ); - if( mActionHandler ) { ret = mActionHandler->AccessibilityActionDown(); @@ -206,6 +234,87 @@ bool AccessibilityAdaptor::HandleActionDownEvent() return ret; } +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 ) + { + mAccessibilityGestureDetector->SendEvent( touchEvent ); + ret = true; + } + } + + return ret; +} + +bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) +{ + bool ret = false; + + Dali::TouchEvent touchEvent(timeStamp); + touchEvent.points.push_back(point); + + 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(); +} + bool AccessibilityAdaptor::HandleActionScrollUpEvent() { bool ret = false; @@ -403,6 +512,12 @@ bool AccessibilityAdaptor::HandleActionStartStopEvent() return ret; } +AccessibilityAdaptor::~AccessibilityAdaptor() +{ + // Do any platform specific clean-up in OnDestroy() + OnDestroy(); +} + } // namespace Adaptor } // namespace Internal diff --git a/adaptors/common/accessibility-adaptor-impl.h b/adaptors/common/accessibility-adaptor-impl.h index dd2e065..f6a59f5 100644 --- a/adaptors/common/accessibility-adaptor-impl.h +++ b/adaptors/common/accessibility-adaptor-impl.h @@ -49,21 +49,19 @@ class AccessibilityAdaptor : public Dali::BaseObject { public: - // Creation - /** * Constructor. */ AccessibilityAdaptor(); /** - * Get an instance of the AccessibilityAdaptor. + * @brief Get an instance of the AccessibilityAdaptor. + * + * @note This singleton-style getter can be reimplemented for different platforms. * @return The instance of the AccessibilityAdaptor. */ static Dali::AccessibilityAdaptor Get(); - // Public API - /** * Turn on accessibility action * This method should be called by vconf callback @@ -105,42 +103,42 @@ public: /** * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent() */ - bool HandleActionNextEvent(bool allowEndFeedback = true); + virtual bool HandleActionNextEvent( bool allowEndFeedback = true); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionPreviousEvent() */ - bool HandleActionPreviousEvent(bool allowEndFeedback = true); + virtual bool HandleActionPreviousEvent( bool allowEndFeedback = true); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionActivateEvent() */ - bool HandleActionActivateEvent(); + virtual bool HandleActionActivateEvent(); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionReadEvent() */ - bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain); + virtual bool HandleActionReadEvent( unsigned int x, unsigned int y, bool allowReadAgain ); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionReadNextEvent() */ - bool HandleActionReadNextEvent(bool allowEndFeedback = true); + virtual bool HandleActionReadNextEvent( bool allowEndFeedback = true); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPreviousEvent() */ - bool HandleActionReadPreviousEvent(bool allowEndFeedback = true); + virtual bool HandleActionReadPreviousEvent( bool allowEndFeedback = true); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionUpEvent() */ - bool HandleActionUpEvent(); + virtual bool HandleActionUpEvent(); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionDownEvent() */ - bool HandleActionDownEvent(); + virtual bool HandleActionDownEvent(); /** * @copydoc Dali::AccessibilityAdaptor::HandleActionClearFocusEvent() @@ -242,24 +240,31 @@ public: */ bool HandleActionStartStopEvent(); -private: - - // Destruction +protected: /** * Destructor. */ virtual ~AccessibilityAdaptor(); +private: + + /** + * @brief Called when the singleton is destroyed. + * + * @note This can be reimplemented for different platforms. + * @return The instance of the AccessibilityAdaptor. + */ + static void OnDestroy(); + // Undefined AccessibilityAdaptor( const AccessibilityAdaptor& ); AccessibilityAdaptor& operator=( AccessibilityAdaptor& ); -private: +protected: Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events. - bool mIsEnabled; ///< enable/disable the accessibility action Vector2 mReadPosition; ///< ActionRead position AccessibilityActionHandler* mActionHandler; ///< The pointer of accessibility action handler @@ -267,7 +272,9 @@ private: AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector IndicatorInterface* mIndicator; ///< The indicator - bool mIndicatorFocused; ///< Whether the Indicator is focused + + bool mIsEnabled : 1; ///< enable/disable the accessibility action + bool mIndicatorFocused : 1; ///< Whether the Indicator is focused public: diff --git a/adaptors/common/file.list b/adaptors/common/file.list index b1dc5aa..a3aebac 100644 --- a/adaptors/common/file.list +++ b/adaptors/common/file.list @@ -2,6 +2,7 @@ adaptor_common_internal_src_files = \ $(adaptor_common_dir)/abort-handler.cpp \ + $(adaptor_common_dir)/accessibility-adaptor-impl.cpp \ $(adaptor_common_dir)/accessibility-gesture-detector.cpp \ $(adaptor_common_dir)/adaptor.cpp \ $(adaptor_common_dir)/adaptor-impl.cpp \ diff --git a/adaptors/x11/accessibility-adaptor-impl-x.cpp b/adaptors/mobile/accessibility-adaptor-impl-mobile.cpp similarity index 54% rename from adaptors/x11/accessibility-adaptor-impl-x.cpp rename to adaptors/mobile/accessibility-adaptor-impl-mobile.cpp index c7f90f5..77c0f01 100644 --- a/adaptors/x11/accessibility-adaptor-impl-x.cpp +++ b/adaptors/mobile/accessibility-adaptor-impl-mobile.cpp @@ -16,17 +16,21 @@ */ // CLASS HEADER -#include "accessibility-adaptor-impl.h" +#include "accessibility-adaptor-impl-mobile.h" // EXTERNAL INCLUDES #include #include #include +#include +#include +#include #include #include // INTERNAL INCLUDES +#include #include "system-settings.h" #define MSG_DOMAIN_CONTROL_ACCESS (int)ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL @@ -40,13 +44,112 @@ namespace Internal namespace Adaptor { -namespace { +namespace // unnamed namespace +{ + #if defined(DEBUG_ENABLED) Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR"); #endif + +const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS = "db/setting/accessibility/atspi"; + +bool GetEnabledVConf() +{ + int isEnabled = 0; + vconf_get_bool( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, &isEnabled ); + + if( isEnabled == 0 ) + { + vconf_get_bool( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled ); + } + + return (bool)isEnabled; +} + + +void AccessibilityOnOffNotification(keynode_t* node, void* data) +{ + AccessibilityAdaptor* adaptor = static_cast( data ); + + bool isEnabled = GetEnabledVConf(); + + DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" ); + + if( isEnabled ) + { + adaptor->EnableAccessibility(); + } + else + { + adaptor->DisableAccessibility(); + } +} + +BaseHandle Create() +{ + BaseHandle handle( AccessibilityAdaptor::Get() ); + + if ( !handle ) + { + Dali::SingletonService service( SingletonService::Get() ); + if ( service ) + { + Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() ); + AccessibilityAdaptorMobile& adaptorImpl = AccessibilityAdaptorMobile::GetImplementation( adaptor ); + + bool isEnabled = GetEnabledVConf(); + + if( isEnabled ) + { + adaptorImpl.EnableAccessibility(); + } + DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" ); + + vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl ); + vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl ); + + 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 -bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback) +Dali::AccessibilityAdaptor AccessibilityAdaptor::Get() +{ + Dali::AccessibilityAdaptor adaptor; + + Dali::SingletonService service( SingletonService::Get() ); + if ( service ) + { + // Check whether the singleton is already created + Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityAdaptor ) ); + if(handle) + { + // If so, downcast the handle + adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) ); + } + } + + return adaptor; +} + +void AccessibilityAdaptor::OnDestroy() +{ + vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification ); + vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification ); +} + +AccessibilityAdaptorMobile::AccessibilityAdaptorMobile() +{ +} + +bool AccessibilityAdaptorMobile::HandleActionNextEvent(bool allowEndFeedback) { bool ret = false; @@ -67,7 +170,7 @@ bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback) return ret; } -bool AccessibilityAdaptor::HandleActionPreviousEvent(bool allowEndFeedback) +bool AccessibilityAdaptorMobile::HandleActionPreviousEvent(bool allowEndFeedback) { bool ret = false; @@ -88,7 +191,7 @@ bool AccessibilityAdaptor::HandleActionPreviousEvent(bool allowEndFeedback) return ret; } -bool AccessibilityAdaptor::HandleActionActivateEvent() +bool AccessibilityAdaptorMobile::HandleActionActivateEvent() { bool ret = false; @@ -109,7 +212,7 @@ bool AccessibilityAdaptor::HandleActionActivateEvent() return ret; } -bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) +bool AccessibilityAdaptorMobile::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) { bool ret = false; @@ -195,7 +298,7 @@ bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, return ret; } -bool AccessibilityAdaptor::HandleActionReadNextEvent(bool allowEndFeedback) +bool AccessibilityAdaptorMobile::HandleActionReadNextEvent(bool allowEndFeedback) { bool ret = false; @@ -216,7 +319,7 @@ bool AccessibilityAdaptor::HandleActionReadNextEvent(bool allowEndFeedback) return ret; } -bool AccessibilityAdaptor::HandleActionReadPreviousEvent(bool allowEndFeedback) +bool AccessibilityAdaptorMobile::HandleActionReadPreviousEvent(bool allowEndFeedback) { bool ret = false; @@ -237,7 +340,7 @@ bool AccessibilityAdaptor::HandleActionReadPreviousEvent(bool allowEndFeedback) return ret; } -bool AccessibilityAdaptor::HandleActionUpEvent() +bool AccessibilityAdaptorMobile::HandleActionUpEvent() { bool ret = false; @@ -258,7 +361,7 @@ bool AccessibilityAdaptor::HandleActionUpEvent() return ret; } -bool AccessibilityAdaptor::HandleActionDownEvent() +bool AccessibilityAdaptorMobile::HandleActionDownEvent() { bool ret = false; @@ -279,257 +382,8 @@ bool AccessibilityAdaptor::HandleActionDownEvent() return ret; } -bool AccessibilityAdaptor::HandleActionScrollUpEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionScrollUp(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - - -bool AccessibilityAdaptor::HandleActionScrollDownEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionScrollDown(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageLeftEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageLeft(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageRightEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageRight(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageUpEvent() +AccessibilityAdaptorMobile::~AccessibilityAdaptorMobile() { - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageUp(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageDownEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageDown(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionMoveToFirstEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionMoveToFirst(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionMoveToLastEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionMoveToLast(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadFromTopEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadFromTop(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadFromNextEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadFromNext(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionZoomEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionZoom(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadIndicatorInformation(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadPauseResume(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionStartStopEvent() -{ - bool ret = false; - - if( mIndicator && mIndicatorFocused ) - { - // TODO: Send message to indicator with the correct action type - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionStartStop(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; } } // namespace Adaptor diff --git a/adaptors/mobile/accessibility-adaptor-impl-mobile.h b/adaptors/mobile/accessibility-adaptor-impl-mobile.h new file mode 100644 index 0000000..032d949 --- /dev/null +++ b/adaptors/mobile/accessibility-adaptor-impl-mobile.h @@ -0,0 +1,133 @@ +#ifndef __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_MOBILE_H__ +#define __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_MOBILE_H__ + +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * This mobile version is different since it forwards events to the indicator. + */ +class AccessibilityAdaptorMobile : public AccessibilityAdaptor +{ +public: + + /** + * Constructor. + */ + AccessibilityAdaptorMobile(); + + // From AccessibilityAdaptor base class + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent() + */ + virtual bool HandleActionNextEvent( bool allowEndFeedback ); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPreviousEvent() + */ + virtual bool HandleActionPreviousEvent( bool allowEndFeedback ); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionActivateEvent() + */ + virtual bool HandleActionActivateEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadEvent() + */ + virtual bool HandleActionReadEvent( unsigned int x, unsigned int y, bool allowReadAgain ); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadNextEvent() + */ + virtual bool HandleActionReadNextEvent( bool allowEndFeedback ); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPreviousEvent() + */ + virtual bool HandleActionReadPreviousEvent( bool allowEndFeedback ); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionUpEvent() + */ + virtual bool HandleActionUpEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionDownEvent() + */ + virtual bool HandleActionDownEvent(); + +private: + + /** + * Destructor. + */ + virtual ~AccessibilityAdaptorMobile(); + + // Undefined + AccessibilityAdaptorMobile( const AccessibilityAdaptorMobile& ); + AccessibilityAdaptorMobile& operator=( AccessibilityAdaptorMobile& ); + +public: + + // Helpers for public-api forwarding methods + + inline static Internal::Adaptor::AccessibilityAdaptorMobile& GetImplementation(Dali::AccessibilityAdaptor& adaptor) + { + DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptorMobile handle is empty" ); + + BaseObject& handle = adaptor.GetBaseObject(); + + return static_cast(handle); + } + + inline static const Internal::Adaptor::AccessibilityAdaptorMobile& GetImplementation(const Dali::AccessibilityAdaptor& adaptor) + { + DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptorMobile handle is empty" ); + + const BaseObject& handle = adaptor.GetBaseObject(); + + return static_cast(handle); + } + +}; + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_MOBILE_H__ diff --git a/adaptors/mobile/file.list b/adaptors/mobile/file.list index a38ad4b..abe484d 100644 --- a/adaptors/mobile/file.list +++ b/adaptors/mobile/file.list @@ -1,5 +1,6 @@ # mobile profile internal files adaptor_common_internal_mobile_profile_src_files = \ + $(adaptor_mobile_dir)/accessibility-adaptor-impl-mobile.cpp \ $(adaptor_mobile_dir)/pixmap-render-surface-factory.cpp \ $(adaptor_mobile_dir)/mobile-system-settings.cpp \ $(adaptor_mobile_dir)/mobile-color-controller-impl.cpp diff --git a/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp b/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp index 8b758d2..70aa0ad 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() @@ -91,6 +87,19 @@ BaseHandle Create() if ( service ) { Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() ); + AccessibilityAdaptor& adaptorImpl = AccessibilityAdaptor::GetImplementation( adaptor ); + + bool isEnabled = GetEnabledVConf(); + + if( isEnabled ) + { + adaptorImpl.EnableAccessibility(); + } + DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" ); + + vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl ); + vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl ); + service.Register( typeid( adaptor ), adaptor ); handle = adaptor; } @@ -98,6 +107,7 @@ BaseHandle Create() return handle; } + TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ ); } // unnamed namespace @@ -121,166 +131,7 @@ Dali::AccessibilityAdaptor AccessibilityAdaptor::Get() 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 ) - { - mAccessibilityGestureDetector->SendEvent(touchEvent); - ret = true; - } - } - - return ret; -} - -bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) -{ - bool ret = false; - - Dali::TouchEvent touchEvent(timeStamp); - touchEvent.points.push_back(point); - - 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 ); - } - } -} - -bool AccessibilityAdaptor::IsEnabled() const -{ - return mIsEnabled; -} - -void AccessibilityAdaptor::SetIndicator(IndicatorInterface* indicator) -{ - mIndicator = indicator; -} - -AccessibilityAdaptor::AccessibilityAdaptor() -: mIsEnabled( false ), - mReadPosition(), - 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(); -} - -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 ); diff --git a/adaptors/tizen/file.list b/adaptors/tizen/file.list index 09a6206..bd4325d 100644 --- a/adaptors/tizen/file.list +++ b/adaptors/tizen/file.list @@ -1,9 +1,12 @@ # tizen adaptor_tizen_internal_src_files = \ - $(adaptor_tizen_dir)/accessibility-adaptor-impl-tizen.cpp \ $(adaptor_tizen_dir)/adaptor-impl-tizen.cpp \ $(adaptor_tizen_dir)/framework-tizen.cpp \ $(adaptor_tizen_dir)/vsync-monitor-tizen.cpp \ $(adaptor_tizen_dir)/tilt-sensor-impl-tizen.cpp \ $(adaptor_tizen_dir)/tts-player-impl-tizen.cpp + +# common to tizen platforms except not for mobile +adaptor_tizen_internal_non_mobile_src_files = \ + $(adaptor_tizen_dir)/accessibility-adaptor-impl-tizen.cpp diff --git a/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp b/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp index d85e6a9..c1964d7 100644 --- a/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp +++ b/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +20,9 @@ // EXTERNAL INCLUDES #include -#include -#include -#include -#include // INTERNAL INCLUDES #include -#include "system-settings.h" namespace Dali { @@ -38,11 +33,8 @@ namespace Internal namespace Adaptor { -namespace +namespace // unnamed namespace { -#if defined(DEBUG_ENABLED) -Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR"); -#endif BaseHandle Create() { @@ -61,6 +53,7 @@ BaseHandle Create() return handle; } + TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ ); } // unnamed namespace @@ -84,515 +77,9 @@ Dali::AccessibilityAdaptor AccessibilityAdaptor::Get() 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 ) - { - mAccessibilityGestureDetector->SendEvent( touchEvent ); - ret = true; - } - } - - return ret; -} - -bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) -{ - bool ret = false; - - Dali::TouchEvent touchEvent(timeStamp); - touchEvent.points.push_back(point); - - 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::GetImplementation( adaptor ).DestroyTtsPlayer( Dali::TtsPlayer::SCREEN_READER ); - } - } -} - -bool AccessibilityAdaptor::IsEnabled() const -{ - return mIsEnabled; -} - -void AccessibilityAdaptor::SetIndicator(IndicatorInterface* indicator) -{ - mIndicator = indicator; -} - -AccessibilityAdaptor::AccessibilityAdaptor() -: mIsEnabled( false ), - mReadPosition(), - mActionHandler( NULL ), - mIndicator( NULL ), - mIndicatorFocused( false ) +void AccessibilityAdaptor::OnDestroy() { - mAccessibilityGestureDetector = new AccessibilityGestureDetector(); -} - -AccessibilityAdaptor::~AccessibilityAdaptor() -{ -} - -bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback) -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionActivateEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionActivate(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) -{ - bool ret = false; - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %d , %d\n", __FUNCTION__, __LINE__, x, y); - - mReadPosition.x = x; - mReadPosition.y = y; - - bool indicatorFocused = false; - - // Check whether the Indicator is focused - if( mIndicator && mIndicator->IsConnected() ) - { - // Check the position and size of Indicator actor - Dali::Actor indicatorActor = mIndicator->GetActor(); - Vector3 position = Vector3(0.0f, 0.0f, 0.0f); - Vector3 size = indicatorActor.GetCurrentSize(); - - if(mReadPosition.x >= position.x && - mReadPosition.x <= position.x + size.width && - mReadPosition.y >= position.y && - mReadPosition.y <= position.y + size.height) - { - indicatorFocused = true; - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Indicator area!!!!\n", __FUNCTION__, __LINE__); - } - } - - if( mIndicator ) - { - if( !mIndicatorFocused && indicatorFocused ) - { - // If Indicator is focused, the focus should be cleared in Dali focus chain. - if( mActionHandler ) - { - mActionHandler->ClearAccessibilityFocus(); - } - } - - mIndicatorFocused = indicatorFocused; - - // Send accessibility READ action information to Indicator - if( mIndicatorFocused ) - { - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__); - } - } - - if( mActionHandler && !mIndicatorFocused) - { - // If Indicator is not focused, the accessibility actions should be handled by the registered - // accessibility action handler (e.g. focus manager) - ret = mActionHandler->AccessibilityActionRead( allowReadAgain ); - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - } - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadNextEvent(bool allowEndFeedback) -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionUpEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionUp(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionDownEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionDown(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionScrollUpEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionScrollUp(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - - -bool AccessibilityAdaptor::HandleActionScrollDownEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionScrollDown(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageLeftEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageLeft(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageRightEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageRight(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageUpEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageUp(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionPageDownEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPageDown(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionMoveToFirstEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionMoveToFirst(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionMoveToLastEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionMoveToLast(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadFromTopEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadFromTop(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadFromNextEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadFromNext(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionZoomEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionZoom(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadIndicatorInformation(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadPauseResume(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityAdaptor::HandleActionStartStopEvent() -{ - bool ret = false; - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionStartStop(); - } - - DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; + // Nothing to do here } } // namespace Adaptor diff --git a/adaptors/wayland/file.list b/adaptors/wayland/file.list index 5c2933f..fcf9457 100644 --- a/adaptors/wayland/file.list +++ b/adaptors/wayland/file.list @@ -1,7 +1,6 @@ # wayland adaptor_wayland_tizen_internal_src_files = \ - $(adaptor_wayland_dir)/accessibility-adaptor-impl-wl.cpp \ $(adaptor_wayland_dir)/clipboard-impl-wl.cpp \ $(adaptor_wayland_dir)/display-connection-impl-wl.cpp \ $(adaptor_wayland_dir)/framework-wl.cpp \ diff --git a/adaptors/x11/file.list b/adaptors/x11/file.list index 5a68671..75bce2e 100644 --- a/adaptors/x11/file.list +++ b/adaptors/x11/file.list @@ -27,14 +27,12 @@ adaptor_x11_ubuntu_internal_src_files = \ adaptor_x11_tizen_internal_src_files = \ $(_adaptor_x11_internal_src_files) \ - $(adaptor_x11_dir)/accessibility-adaptor-impl-x.cpp \ $(adaptor_x11_dir)/framework-x.cpp \ $(adaptor_x11_dir)/key-mapping-x.cpp \ $(adaptor_x11_dir)/window-extensions.cpp adaptor_x11_tv_internal_src_files = \ $(_adaptor_x11_internal_src_files) \ - $(adaptor_x11_dir)/accessibility-adaptor-impl-x.cpp \ $(adaptor_x11_dir)/framework-x.cpp adaptor_x11_internal_default_profile_src_files = \ diff --git a/build/tizen/adaptor/Makefile.am b/build/tizen/adaptor/Makefile.am index 80d4de4..205659e 100644 --- a/build/tizen/adaptor/Makefile.am +++ b/build/tizen/adaptor/Makefile.am @@ -100,6 +100,7 @@ adaptor_internal_src_files = $(adaptor_common_internal_src_files) \ $(adaptor_common_internal_default_profile_src_files) \ $(adaptor_ecore_common_internal_src_files) \ $(adaptor_tizen_internal_src_files) \ + $(adaptor_tizen_internal_non_mobile_src_files) \ $(static_libraries_libunibreak_src_files) if WAYLAND @@ -167,6 +168,7 @@ adaptor_internal_src_files = $(adaptor_common_internal_src_files) \ $(adaptor_common_internal_tv_profile_src_files) \ $(adaptor_ecore_common_internal_src_files) \ $(adaptor_tizen_internal_src_files) \ + $(adaptor_tizen_internal_non_mobile_src_files) \ $(static_libraries_libunibreak_src_files) if WAYLAND adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files)