From: Richard Huang Date: Fri, 12 Jun 2015 15:31:42 +0000 (+0100) Subject: Add support for new accessibility actions X-Git-Tag: dali_1.0.47~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F41351%2F9;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Add support for new accessibility actions 1. Rename AccessibilityManager to AccessibilityAdaptor 2. Added support of getting accessibility messages from dbus 3. Added support for new accessibility actions Change-Id: I96f2a1bbb6ee92e71dc1cc010a6551f6042568e9 --- diff --git a/adaptors/common/accessibility-adaptor-impl.h b/adaptors/common/accessibility-adaptor-impl.h new file mode 100644 index 0000000..c529a80 --- /dev/null +++ b/adaptors/common/accessibility-adaptor-impl.h @@ -0,0 +1,301 @@ +#ifndef __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H__ +#define __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H__ + +/* + * Copyright (c) 2014 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. + * + */ + +// EXTERNAL INCLUDES +#include + +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * This class detects to accessibility action + */ +class AccessibilityAdaptor : public Dali::BaseObject +{ +public: + + // Creation + + /** + * Constructor. + */ + AccessibilityAdaptor(); + + /** + * Get an instance of the AccessibilityAdaptor. + * @return The instance of the AccessibilityAdaptor. + */ + static Dali::AccessibilityAdaptor Get(); + + // Public API + + /** + * Turn on accessibility action + * This method should be called by vconf callback + */ + void EnableAccessibility(); + + /** + * Turn off accessibility action + * This method should be called by vconf callback + */ + void DisableAccessibility(); + + /** + * @copydoc Dali::AccessibilityAdaptor::IsEnabled() + */ + bool IsEnabled() const; + + /** + * @copydoc Dali::AccessibilityAdaptor::GetReadPosition() const + */ + Vector2 GetReadPosition() const; + + /** + * @copydoc Dali::AccessibilityAdaptor::SetActionHandler() + */ + void SetActionHandler(AccessibilityActionHandler& handler); + + /** + * @copydoc Dali::AccessibilityAdaptor::SetGestureHandler() + */ + void SetGestureHandler(AccessibilityGestureHandler& handler); + + /** + * Set the Indicator + */ + void SetIndicator(Indicator* indicator); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent() + */ + bool HandleActionNextEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPreviousEvent() + */ + bool HandleActionPreviousEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionActivateEvent() + */ + bool HandleActionActivateEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadEvent() + */ + bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadNextEvent() + */ + bool HandleActionReadNextEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPreviousEvent() + */ + bool HandleActionReadPreviousEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionUpEvent() + */ + bool HandleActionUpEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionDownEvent() + */ + bool HandleActionDownEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionClearFocusEvent() + */ + bool HandleActionClearFocusEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionScrollEvent() + */ + bool HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionTouchEvent() + */ + bool HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionBackEvent() + */ + bool HandleActionBackEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionEnableEvent() + */ + void HandleActionEnableEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionDisableEvent() + */ + void HandleActionDisableEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionScrollUpEvent() + */ + bool HandleActionScrollUpEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionScrollDownEvent() + */ + bool HandleActionScrollDownEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageLeftEvent() + */ + bool HandleActionPageLeftEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageRightEvent() + */ + bool HandleActionPageRightEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageUpEvent() + */ + bool HandleActionPageUpEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageDownEvent() + */ + bool HandleActionPageDownEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionMoveToFirstEvent() + */ + bool HandleActionMoveToFirstEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionMoveToLastEvent() + */ + bool HandleActionMoveToLastEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadFromTopEvent() + */ + bool HandleActionReadFromTopEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadFromNextEvent() + */ + bool HandleActionReadFromNextEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionZoomEvent() + */ + bool HandleActionZoomEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent() + */ + bool HandleActionReadIndicatorInformationEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPauseResumeEvent() + */ + bool HandleActionReadPauseResumeEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionStartStopEvent() + */ + bool HandleActionStartStopEvent(); + +private: + + // Destruction + + /** + * Destructor. + */ + virtual ~AccessibilityAdaptor(); + + // Undefined + AccessibilityAdaptor( const AccessibilityAdaptor& ); + AccessibilityAdaptor& operator=( AccessibilityAdaptor& ); + +private: + + 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 + + AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector + + Indicator* mIndicator; ///< The indicator + bool mIndicatorFocused; ///< Whether the Indicator is focused + +public: + + // Helpers for public-api forwarding methods + + inline static Internal::Adaptor::AccessibilityAdaptor& GetImplementation(Dali::AccessibilityAdaptor& adaptor) + { + DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptor handle is empty" ); + + BaseObject& handle = adaptor.GetBaseObject(); + + return static_cast(handle); + } + + inline static const Internal::Adaptor::AccessibilityAdaptor& GetImplementation(const Dali::AccessibilityAdaptor& adaptor) + { + DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptor handle is empty" ); + + const BaseObject& handle = adaptor.GetBaseObject(); + + return static_cast(handle); + } + +}; + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H__ diff --git a/adaptors/common/accessibility-gesture-detector.cpp b/adaptors/common/accessibility-gesture-detector.cpp index 81d9d2e..173eabe 100644 --- a/adaptors/common/accessibility-gesture-detector.cpp +++ b/adaptors/common/accessibility-gesture-detector.cpp @@ -21,9 +21,6 @@ // EXTERNAL INCLUDES #include -// INTERNAL INCLUDES -#include - namespace Dali { diff --git a/adaptors/common/accessibility-manager-impl.h b/adaptors/common/accessibility-manager-impl.h deleted file mode 100644 index 3c6ebf8..0000000 --- a/adaptors/common/accessibility-manager-impl.h +++ /dev/null @@ -1,354 +0,0 @@ -#ifndef __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__ -#define __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__ - -/* - * Copyright (c) 2014 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. - * - */ - -// EXTERNAL INCLUDES -#include - -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * This class detects to accessibility action - */ -class AccessibilityManager : public Dali::BaseObject -{ -public: - - typedef Dali::AccessibilityManager::AccessibilityActionSignalType AccessibilityActionSignalType; - typedef Dali::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType; - - // Creation - - /** - * Constructor. - */ - AccessibilityManager(); - - /** - * Get an instance of the AccessibilityManager. - * @return The instance of the AccessibilityManager. - */ - static Dali::AccessibilityManager Get(); - - // Public API - - /** - * Turn on accessibility action - * This method should be called by vconf callback - */ - void EnableAccessibility(); - - /** - * Turn off accessibility action - * This method should be called by vconf callback - */ - void DisableAccessibility(); - - /** - * @copydoc Dali::AccessibilityManager::IsEnabled() - */ - bool IsEnabled() const; - - /** - * @copydoc Dali::AccessibilityManager::GetReadPosition() const - */ - Vector2 GetReadPosition() const; - - /** - * @copydoc Dali::AccessibilityManager::SetActionHandler() - */ - void SetActionHandler(AccessibilityActionHandler& handler); - - /** - * @copydoc Dali::AccessibilityManager::SetGestureHandler() - */ - void SetGestureHandler(AccessibilityGestureHandler& handler); - - /** - * Set the Indicator - */ - void SetIndicator(Indicator* indicator); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionNextEvent() - */ - bool HandleActionNextEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionPreviousEvent() - */ - bool HandleActionPreviousEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionActivateEvent() - */ - bool HandleActionActivateEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionReadEvent() - */ - bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionReadNextEvent() - */ - bool HandleActionReadNextEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionReadPreviousEvent() - */ - bool HandleActionReadPreviousEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionUpEvent() - */ - bool HandleActionUpEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionDownEvent() - */ - bool HandleActionDownEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionClearFocusEvent() - */ - bool HandleActionClearFocusEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionScrollEvent() - */ - bool HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionTouchEvent() - */ - bool HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionBackEvent() - */ - bool HandleActionBackEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionEnableEvent() - */ - void HandleActionEnableEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionDisableEvent() - */ - void HandleActionDisableEvent(); - -public: // Signals - - /** - * @copydoc Dali::AccessibilityManager::StatusChangedSignal - */ - AccessibilityActionSignalType& StatusChangedSignal() - { - return mStatusChangedSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionNextSignal - */ - AccessibilityActionSignalType& ActionNextSignal() - { - return mActionNextSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionPreviousSignal - */ - AccessibilityActionSignalType& ActionPreviousSignal() - { - return mActionPreviousSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionActivateSignal - */ - AccessibilityActionSignalType& ActionActivateSignal() - { - return mActionActivateSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionOverSignal - */ - AccessibilityActionSignalType& ActionOverSignal() - { - return mActionOverSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionReadSignal - */ - AccessibilityActionSignalType& ActionReadSignal() - { - return mActionReadSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionReadNextSignal - */ - AccessibilityActionSignalType& ActionReadNextSignal() - { - return mActionReadNextSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionReadPreviousSignal - */ - AccessibilityActionSignalType& ActionReadPreviousSignal() - { - return mActionReadPreviousSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionUpSignal - */ - AccessibilityActionSignalType& ActionUpSignal() - { - return mActionUpSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionDownSignal - */ - AccessibilityActionSignalType& ActionDownSignal() - { - return mActionDownSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionClearFocusSignal - */ - AccessibilityActionSignalType& ActionClearFocusSignal() - { - return mActionClearFocusSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionBackSignal - */ - AccessibilityActionSignalType& ActionBackSignal() - { - return mActionBackSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionScrollSignal - */ - AccessibilityActionScrollSignalType& ActionScrollSignal() - { - return mActionScrollSignal; - } - -private: - - // Destruction - - /** - * Destructor. - */ - virtual ~AccessibilityManager(); - - // Undefined - AccessibilityManager( const AccessibilityManager& ); - AccessibilityManager& operator=( AccessibilityManager& ); - -private: - - 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 - - AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector - - Indicator* mIndicator; ///< The indicator - bool mIndicatorFocused; ///< Whether the Indicator is focused - - AccessibilityActionSignalType mStatusChangedSignal; - AccessibilityActionSignalType mActionNextSignal; - AccessibilityActionSignalType mActionPreviousSignal; - AccessibilityActionSignalType mActionActivateSignal; - AccessibilityActionSignalType mActionOverSignal; - AccessibilityActionSignalType mActionReadSignal; - AccessibilityActionSignalType mActionReadNextSignal; - AccessibilityActionSignalType mActionReadPreviousSignal; - AccessibilityActionSignalType mActionUpSignal; - AccessibilityActionSignalType mActionDownSignal; - AccessibilityActionSignalType mActionClearFocusSignal; - AccessibilityActionSignalType mActionBackSignal; - AccessibilityActionScrollSignalType mActionScrollSignal; - -public: - - // Helpers for public-api forwarding methods - - inline static Internal::Adaptor::AccessibilityManager& GetImplementation(Dali::AccessibilityManager& manager) - { - DALI_ASSERT_ALWAYS( manager && "AccessibilityManager handle is empty" ); - - BaseObject& handle = manager.GetBaseObject(); - - return static_cast(handle); - } - - inline static const Internal::Adaptor::AccessibilityManager& GetImplementation(const Dali::AccessibilityManager& manager) - { - DALI_ASSERT_ALWAYS( manager && "AccessibilityManager handle is empty" ); - - const BaseObject& handle = manager.GetBaseObject(); - - return static_cast(handle); - } - -}; - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__ diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index b6af617..5fdd1be 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/adaptors/common/adaptor.cpp b/adaptors/common/adaptor.cpp index 55bea40..bb4658a 100644 --- a/adaptors/common/adaptor.cpp +++ b/adaptors/common/adaptor.cpp @@ -22,7 +22,7 @@ #include // INTERNAL INCLUDES -#include +#include #include #include #include diff --git a/adaptors/common/events/event-handler.h b/adaptors/common/events/event-handler.h index f431d18..ed80e69 100644 --- a/adaptors/common/events/event-handler.h +++ b/adaptors/common/events/event-handler.h @@ -25,7 +25,7 @@ // INTERNAL INCLUDES #include #include -#include +#include #include #include #include @@ -165,7 +165,7 @@ private: RotationObserver* mRotationObserver; ///< Pointer to rotation observer, if present. DragAndDropDetectorPtr mDragAndDropDetector; ///< Pointer to the drag & drop detector, to send Drag & Drop events to. - Dali::AccessibilityManager mAccessibilityManager; ///< Pointer to the accessibility manager + Dali::AccessibilityAdaptor mAccessibilityAdaptor; ///< Pointer to the accessibility adaptor Dali::ClipboardEventNotifier mClipboardEventNotifier; ///< Pointer to the clipboard event notifier Dali::Clipboard mClipboard;///< Pointer to the clipboard diff --git a/adaptors/common/indicator-impl.cpp b/adaptors/common/indicator-impl.cpp index f6fc67c..5a05183 100644 --- a/adaptors/common/indicator-impl.cpp +++ b/adaptors/common/indicator-impl.cpp @@ -39,7 +39,7 @@ // INTERNAL INCLUDES #include -#include +#include #include using Dali::Vector4; @@ -408,11 +408,11 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat Open( orientation ); - // register indicator to accessibility manager - Dali::AccessibilityManager accessibilityManager = AccessibilityManager::Get(); - if(accessibilityManager) + // register indicator to accessibility adaptor + Dali::AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get(); + if(accessibilityAdaptor) { - AccessibilityManager::GetImplementation( accessibilityManager ).SetIndicator( this ); + AccessibilityAdaptor::GetImplementation( accessibilityAdaptor ).SetIndicator( this ); } // hide the indicator by default mIndicatorActor.SetVisible( false ); diff --git a/adaptors/devel-api/adaptor-framework/accessibility-action-handler.h b/adaptors/devel-api/adaptor-framework/accessibility-action-handler.h index f2c2ed1..9cac7ca 100644 --- a/adaptors/devel-api/adaptor-framework/accessibility-action-handler.h +++ b/adaptors/devel-api/adaptor-framework/accessibility-action-handler.h @@ -46,6 +46,13 @@ public: virtual bool ClearAccessibilityFocus() = 0; /** + * Perform the accessibility action associated with a scroll event. + * @param touchEvent The touch point (and time) of the event. + * @return whether the focus is cleared or not. + */ + virtual bool AccessibilityActionScroll( Dali::TouchEvent& touchEvent ) = 0; + + /** * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up). * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end * @return whether the accessibility action is performed or not. @@ -108,6 +115,96 @@ public: virtual bool AccessibilityActionBack() = 0; /** + * Perform the accessibility action to scroll up the list and focus on the first item on the list + * after the scrolling and read the item (by two finger swipe up). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionScrollUp() = 0; + + /** + * Perform the accessibility action to scroll down the list and focus on the first item on the list + * after the scrolling and read the item (by two finger swipe down). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionScrollDown() = 0; + + /** + * Perform the accessibility action to scroll left to the previous page (by two finger swipe left). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageLeft() = 0; + + /** + * Perform the accessibility action to scroll right to the next page (by two finger swipe right). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageRight() = 0; + + /** + * Perform the accessibility action to scroll up to the previous page (by one finger swipe left and right). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageUp() = 0; + + /** + * Perform the accessibility action to scroll down to the next page (by one finger swipe right and left). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageDown() = 0; + + /** + * Perform the accessibility action to move the focus to the first item on the screen + * (by one finger swipe up and down). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionMoveToFirst() = 0; + + /** + * Perform the accessibility action to move the focus to the last item on the screen + * (by one finger swipe down and up). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionMoveToLast() = 0; + + /** + * Perform the accessibility action to move the focus to the first item on the top + * and read from the top item continously (by three fingers single tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadFromTop() = 0; + + /** + * Perform the accessibility action to move the focus to and read from the next item + * continously (by three fingers double tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadFromNext() = 0; + + /** + * Perform the accessibility action to move the focus to do the zooming (by one finger triple tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionZoom() = 0; + + /** + * Perform the accessibility action to read the information in the indicator (by two fingers triple tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadIndicatorInformation() = 0; + + /** + * Perform the accessibility action to pause/resume the current read out (by two fingers single tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadPauseResume() = 0; + + /** + * Perform the accessibility action to start/stop the current action (by two fingers double tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionStartStop() = 0; + + /** * Perform the accessibility action to mouse move (by one finger tap & hold and move). * @param touchEvent touch event structure * @return whether the accessibility action is performed or not. diff --git a/adaptors/devel-api/adaptor-framework/accessibility-adaptor.cpp b/adaptors/devel-api/adaptor-framework/accessibility-adaptor.cpp new file mode 100644 index 0000000..8cf99a5 --- /dev/null +++ b/adaptors/devel-api/adaptor-framework/accessibility-adaptor.cpp @@ -0,0 +1,210 @@ +/* + * 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. + * + */ + +// CLASS HEADER +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +AccessibilityAdaptor::AccessibilityAdaptor() +{ +} + +AccessibilityAdaptor AccessibilityAdaptor::Get() +{ + return Internal::Adaptor::AccessibilityAdaptor::Get(); +} + +AccessibilityAdaptor::~AccessibilityAdaptor() +{ +} + +Vector2 AccessibilityAdaptor::GetReadPosition() const +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).GetReadPosition(); +} + +bool AccessibilityAdaptor::IsEnabled() const +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).IsEnabled(); +} + +void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler) +{ + Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).SetActionHandler(handler); +} + +void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler) +{ + Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).SetGestureHandler(handler); +} + +bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback) +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionNextEvent(allowEndFeedback); +} + +bool AccessibilityAdaptor::HandleActionPreviousEvent(bool allowEndFeedback) +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionPreviousEvent(allowEndFeedback); +} + +bool AccessibilityAdaptor::HandleActionActivateEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionActivateEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain); +} + +bool AccessibilityAdaptor::HandleActionReadNextEvent(bool allowEndFeedback) +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadNextEvent(allowEndFeedback); +} + +bool AccessibilityAdaptor::HandleActionReadPreviousEvent(bool allowEndFeedback) +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadPreviousEvent(allowEndFeedback); +} + +bool AccessibilityAdaptor::HandleActionUpEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionUpEvent(); +} + +bool AccessibilityAdaptor::HandleActionDownEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionDownEvent(); +} + +bool AccessibilityAdaptor::HandleActionClearFocusEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionClearFocusEvent(); +} + +bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp) +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp); +} + +bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionTouchEvent(point, timeStamp); +} + +bool AccessibilityAdaptor::HandleActionBackEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionBackEvent(); +} + +void AccessibilityAdaptor::HandleActionEnableEvent() +{ + Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionEnableEvent(); +} + +void AccessibilityAdaptor::HandleActionDisableEvent() +{ + Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionDisableEvent(); +} + +bool AccessibilityAdaptor::HandleActionScrollUpEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionScrollUpEvent(); +} + +bool AccessibilityAdaptor::HandleActionScrollDownEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionScrollDownEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageLeftEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionPageLeftEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageRightEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionPageRightEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageUpEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionPageUpEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageDownEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionPageDownEvent(); +} + +bool AccessibilityAdaptor::HandleActionMoveToFirstEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionMoveToFirstEvent(); +} + +bool AccessibilityAdaptor::HandleActionMoveToLastEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionMoveToLastEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadFromTopEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadFromTopEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadFromNextEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadFromNextEvent(); +} + +bool AccessibilityAdaptor::HandleActionZoomEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionZoomEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadIndicatorInformationEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadPauseResumeEvent(); +} + +bool AccessibilityAdaptor::HandleActionStartStopEvent() +{ + return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionStartStopEvent(); +} + +AccessibilityAdaptor::AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor& manager ) +: BaseHandle( &manager ) +{ +} + +AccessibilityAdaptor::AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* manager ) +: BaseHandle( manager ) +{ +} + +} // namespace Dali diff --git a/adaptors/devel-api/adaptor-framework/accessibility-manager.h b/adaptors/devel-api/adaptor-framework/accessibility-adaptor.h similarity index 52% rename from adaptors/devel-api/adaptor-framework/accessibility-manager.h rename to adaptors/devel-api/adaptor-framework/accessibility-adaptor.h index a255831..0fb3d7e 100644 --- a/adaptors/devel-api/adaptor-framework/accessibility-manager.h +++ b/adaptors/devel-api/adaptor-framework/accessibility-adaptor.h @@ -1,5 +1,5 @@ -#ifndef __DALI_ACCESSIBILITY_MANAGER_H__ -#define __DALI_ACCESSIBILITY_MANAGER_H__ +#ifndef __DALI_ACCESSIBILITY_ADAPTOR_H__ +#define __DALI_ACCESSIBILITY_ADAPTOR_H__ /* * Copyright (c) 2015 Samsung Electronics Co., Ltd. @@ -22,7 +22,6 @@ // EXTERNAL INCLUDES #include #include -#include namespace Dali { @@ -31,7 +30,7 @@ namespace Internal DALI_INTERNAL { namespace Adaptor { -class AccessibilityManager; +class AccessibilityAdaptor; } } @@ -40,42 +39,33 @@ class AccessibilityGestureHandler; class TouchPoint; /** - * @brief The AccessibilityManager provides signals when accessibility & screen reader feature turned on in device. + * @brief The AccessibilityAdaptor provides communication to the indicator and the accessibility manager interface (implemented in toolkit). + * */ -class DALI_IMPORT_API AccessibilityManager : public BaseHandle +class DALI_IMPORT_API AccessibilityAdaptor : public BaseHandle { public: - // Typedefs - - /** - * @brief Accessibility Action Signal. - * - * Signal connected callback should return the result - */ - typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType; ///< Generic signal type - typedef Signal< bool (AccessibilityManager&, const Dali::TouchEvent&)> AccessibilityActionScrollSignalType; ///< Scroll signal type - /** * @brief Create an uninitialized handle. * - * This can be initialized by calling getting the manager from Dali::Adaptor. + * This can be initialized by calling getting the adaptor from Dali::Adaptor. */ - AccessibilityManager(); + AccessibilityAdaptor(); /** - * @brief Retrieve a handle to the AccessibilityManager. + * @brief Retrieve a handle to the AccessibilityAdaptor. * - * @return A handle to the AccessibilityManager. + * @return A handle to the AccessibilityAdaptor. */ - static AccessibilityManager Get(); + static AccessibilityAdaptor Get(); /** * @brief Destructor * * This is non-virtual since derived Handle types must not contain data or virtual methods. */ - ~AccessibilityManager(); + ~AccessibilityAdaptor(); /** * @brief Returns the current position of the read action. @@ -127,7 +117,7 @@ public: /** * @brief Handle the accessibility action to activate the current focused actor (by one - * finger double tap) + * finger ) * * @return Whether the action is performed successfully or not. */ @@ -222,180 +212,137 @@ public: */ void HandleActionDisableEvent(); -public: // Signals + /** + * @brief Handle the accessibility action to scroll up the list and focus on + * the first item on the list after the scrolling and read the item + * (by two finger swipe up). + * + * @return Whether the action is performed successfully or not. + */ + bool HandleActionScrollUpEvent(); /** - * @brief This is emitted when accessibility(screen-reader) feature turned on or off. + * @brief Handle the accessibility action to scroll down the list and focus on + * the first item on the list after the scrolling and read the item + * (by two finger swipe down). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& StatusChangedSignal(); + bool HandleActionScrollDownEvent(); /** - * @brief This is emitted when accessibility action is received to move focus to the next - * focusable actor (by one finger flick down). + * @brief Handle the accessibility action to scroll left to the previous page + * (by two finger swipe left). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionNextSignal(); + bool HandleActionPageLeftEvent(); /** - * @brief This is emitted when accessibility action is received to move focus to the previous - * focusable actor (by one finger flick up). + * @brief Handle the accessibility action to scroll right to the next page + * (by two finger swipe right). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionPreviousSignal(); + bool HandleActionPageRightEvent(); /** - * @brief This is emitted when accessibility action is received to activate the current focused - * actor (by one finger double tap). + * @brief Handle the accessibility action to scroll up to the previous page + * (by one finger swipe left and right). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionActivateSignal(); + bool HandleActionPageUpEvent(); /** - * @brief This is emitted when accessibility action is received to focus and read the actor - * (by one finger tap). + * @brief Handle the accessibility action to scroll down to the next page + * (by one finger swipe right and left). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionReadSignal(); + bool HandleActionPageDownEvent(); /** - * @brief This is emitted when accessibility action is received to focus and read the actor - * (by one finger move). + * @brief Handle the accessibility action to move the focus to the first item on the screen + * (by one finger swipe up and down). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionOverSignal(); + bool HandleActionMoveToFirstEvent(); /** - * @brief This is emitted when accessibility action is received to move focus to the next - * focusable actor (by one finger flick right). + * @brief Handle the accessibility action to move the focus to the last item on the screen + * (by one finger swipe down and up). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionReadNextSignal(); + bool HandleActionMoveToLastEvent(); /** - * @brief This is emitted when accessibility action is received to move focus to the previous - * focusable actor (by one finger flick left). + * @brief Handle the accessibility action to move the focus to the first item on the top + * and read from the top item continously (by three fingers single tap). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionReadPreviousSignal(); + bool HandleActionReadFromTopEvent(); /** - * @brief This is emitted when accessibility action is received to change the value when the - * current focused actor is a slider (by double finger down and move up and right). + * @brief Handle the accessibility action to move focus to and read from the next focusable + * actor continously (by three fingers double tap). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionUpSignal(); + bool HandleActionReadFromNextEvent(); /** - * @brief This is emitted when accessibility action is received to change the value when the - * current focused actor is a slider (by double finger down and move down and left). + * @brief Handle the accessibility action to do the zooming + * (by one finger triple tap). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionDownSignal(); + bool HandleActionZoomEvent(); /** - * @brief This is emitted when accessibility action is received to clear the focus from the - * current focused actor if any, so that no actor is focused in the focus chain. + * @brief Handle the accessibility action to read the information in the indicator + * (by two fingers triple tap). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionClearFocusSignal(); + bool HandleActionReadIndicatorInformationEvent(); /** - * @brief This is emitted when accessibility action is received to navigate back (by two - * fingers circle draw). + * @brief Handle the accessibility action to pause/resume the current speech + * (by two fingers single tap). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionSignalType& ActionBackSignal(); + bool HandleActionReadPauseResumeEvent(); /** - * @brief This is emitted when accessibility action is received to handle scroll event (by two - * fingers drag). + * @brief Handle the accessibility action to start/stop the current action + * (by two fingers double tap). * - * A callback of the following type may be connected: - * @code - * bool YourCallback( AccessibilityManager& manager, const TouchEvent& event ); - * @endcode - * @return The signal to connect to. + * @return Whether the action is performed successfully or not. */ - AccessibilityActionScrollSignalType& ActionScrollSignal(); + bool HandleActionStartStopEvent(); public: // Not intended for application developers /** * @brief Creates a handle using the Adaptor::Internal implementation. * - * @param[in] manager The AccessibilityManager implementation. + * @param[in] adaptor The AccessibilityAdaptor implementation. */ - DALI_INTERNAL AccessibilityManager( Internal::Adaptor::AccessibilityManager& manager ); + DALI_INTERNAL AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor& adaptor ); /** - * @brief This constructor is used by AccessibilityManager::Get(). + * @brief This constructor is used by AccessibilityAdaptor::Get(). * - * @param[in] manager A pointer to the accessibility manager. + * @param[in] adaptor A pointer to the accessibility adaptor. */ - explicit DALI_INTERNAL AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager ); + explicit DALI_INTERNAL AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor ); }; } // namespace Dali -#endif // __DALI_ACCESSIBILITY_MANAGER_H__ +#endif // __DALI_ACCESSIBILITY_ADAPTOR_H__ diff --git a/adaptors/devel-api/adaptor-framework/accessibility-manager.cpp b/adaptors/devel-api/adaptor-framework/accessibility-manager.cpp deleted file mode 100644 index 31bad23..0000000 --- a/adaptors/devel-api/adaptor-framework/accessibility-manager.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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. - * - */ - -// CLASS HEADER -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -AccessibilityManager::AccessibilityManager() -{ -} - -AccessibilityManager AccessibilityManager::Get() -{ - return Internal::Adaptor::AccessibilityManager::Get(); -} - -AccessibilityManager::~AccessibilityManager() -{ -} - -Vector2 AccessibilityManager::GetReadPosition() const -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).GetReadPosition(); -} - -bool AccessibilityManager::IsEnabled() const -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).IsEnabled(); -} - -void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler) -{ - Internal::Adaptor::AccessibilityManager::GetImplementation(*this).SetActionHandler(handler); -} - -void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler) -{ - Internal::Adaptor::AccessibilityManager::GetImplementation(*this).SetGestureHandler(handler); -} - -bool AccessibilityManager::HandleActionNextEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionNextEvent(allowEndFeedback); -} - -bool AccessibilityManager::HandleActionPreviousEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionPreviousEvent(allowEndFeedback); -} - -bool AccessibilityManager::HandleActionActivateEvent() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionActivateEvent(); -} - -bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain); -} - -bool AccessibilityManager::HandleActionReadNextEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionReadNextEvent(allowEndFeedback); -} - -bool AccessibilityManager::HandleActionReadPreviousEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionReadPreviousEvent(allowEndFeedback); -} - -bool AccessibilityManager::HandleActionUpEvent() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionUpEvent(); -} - -bool AccessibilityManager::HandleActionDownEvent() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionDownEvent(); -} - -bool AccessibilityManager::HandleActionClearFocusEvent() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionClearFocusEvent(); -} - -bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp) -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp); -} - -bool AccessibilityManager::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionTouchEvent(point, timeStamp); -} - -bool AccessibilityManager::HandleActionBackEvent() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionBackEvent(); -} - -void AccessibilityManager::HandleActionEnableEvent() -{ - Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionEnableEvent(); -} - -void AccessibilityManager::HandleActionDisableEvent() -{ - Internal::Adaptor::AccessibilityManager::GetImplementation(*this).HandleActionDisableEvent(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::StatusChangedSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).StatusChangedSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionNextSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionNextSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPreviousSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionPreviousSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionActivateSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionActivateSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionOverSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionOverSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionReadSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadNextSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionReadNextSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPreviousSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionReadPreviousSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionUpSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionUpSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionDownSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionDownSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionClearFocusSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionClearFocusSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionBackSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionBackSignal(); -} - -AccessibilityManager::AccessibilityActionScrollSignalType& AccessibilityManager::ActionScrollSignal() -{ - return Internal::Adaptor::AccessibilityManager::GetImplementation(*this).ActionScrollSignal(); -} - -AccessibilityManager::AccessibilityManager( Internal::Adaptor::AccessibilityManager& manager ) -: BaseHandle( &manager ) -{ -} - -AccessibilityManager::AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager ) -: BaseHandle( manager ) -{ -} - -} // namespace Dali diff --git a/adaptors/devel-api/file.list b/adaptors/devel-api/file.list index adba206..a34e507 100644 --- a/adaptors/devel-api/file.list +++ b/adaptors/devel-api/file.list @@ -1,5 +1,5 @@ devel_api_src_files = \ - $(adaptor_devel_api_dir)/adaptor-framework/accessibility-manager.cpp \ + $(adaptor_devel_api_dir)/adaptor-framework/accessibility-adaptor.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/bitmap-loader.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/bitmap-saver.cpp \ $(adaptor_devel_api_dir)/adaptor-framework/clipboard.cpp \ @@ -21,9 +21,9 @@ devel_api_src_files = \ devel_api_adaptor_framework_header_files = \ + $(adaptor_devel_api_dir)/adaptor-framework/accessibility-adaptor.h \ $(adaptor_devel_api_dir)/adaptor-framework/accessibility-action-handler.h \ $(adaptor_devel_api_dir)/adaptor-framework/accessibility-gesture-handler.h \ - $(adaptor_devel_api_dir)/adaptor-framework/accessibility-manager.h \ $(adaptor_devel_api_dir)/adaptor-framework/bitmap-loader.h \ $(adaptor_devel_api_dir)/adaptor-framework/bitmap-saver.h \ $(adaptor_devel_api_dir)/adaptor-framework/clipboard-event-notifier.h \ diff --git a/adaptors/public-api/adaptor-framework/tts-player.cpp b/adaptors/public-api/adaptor-framework/tts-player.cpp index 6e20aa3..0ac4a4b 100644 --- a/adaptors/public-api/adaptor-framework/tts-player.cpp +++ b/adaptors/public-api/adaptor-framework/tts-player.cpp @@ -81,6 +81,11 @@ TtsPlayer::State TtsPlayer::GetState() return GetImplementation(*this).GetState(); } +TtsPlayer::StateChangedSignalType& TtsPlayer::StateChangedSignal() +{ + return GetImplementation(*this).StateChangedSignal(); +} + TtsPlayer::TtsPlayer( Internal::Adaptor::TtsPlayer* player ) : BaseHandle( player ) { diff --git a/adaptors/public-api/adaptor-framework/tts-player.h b/adaptors/public-api/adaptor-framework/tts-player.h index deaf1b3..587b841 100644 --- a/adaptors/public-api/adaptor-framework/tts-player.h +++ b/adaptors/public-api/adaptor-framework/tts-player.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include namespace Dali { @@ -61,6 +62,13 @@ public: // ENUMs PAUSED ///< Player is paused }; +public: // Typedefs + + /** + * @brief Type of signal emitted when the TTS state changes. + */ + typedef Signal< void ( const Dali::TtsPlayer::State, const Dali::TtsPlayer::State ) > StateChangedSignalType; + public: // API /** @@ -132,6 +140,13 @@ public: // API */ State GetState(); + /** + * @brief Allows connection TTS state change signal. + * Note: Only supported by some adaptor types. + * @return A reference to the signal for connection. + */ + Dali::TtsPlayer::StateChangedSignalType& StateChangedSignal(); + public: // Not intended for application developers /** diff --git a/adaptors/tizen/accessibility-manager-impl-tizen.cpp b/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp similarity index 54% rename from adaptors/tizen/accessibility-manager-impl-tizen.cpp rename to adaptors/tizen/accessibility-adaptor-impl-tizen.cpp index 80b6101..c9c0b00 100644 --- a/adaptors/tizen/accessibility-manager-impl-tizen.cpp +++ b/adaptors/tizen/accessibility-adaptor-impl-tizen.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "accessibility-manager-impl.h" +#include "accessibility-adaptor-impl.h" // EXTERNAL INCLUDES #include @@ -42,79 +42,96 @@ namespace Adaptor namespace { + +// TODO: Update vconf-key.h ? +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; +} + #if defined(DEBUG_ENABLED) -Debug::Filter* gAccessibilityManagerLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_MANAGER"); +Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR" ); #endif void AccessibilityOnOffNotification(keynode_t* node, void* data) { - AccessibilityManager* manager = static_cast(data); - int isEnabled = 0; - vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled); + AccessibilityAdaptor* adaptor = static_cast( data ); + + bool isEnabled = GetEnabledVConf(); - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED"); + DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" ); - if(isEnabled == 1) + if( isEnabled ) { - manager->EnableAccessibility(); + adaptor->EnableAccessibility(); } else { - manager->DisableAccessibility(); + adaptor->DisableAccessibility(); } } BaseHandle Create() { - BaseHandle handle( AccessibilityManager::Get() ); + BaseHandle handle( AccessibilityAdaptor::Get() ); if ( !handle ) { Dali::SingletonService service( SingletonService::Get() ); if ( service ) { - Dali::AccessibilityManager manager = Dali::AccessibilityManager( new AccessibilityManager() ); - service.Register( typeid( manager ), manager ); - handle = manager; + Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() ); + service.Register( typeid( adaptor ), adaptor ); + handle = adaptor; } } return handle; } -TypeRegistration ACCESSIBILITY_MANAGER_TYPE( typeid(Dali::AccessibilityManager), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ ); +TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ ); } // unnamed namespace -Dali::AccessibilityManager AccessibilityManager::Get() +Dali::AccessibilityAdaptor AccessibilityAdaptor::Get() { - Dali::AccessibilityManager manager; + Dali::AccessibilityAdaptor adaptor; Dali::SingletonService service( SingletonService::Get() ); if ( service ) { // Check whether the singleton is already created - Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityManager ) ); + Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityAdaptor ) ); if(handle) { // If so, downcast the handle - manager = Dali::AccessibilityManager( dynamic_cast< AccessibilityManager* >( handle.GetObjectPtr() ) ); + adaptor = Dali::AccessibilityAdaptor( dynamic_cast< AccessibilityAdaptor* >( handle.GetObjectPtr() ) ); } } - return manager; + return adaptor; } -Vector2 AccessibilityManager::GetReadPosition() const +Vector2 AccessibilityAdaptor::GetReadPosition() const { return mReadPosition; } -void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler) +void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler) { mActionHandler = &handler; } -void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler) +void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler) { if( mAccessibilityGestureDetector ) { @@ -122,53 +139,31 @@ void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handle } } -bool AccessibilityManager::HandleActionClearFocusEvent() +bool AccessibilityAdaptor::HandleActionClearFocusEvent() { bool ret = false; - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionClearFocus signal in first, ClearAccessibilityFocus for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionClearFocusSignal.Empty() ) - { - mActionClearFocusSignal.Emit( handle ); - } - } - if( mActionHandler ) { ret = mActionHandler->ClearAccessibilityFocus(); } - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); + DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); return ret; } -bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp) +bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp) { bool ret = false; - Dali::AccessibilityManager handle( this ); - - Dali::TouchEvent event(timeStamp); - event.points.push_back(point); - - /* - * In order to application decide touch action first, - * emit ActionScroll signal in first, AccessibilityActionScroll for handler in next - */ - if ( !mIndicatorFocused ) + // 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 ) { - if( !mActionScrollSignal.Empty() ) - { - mActionScrollSignal.Emit( handle, event ); - } + Dali::TouchEvent event(timeStamp); + event.points.push_back(point); + ret = mActionHandler->AccessibilityActionScroll( event ); } Integration::TouchEvent touchEvent; @@ -187,7 +182,7 @@ bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsi return ret; } -bool AccessibilityManager::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) +bool AccessibilityAdaptor::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp) { bool ret = false; @@ -201,45 +196,31 @@ bool AccessibilityManager::HandleActionTouchEvent(const TouchPoint& point, unsig return ret; } -bool AccessibilityManager::HandleActionBackEvent() +bool AccessibilityAdaptor::HandleActionBackEvent() { bool ret = false; - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionBack signal in first, AccessibilityActionBack for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionBackSignal.Empty() ) - { - mActionBackSignal.Emit( handle ); - } - } - if( mActionHandler ) { ret = mActionHandler->AccessibilityActionBack(); } - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); + DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); return ret; } -void AccessibilityManager::HandleActionEnableEvent() +void AccessibilityAdaptor::HandleActionEnableEvent() { EnableAccessibility(); } -void AccessibilityManager::HandleActionDisableEvent() +void AccessibilityAdaptor::HandleActionDisableEvent() { DisableAccessibility(); } -void AccessibilityManager::EnableAccessibility() +void AccessibilityAdaptor::EnableAccessibility() { if(mIsEnabled == false) { @@ -249,14 +230,10 @@ void AccessibilityManager::EnableAccessibility() { mActionHandler->ChangeAccessibilityStatus(); } - - //emit status changed signal - Dali::AccessibilityManager handle( this ); - mStatusChangedSignal.Emit( handle ); } } -void AccessibilityManager::DisableAccessibility() +void AccessibilityAdaptor::DisableAccessibility() { if(mIsEnabled == true) { @@ -267,10 +244,6 @@ void AccessibilityManager::DisableAccessibility() mActionHandler->ChangeAccessibilityStatus(); } - //emit status changed signal - Dali::AccessibilityManager handle( this ); - mStatusChangedSignal.Emit( handle ); - // Destroy the TtsPlayer if exists. if ( Adaptor::IsAvailable() ) { @@ -281,43 +254,35 @@ void AccessibilityManager::DisableAccessibility() } } -bool AccessibilityManager::IsEnabled() const +bool AccessibilityAdaptor::IsEnabled() const { return mIsEnabled; } -void AccessibilityManager::SetIndicator(Indicator* indicator) +void AccessibilityAdaptor::SetIndicator(Indicator* indicator) { mIndicator = indicator; } -AccessibilityManager::AccessibilityManager() +AccessibilityAdaptor::AccessibilityAdaptor() : mIsEnabled(false), mActionHandler(NULL), mIndicator(NULL), mIndicatorFocused(false) { - int isEnabled = 0; - vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled); - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED"); - - if(isEnabled == 1) - { - mIsEnabled = true; - } - else - { - mIsEnabled = 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(); } -AccessibilityManager::~AccessibilityManager() +AccessibilityAdaptor::~AccessibilityAdaptor() { vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification ); + vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification ); } } // namespace Adaptor diff --git a/adaptors/tizen/file.list b/adaptors/tizen/file.list index 0525f6d..09a6206 100644 --- a/adaptors/tizen/file.list +++ b/adaptors/tizen/file.list @@ -1,7 +1,7 @@ # tizen adaptor_tizen_internal_src_files = \ - $(adaptor_tizen_dir)/accessibility-manager-impl-tizen.cpp \ + $(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 \ diff --git a/adaptors/tizen/tts-player-impl-tizen.cpp b/adaptors/tizen/tts-player-impl-tizen.cpp index e2d7de3..976602e 100644 --- a/adaptors/tizen/tts-player-impl-tizen.cpp +++ b/adaptors/tizen/tts-player-impl-tizen.cpp @@ -42,7 +42,38 @@ Dali::BaseHandle Create() return Dali::TtsPlayer::Get() ; } -Dali::TypeRegistration mType( typeid(Dali::TtsPlayer), typeid(Dali::BaseHandle), Create ) ; +Dali::TypeRegistration mType( typeid(Dali::TtsPlayer), typeid(Dali::BaseHandle), Create ); + +/** + * Helper function to convert Tizen-specific TTS state to external state. + * @param state The Tizen TTS state. + * @return The external TTS state. + */ +Dali::TtsPlayer::State InternalToExternalState( tts_state_e state ) +{ + switch( state ) + { + case TTS_STATE_CREATED: + { + return Dali::TtsPlayer::UNAVAILABLE; + } + case TTS_STATE_READY: + { + return Dali::TtsPlayer::READY; + } + case TTS_STATE_PLAYING: + { + return Dali::TtsPlayer::PLAYING; + } + case TTS_STATE_PAUSED: + { + return Dali::TtsPlayer::PAUSED; + } + } + + return Dali::TtsPlayer::UNAVAILABLE; +} + } // unnamed namespace #if defined(DEBUG_ENABLED) @@ -248,16 +279,35 @@ Dali::TtsPlayer::State TtsPlayer::GetState() } else { - ttsState = static_cast(state); + ttsState = InternalToExternalState( state ); } } return ttsState; } +Dali::TtsPlayer::StateChangedSignalType& TtsPlayer::StateChangedSignal() +{ + return mStateChangedSignal; +} + +void TtsPlayer::EmitStateChangedSignal( tts_state_e previous, tts_state_e current ) +{ + // Convert the previous and current states to external states and emit them as a signal. + if( !mStateChangedSignal.Empty() ) + { + mStateChangedSignal.Emit( InternalToExternalState( previous ), InternalToExternalState( current ) ); + } +} + void TtsPlayer::StateChangedCallback(tts_h tts, tts_state_e previous, tts_state_e current, void *userData) { + // Get the implementation (this is a static function). TtsPlayer* obj = static_cast(userData); + + // Emit the signal. + obj->EmitStateChangedSignal( previous, current ); + if(!obj->mInitialized && current == TTS_STATE_READY) { obj->mInitialized = true; diff --git a/adaptors/tizen/tts-player-impl.h b/adaptors/tizen/tts-player-impl.h index f1b261e..15462dd 100644 --- a/adaptors/tizen/tts-player-impl.h +++ b/adaptors/tizen/tts-player-impl.h @@ -78,6 +78,11 @@ public: */ Dali::TtsPlayer::State GetState(); + /** + * @copydoc TtsPlayer::StateChangedSignal() + */ + Dali::TtsPlayer::StateChangedSignalType& StateChangedSignal(); + private: /** @@ -103,6 +108,13 @@ private: void LogErrorCode(tts_error_e reason); /** + * Used to emit the state changed signal from outside the object (EG. A static function). + * @param[in] previous The previous state + * @param[in] current The current state + */ + void EmitStateChangedSignal( tts_state_e previous, tts_state_e current ); + + /** * Called when the state of TTS is changed. * * @param[in] tts The handle for TTS @@ -120,6 +132,7 @@ private: private: + Dali::TtsPlayer::StateChangedSignalType mStateChangedSignal; ///< Signal emitted when the TTS state changes bool mInitialized; ///< Whether the TTS player is initialised successfully or not std::string mUnplayedString; ///< The text that can not be played because tts engine is not yet initialized tts_h mTtsHandle; ///< The handle of TTS diff --git a/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp b/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp new file mode 100644 index 0000000..a5a29ab --- /dev/null +++ b/adaptors/ubuntu/accessibility-adaptor-impl-ubuntu.cpp @@ -0,0 +1,613 @@ +/* + * Copyright (c) 2014 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. + * + */ + +// CLASS HEADER +#include "accessibility-adaptor-impl.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include "system-settings.h" + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace +{ +#if defined(DEBUG_ENABLED) +Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR"); +#endif + +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() +{ + 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; +} + +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(Indicator* indicator) +{ + mIndicator = indicator; +} + +AccessibilityAdaptor::AccessibilityAdaptor() +: mIsEnabled(false), + mActionHandler(NULL), + mIndicator(NULL), + mIndicatorFocused(false) +{ + int isEnabled = 0; + DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED"); + + if(isEnabled == 1) + { + mIsEnabled = true; + } + else + { + mIsEnabled = false; + } + + 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; +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali diff --git a/adaptors/ubuntu/accessibility-adaptor-impl.h b/adaptors/ubuntu/accessibility-adaptor-impl.h new file mode 100644 index 0000000..82f2e70 --- /dev/null +++ b/adaptors/ubuntu/accessibility-adaptor-impl.h @@ -0,0 +1,301 @@ +#ifndef __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H__ +#define __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_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. + * + */ + +// EXTERNAL INCLUDES +#include + +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * This class detects to accessibility action + */ +class AccessibilityAdaptor : public Dali::BaseObject +{ +public: + + // Creation + + /** + * Constructor. + */ + AccessibilityAdaptor(); + + /** + * Get an instance of the AccessibilityAdaptor. + * @return The instance of the AccessibilityAdaptor. + */ + static Dali::AccessibilityAdaptor Get(); + + // Public API + + /** + * Turn on accessibility action + * This method should be called by vconf callback + */ + void EnableAccessibility(); + + /** + * Turn off accessibility action + * This method should be called by vconf callback + */ + void DisableAccessibility(); + + /** + * @copydoc Dali::AccessibilityAdaptor::IsEnabled() + */ + bool IsEnabled() const; + + /** + * @copydoc Dali::AccessibilityAdaptor::GetReadPosition() const + */ + Vector2 GetReadPosition() const; + + /** + * @copydoc Dali::AccessibilityAdaptor::SetActionHandler() + */ + void SetActionHandler(AccessibilityActionHandler& handler); + + /** + * @copydoc Dali::AccessibilityAdaptor::SetGestureHandler() + */ + void SetGestureHandler(AccessibilityGestureHandler& handler); + + /** + * Set the Indicator + */ + void SetIndicator(Indicator* indicator); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent() + */ + bool HandleActionNextEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPreviousEvent() + */ + bool HandleActionPreviousEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionActivateEvent() + */ + bool HandleActionActivateEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadEvent() + */ + bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadNextEvent() + */ + bool HandleActionReadNextEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPreviousEvent() + */ + bool HandleActionReadPreviousEvent(bool allowEndFeedback = true); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionUpEvent() + */ + bool HandleActionUpEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionDownEvent() + */ + bool HandleActionDownEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionClearFocusEvent() + */ + bool HandleActionClearFocusEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionScrollEvent() + */ + bool HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionTouchEvent() + */ + bool HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionBackEvent() + */ + bool HandleActionBackEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionEnableEvent() + */ + void HandleActionEnableEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionDisableEvent() + */ + void HandleActionDisableEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionScrollUpEvent() + */ + bool HandleActionScrollUpEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionScrollDownEvent() + */ + bool HandleActionScrollDownEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageLeftEvent() + */ + bool HandleActionPageLeftEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageRightEvent() + */ + bool HandleActionPageRightEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageUpEvent() + */ + bool HandleActionPageUpEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionPageDownEvent() + */ + bool HandleActionPageDownEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionMoveToFirstEvent() + */ + bool HandleActionMoveToFirstEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionMoveToLastEvent() + */ + bool HandleActionMoveToLastEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadFromTopEvent() + */ + bool HandleActionReadFromTopEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadFromNextEvent() + */ + bool HandleActionReadFromNextEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionZoomEvent() + */ + bool HandleActionZoomEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent() + */ + bool HandleActionReadIndicatorInformationEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPauseResumeEvent() + */ + bool HandleActionReadPauseResumeEvent(); + + /** + * @copydoc Dali::AccessibilityAdaptor::HandleActionStartStopEvent() + */ + bool HandleActionStartStopEvent(); + +private: + + // Destruction + + /** + * Destructor. + */ + virtual ~AccessibilityAdaptor(); + + // Undefined + AccessibilityAdaptor( const AccessibilityAdaptor& ); + AccessibilityAdaptor& operator=( AccessibilityAdaptor& ); + +private: + + 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 + + AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector + + Indicator* mIndicator; ///< The indicator + bool mIndicatorFocused; ///< Whether the Indicator is focused + +public: + + // Helpers for public-api forwarding methods + + inline static Internal::Adaptor::AccessibilityAdaptor& GetImplementation(Dali::AccessibilityAdaptor& adaptor) + { + DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptor handle is empty" ); + + BaseObject& handle = adaptor.GetBaseObject(); + + return static_cast(handle); + } + + inline static const Internal::Adaptor::AccessibilityAdaptor& GetImplementation(const Dali::AccessibilityAdaptor& adaptor) + { + DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptor handle is empty" ); + + const BaseObject& handle = adaptor.GetBaseObject(); + + return static_cast(handle); + } + +}; + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali + +#endif // __DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H__ diff --git a/adaptors/ubuntu/accessibility-manager-impl-ubuntu.cpp b/adaptors/ubuntu/accessibility-manager-impl-ubuntu.cpp deleted file mode 100644 index f510dc1..0000000 --- a/adaptors/ubuntu/accessibility-manager-impl-ubuntu.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/* - * Copyright (c) 2014 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. - * - */ - -// CLASS HEADER -#include "accessibility-manager-impl.h" - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include "system-settings.h" - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -namespace -{ -#if defined(DEBUG_ENABLED) -Debug::Filter* gAccessibilityManagerLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_MANAGER"); -#endif - -BaseHandle Create() -{ - BaseHandle handle( AccessibilityManager::Get() ); - - if ( !handle ) - { - Dali::SingletonService service( SingletonService::Get() ); - if ( service ) - { - Dali::AccessibilityManager manager = Dali::AccessibilityManager( new AccessibilityManager() ); - service.Register( typeid( manager ), manager ); - handle = manager; - } - } - - return handle; -} -TypeRegistration ACCESSIBILITY_MANAGER_TYPE( typeid(Dali::AccessibilityManager), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ ); - -} // unnamed namespace - -Dali::AccessibilityManager AccessibilityManager::Get() -{ - Dali::AccessibilityManager manager; - - Dali::SingletonService service( SingletonService::Get() ); - if ( service ) - { - // Check whether the singleton is already created - Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::AccessibilityManager ) ); - if(handle) - { - // If so, downcast the handle - manager = Dali::AccessibilityManager( dynamic_cast< AccessibilityManager* >( handle.GetObjectPtr() ) ); - } - } - - return manager; -} - -Vector2 AccessibilityManager::GetReadPosition() const -{ - return mReadPosition; -} - -void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler) -{ - mActionHandler = &handler; -} - -void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler) -{ - if( mAccessibilityGestureDetector ) - { - mAccessibilityGestureDetector->SetGestureHandler(handler); - } -} - -bool AccessibilityManager::HandleActionClearFocusEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionClearFocus signal in first, ClearAccessibilityFocus for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionClearFocusSignal.Empty() ) - { - mActionClearFocusSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->ClearAccessibilityFocus(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - Dali::TouchEvent event(timeStamp); - event.points.push_back(point); - - /* - * In order to application decide touch action first, - * emit ActionScroll signal in first, AccessibilityActionScroll for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionScrollSignal.Empty() ) - { - mActionScrollSignal.Emit( handle, 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 AccessibilityManager::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 AccessibilityManager::HandleActionBackEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionBack signal in first, AccessibilityActionBack for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionBackSignal.Empty() ) - { - mActionBackSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionBack(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -void AccessibilityManager::HandleActionEnableEvent() -{ - EnableAccessibility(); -} - -void AccessibilityManager::HandleActionDisableEvent() -{ - DisableAccessibility(); -} - -void AccessibilityManager::EnableAccessibility() -{ - if(mIsEnabled == false) - { - mIsEnabled = true; - - if( mActionHandler ) - { - mActionHandler->ChangeAccessibilityStatus(); - } - - //emit status changed signal - Dali::AccessibilityManager handle( this ); - mStatusChangedSignal.Emit( handle ); - } -} - -void AccessibilityManager::DisableAccessibility() -{ - if(mIsEnabled == true) - { - mIsEnabled = false; - - if( mActionHandler ) - { - mActionHandler->ChangeAccessibilityStatus(); - } - - //emit status changed signal - Dali::AccessibilityManager handle( this ); - mStatusChangedSignal.Emit( handle ); - - // Destroy the TtsPlayer if exists. - if ( Adaptor::IsAvailable() ) - { - Dali::Adaptor& adaptor = Dali::Adaptor::Get(); - Adaptor::GetImplementation( adaptor ).DestroyTtsPlayer( Dali::TtsPlayer::SCREEN_READER ); - } - } -} - -bool AccessibilityManager::IsEnabled() const -{ - return mIsEnabled; -} - -void AccessibilityManager::SetIndicator(Indicator* indicator) -{ - mIndicator = indicator; -} - -AccessibilityManager::AccessibilityManager() -: mIsEnabled(false), - mActionHandler(NULL), - mIndicator(NULL), - mIndicatorFocused(false) -{ - int isEnabled = 0; - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED"); - - if(isEnabled == 1) - { - mIsEnabled = true; - } - else - { - mIsEnabled = false; - } - - mAccessibilityGestureDetector = new AccessibilityGestureDetector(); -} - -AccessibilityManager::~AccessibilityManager() -{ -} - -bool AccessibilityManager::HandleActionNextEvent(bool allowEndFeedback) -{ - bool ret = false; - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionNext signal in first, AccessibilityActionNext for handler in next - */ - if( !mIndicatorFocused ) - { - if( !mActionNextSignal.Empty() ) - { - mActionNextSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionPrevious signal in first, AccessibilityActionPrevious for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionPreviousSignal.Empty() ) - { - mActionPreviousSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionActivateEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionActivate signal in first, AccessibilityActionActivate for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionActivateSignal.Empty() ) - { - mActionActivateSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionActivate(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) -{ - bool ret = false; - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %d , %d\n", __FUNCTION__, __LINE__, x, y); - - mReadPosition.x = x; - mReadPosition.y = y; - - Dali::AccessibilityManager 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(gAccessibilityManagerLogFilter, 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(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__); - } - } - - if(allowReadAgain) - { - /* - * In order to application decide reading action first, - * emit ActionRead signal in first, AccessibilityActionRead for handler in next - */ - if( !mIndicatorFocused ) - { - if ( !mActionReadSignal.Empty() ) - { - mActionReadSignal.Emit( handle ); - } - } - } - else - { - /* - * In order to application decide reading action first, - * emit ActionRead signal in first, AccessibilityActionRead for handler in next - */ - if( !mIndicatorFocused ) - { - if ( !mActionOverSignal.Empty() ) - { - mActionOverSignal.Emit( handle ); - } - } - } - - 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(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - } - - return ret; -} - -bool AccessibilityManager::HandleActionReadNextEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionReadNext signal in first, AccessibilityActionReadNext for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionReadNextSignal.Empty() ) - { - mActionReadNextSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionReadPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionReadPrevious signal in first, AccessibilityActionReadPrevious for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionReadPreviousSignal.Empty() ) - { - mActionReadPreviousSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionUpEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionUp signal in first, AccessibilityActionUp for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionUpSignal.Empty() ) - { - mActionUpSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionUp(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionDownEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionDown signal in first, AccessibilityActionDown for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionDownSignal.Empty() ) - { - mActionDownSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionDown(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali diff --git a/adaptors/ubuntu/accessibility-manager-impl.h b/adaptors/ubuntu/accessibility-manager-impl.h deleted file mode 100644 index 3c6ebf8..0000000 --- a/adaptors/ubuntu/accessibility-manager-impl.h +++ /dev/null @@ -1,354 +0,0 @@ -#ifndef __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__ -#define __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__ - -/* - * Copyright (c) 2014 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. - * - */ - -// EXTERNAL INCLUDES -#include - -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * This class detects to accessibility action - */ -class AccessibilityManager : public Dali::BaseObject -{ -public: - - typedef Dali::AccessibilityManager::AccessibilityActionSignalType AccessibilityActionSignalType; - typedef Dali::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType; - - // Creation - - /** - * Constructor. - */ - AccessibilityManager(); - - /** - * Get an instance of the AccessibilityManager. - * @return The instance of the AccessibilityManager. - */ - static Dali::AccessibilityManager Get(); - - // Public API - - /** - * Turn on accessibility action - * This method should be called by vconf callback - */ - void EnableAccessibility(); - - /** - * Turn off accessibility action - * This method should be called by vconf callback - */ - void DisableAccessibility(); - - /** - * @copydoc Dali::AccessibilityManager::IsEnabled() - */ - bool IsEnabled() const; - - /** - * @copydoc Dali::AccessibilityManager::GetReadPosition() const - */ - Vector2 GetReadPosition() const; - - /** - * @copydoc Dali::AccessibilityManager::SetActionHandler() - */ - void SetActionHandler(AccessibilityActionHandler& handler); - - /** - * @copydoc Dali::AccessibilityManager::SetGestureHandler() - */ - void SetGestureHandler(AccessibilityGestureHandler& handler); - - /** - * Set the Indicator - */ - void SetIndicator(Indicator* indicator); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionNextEvent() - */ - bool HandleActionNextEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionPreviousEvent() - */ - bool HandleActionPreviousEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionActivateEvent() - */ - bool HandleActionActivateEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionReadEvent() - */ - bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionReadNextEvent() - */ - bool HandleActionReadNextEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionReadPreviousEvent() - */ - bool HandleActionReadPreviousEvent(bool allowEndFeedback = true); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionUpEvent() - */ - bool HandleActionUpEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionDownEvent() - */ - bool HandleActionDownEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionClearFocusEvent() - */ - bool HandleActionClearFocusEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionScrollEvent() - */ - bool HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionTouchEvent() - */ - bool HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionBackEvent() - */ - bool HandleActionBackEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionEnableEvent() - */ - void HandleActionEnableEvent(); - - /** - * @copydoc Dali::AccessibilityManager::HandleActionDisableEvent() - */ - void HandleActionDisableEvent(); - -public: // Signals - - /** - * @copydoc Dali::AccessibilityManager::StatusChangedSignal - */ - AccessibilityActionSignalType& StatusChangedSignal() - { - return mStatusChangedSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionNextSignal - */ - AccessibilityActionSignalType& ActionNextSignal() - { - return mActionNextSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionPreviousSignal - */ - AccessibilityActionSignalType& ActionPreviousSignal() - { - return mActionPreviousSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionActivateSignal - */ - AccessibilityActionSignalType& ActionActivateSignal() - { - return mActionActivateSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionOverSignal - */ - AccessibilityActionSignalType& ActionOverSignal() - { - return mActionOverSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionReadSignal - */ - AccessibilityActionSignalType& ActionReadSignal() - { - return mActionReadSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionReadNextSignal - */ - AccessibilityActionSignalType& ActionReadNextSignal() - { - return mActionReadNextSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionReadPreviousSignal - */ - AccessibilityActionSignalType& ActionReadPreviousSignal() - { - return mActionReadPreviousSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionUpSignal - */ - AccessibilityActionSignalType& ActionUpSignal() - { - return mActionUpSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionDownSignal - */ - AccessibilityActionSignalType& ActionDownSignal() - { - return mActionDownSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionClearFocusSignal - */ - AccessibilityActionSignalType& ActionClearFocusSignal() - { - return mActionClearFocusSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionBackSignal - */ - AccessibilityActionSignalType& ActionBackSignal() - { - return mActionBackSignal; - } - - /** - * @copydoc Dali::AccessibilityManager::ActionScrollSignal - */ - AccessibilityActionScrollSignalType& ActionScrollSignal() - { - return mActionScrollSignal; - } - -private: - - // Destruction - - /** - * Destructor. - */ - virtual ~AccessibilityManager(); - - // Undefined - AccessibilityManager( const AccessibilityManager& ); - AccessibilityManager& operator=( AccessibilityManager& ); - -private: - - 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 - - AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector - - Indicator* mIndicator; ///< The indicator - bool mIndicatorFocused; ///< Whether the Indicator is focused - - AccessibilityActionSignalType mStatusChangedSignal; - AccessibilityActionSignalType mActionNextSignal; - AccessibilityActionSignalType mActionPreviousSignal; - AccessibilityActionSignalType mActionActivateSignal; - AccessibilityActionSignalType mActionOverSignal; - AccessibilityActionSignalType mActionReadSignal; - AccessibilityActionSignalType mActionReadNextSignal; - AccessibilityActionSignalType mActionReadPreviousSignal; - AccessibilityActionSignalType mActionUpSignal; - AccessibilityActionSignalType mActionDownSignal; - AccessibilityActionSignalType mActionClearFocusSignal; - AccessibilityActionSignalType mActionBackSignal; - AccessibilityActionScrollSignalType mActionScrollSignal; - -public: - - // Helpers for public-api forwarding methods - - inline static Internal::Adaptor::AccessibilityManager& GetImplementation(Dali::AccessibilityManager& manager) - { - DALI_ASSERT_ALWAYS( manager && "AccessibilityManager handle is empty" ); - - BaseObject& handle = manager.GetBaseObject(); - - return static_cast(handle); - } - - inline static const Internal::Adaptor::AccessibilityManager& GetImplementation(const Dali::AccessibilityManager& manager) - { - DALI_ASSERT_ALWAYS( manager && "AccessibilityManager handle is empty" ); - - const BaseObject& handle = manager.GetBaseObject(); - - return static_cast(handle); - } - -}; - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__ diff --git a/adaptors/ubuntu/file.list b/adaptors/ubuntu/file.list index 0ff86ba..9e8ccc1 100644 --- a/adaptors/ubuntu/file.list +++ b/adaptors/ubuntu/file.list @@ -1,7 +1,7 @@ # ubuntu adaptor_ubuntu_internal_src_files = \ - $(adaptor_ubuntu_dir)/accessibility-manager-impl-ubuntu.cpp \ + $(adaptor_ubuntu_dir)/accessibility-adaptor-impl-ubuntu.cpp \ $(adaptor_ubuntu_dir)/adaptor-impl-ubuntu.cpp \ $(adaptor_ubuntu_dir)/framework-ubuntu.cpp \ $(adaptor_ubuntu_dir)/vsync-monitor-ubuntu.cpp \ diff --git a/adaptors/ubuntu/tts-player-impl-ubuntu.cpp b/adaptors/ubuntu/tts-player-impl-ubuntu.cpp index 8e6b579..54c1cdf 100644 --- a/adaptors/ubuntu/tts-player-impl-ubuntu.cpp +++ b/adaptors/ubuntu/tts-player-impl-ubuntu.cpp @@ -83,6 +83,10 @@ Dali::TtsPlayer::State TtsPlayer::GetState() return Dali::TtsPlayer::UNAVAILABLE; } +Dali::TtsPlayer::StateChangedSignalType& TtsPlayer::StateChangedSignal() +{ + return mStateChangedSignal; +} } // namespace Adaptor diff --git a/adaptors/ubuntu/tts-player-impl.h b/adaptors/ubuntu/tts-player-impl.h index 0b33a08..22dcd41 100644 --- a/adaptors/ubuntu/tts-player-impl.h +++ b/adaptors/ubuntu/tts-player-impl.h @@ -78,6 +78,11 @@ public: */ Dali::TtsPlayer::State GetState(); + /** + * @copydoc TtsPlayer::StateChangedSignal() + */ + Dali::TtsPlayer::StateChangedSignalType& StateChangedSignal(); + private: /** @@ -93,6 +98,7 @@ private: private: + Dali::TtsPlayer::StateChangedSignalType mStateChangedSignal; ///< Signal emitted when the TTS state changes (non-functional, for interface compatibility). std::string mUnplayedString; ///< The text that can not be played because tts engine is not yet initialized int mUtteranceId; ///< The utterance ID diff --git a/adaptors/wayland/accessibility-adaptor-impl-wl.cpp b/adaptors/wayland/accessibility-adaptor-impl-wl.cpp new file mode 100644 index 0000000..d5a166f --- /dev/null +++ b/adaptors/wayland/accessibility-adaptor-impl-wl.cpp @@ -0,0 +1,410 @@ +/* + * 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. + * + */ + +// CLASS HEADER +#include "accessibility-adaptor-impl.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +#include +#include +#include + +// INTERNAL INCLUDES +#include "system-settings.h" + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +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; + + 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 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; + + Dali::AccessibilityAdaptor handle( this ); + + 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; + + Dali::AccessibilityAdaptor handle( this ); + + 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; +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali diff --git a/adaptors/wayland/accessibility-manager-impl-wl.cpp b/adaptors/wayland/accessibility-manager-impl-wl.cpp deleted file mode 100644 index 3891305..0000000 --- a/adaptors/wayland/accessibility-manager-impl-wl.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) 2014 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. - * - */ - -// CLASS HEADER -#include "accessibility-manager-impl.h" - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -#include -#include -#include - -// INTERNAL INCLUDES -#include "system-settings.h" - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -bool AccessibilityManager::HandleActionNextEvent(bool allowEndFeedback) -{ - bool ret = false; - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionNext signal in first, AccessibilityActionNext for handler in next - */ - if( !mIndicatorFocused ) - { - if( !mActionNextSignal.Empty() ) - { - mActionNextSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionPrevious signal in first, AccessibilityActionPrevious for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionPreviousSignal.Empty() ) - { - mActionPreviousSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionActivateEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionActivate signal in first, AccessibilityActionActivate for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionActivateSignal.Empty() ) - { - mActionActivateSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionActivate(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) -{ - bool ret = false; - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %d , %d\n", __FUNCTION__, __LINE__, x, y); - - mReadPosition.x = x; - mReadPosition.y = y; - - Dali::AccessibilityManager 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(gAccessibilityManagerLogFilter, 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(allowReadAgain) - { - /* - * In order to application decide reading action first, - * emit ActionRead signal in first, AccessibilityActionRead for handler in next - */ - if( !mIndicatorFocused ) - { - if ( !mActionReadSignal.Empty() ) - { - mActionReadSignal.Emit( handle ); - } - } - } - else - { - /* - * In order to application decide reading action first, - * emit ActionRead signal in first, AccessibilityActionRead for handler in next - */ - if( !mIndicatorFocused ) - { - if ( !mActionOverSignal.Empty() ) - { - mActionOverSignal.Emit( handle ); - } - } - } - - 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(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - } - - return ret; -} - -bool AccessibilityManager::HandleActionReadNextEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionReadNext signal in first, AccessibilityActionReadNext for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionReadNextSignal.Empty() ) - { - mActionReadNextSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionReadPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionReadPrevious signal in first, AccessibilityActionReadPrevious for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionReadPreviousSignal.Empty() ) - { - mActionReadPreviousSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionUpEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionUp signal in first, AccessibilityActionUp for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionUpSignal.Empty() ) - { - mActionUpSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionUp(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionDownEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionDown signal in first, AccessibilityActionDown for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionDownSignal.Empty() ) - { - mActionDownSignal.Emit( handle ); - } - } - - if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionDown(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali diff --git a/adaptors/wayland/event-handler-wl.cpp b/adaptors/wayland/event-handler-wl.cpp index 177cadc..baa9631 100644 --- a/adaptors/wayland/event-handler-wl.cpp +++ b/adaptors/wayland/event-handler-wl.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. @@ -662,7 +662,7 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven mDamageObserver( damageObserver ), mRotationObserver( NULL ), mDragAndDropDetector( dndDetector ), - mAccessibilityManager( AccessibilityManager::Get() ), + mAccessibilityAdaptor( AccessibilityAdaptor::Get() ), mClipboardEventNotifier( ClipboardEventNotifier::Get() ), mClipboard(Clipboard::Get()), mImpl( NULL ) diff --git a/adaptors/wayland/file.list b/adaptors/wayland/file.list index 9c415d3..5f7a8e2 100644 --- a/adaptors/wayland/file.list +++ b/adaptors/wayland/file.list @@ -1,7 +1,7 @@ # wayland adaptor_wayland_tizen_internal_src_files = \ - $(adaptor_wayland_dir)/accessibility-manager-impl-wl.cpp \ + $(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/accessibility-adaptor-impl-x.cpp b/adaptors/x11/accessibility-adaptor-impl-x.cpp new file mode 100644 index 0000000..c7f90f5 --- /dev/null +++ b/adaptors/x11/accessibility-adaptor-impl-x.cpp @@ -0,0 +1,539 @@ +/* + * 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. + * + */ + +// CLASS HEADER +#include "accessibility-adaptor-impl.h" + +// EXTERNAL INCLUDES +#include +#include +#include + +#include +#include + +// INTERNAL INCLUDES +#include "system-settings.h" + +#define MSG_DOMAIN_CONTROL_ACCESS (int)ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +namespace { +#if defined(DEBUG_ENABLED) +Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR"); +#endif +} // unnamed namespace + +bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback) +{ + bool ret = false; + + if( mIndicator && mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT; + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + } + else 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( mIndicator && mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV; + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + } + else 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( mIndicator && mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_ACTIVATE; + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + } + else 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; + + 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 ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT; + + // Indicator should be unhighlighted + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send unhighlight message to indicator!!!!\n", __FUNCTION__, __LINE__); + } + + mIndicatorFocused = indicatorFocused; + + // Send accessibility READ action information to Indicator + if( mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.x = mReadPosition.x; + actionInfo.y = mReadPosition.y; + + if(allowReadAgain) + { + actionInfo.action_type = ELM_ACCESS_ACTION_READ; + } + else + { + actionInfo.action_type = static_cast( GetElmAccessActionOver() ); + } + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + + 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( mIndicator && mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT; + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + } + else 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( mIndicator && mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV; + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + } + else 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( mIndicator && mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_UP; + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + } + else 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( mIndicator && mIndicatorFocused ) + { + Elm_Access_Action_Info actionInfo; + actionInfo.action_type = ELM_ACCESS_ACTION_DOWN; + + ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); + } + else 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( 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() +{ + 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 + +} // namespace Internal + +} // namespace Dali diff --git a/adaptors/x11/accessibility-manager-impl-x.cpp b/adaptors/x11/accessibility-manager-impl-x.cpp deleted file mode 100644 index f5741f8..0000000 --- a/adaptors/x11/accessibility-manager-impl-x.cpp +++ /dev/null @@ -1,412 +0,0 @@ -/* - * Copyright (c) 2014 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. - * - */ - -// CLASS HEADER -#include "accessibility-manager-impl.h" - -// EXTERNAL INCLUDES -#include -#include -#include - -#include -#include - -// INTERNAL INCLUDES -#include "system-settings.h" - -#define MSG_DOMAIN_CONTROL_ACCESS (int)ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -namespace { -#if defined(DEBUG_ENABLED) -Debug::Filter* gAccessibilityManagerLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_MANAGER"); -#endif -} // unnamed namespace - -bool AccessibilityManager::HandleActionNextEvent(bool allowEndFeedback) -{ - bool ret = false; - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionNext signal in first, AccessibilityActionNext for handler in next - */ - if( !mIndicatorFocused ) - { - if( !mActionNextSignal.Empty() ) - { - mActionNextSignal.Emit( handle ); - } - } - - if( mIndicator && mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT; - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionPrevious signal in first, AccessibilityActionPrevious for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionPreviousSignal.Empty() ) - { - mActionPreviousSignal.Emit( handle ); - } - } - - if( mIndicator && mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV; - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionActivateEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionActivate signal in first, AccessibilityActionActivate for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionActivateSignal.Empty() ) - { - mActionActivateSignal.Emit( handle ); - } - } - - if( mIndicator && mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_ACTIVATE; - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionActivate(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) -{ - bool ret = false; - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %d , %d\n", __FUNCTION__, __LINE__, x, y); - - mReadPosition.x = x; - mReadPosition.y = y; - - Dali::AccessibilityManager 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(gAccessibilityManagerLogFilter, 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 ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT; - - // Indicator should be unhighlighted - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] Send unhighlight message to indicator!!!!\n", __FUNCTION__, __LINE__); - } - - mIndicatorFocused = indicatorFocused; - - // Send accessibility READ action information to Indicator - if( mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.x = mReadPosition.x; - actionInfo.y = mReadPosition.y; - - if(allowReadAgain) - { - actionInfo.action_type = ELM_ACCESS_ACTION_READ; - } - else - { - actionInfo.action_type = static_cast( GetElmAccessActionOver() ); - } - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__); - } - } - - if(allowReadAgain) - { - /* - * In order to application decide reading action first, - * emit ActionRead signal in first, AccessibilityActionRead for handler in next - */ - if( !mIndicatorFocused ) - { - if ( !mActionReadSignal.Empty() ) - { - mActionReadSignal.Emit( handle ); - } - } - } - else - { - /* - * In order to application decide reading action first, - * emit ActionRead signal in first, AccessibilityActionRead for handler in next - */ - if( !mIndicatorFocused ) - { - if ( !mActionOverSignal.Empty() ) - { - mActionOverSignal.Emit( handle ); - } - } - } - - 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(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - } - - return ret; -} - -bool AccessibilityManager::HandleActionReadNextEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionReadNext signal in first, AccessibilityActionReadNext for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionReadNextSignal.Empty() ) - { - mActionReadNextSignal.Emit( handle ); - } - } - - if( mIndicator && mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT; - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionReadPreviousEvent(bool allowEndFeedback) -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionReadPrevious signal in first, AccessibilityActionReadPrevious for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionReadPreviousSignal.Empty() ) - { - mActionReadPreviousSignal.Emit( handle ); - } - } - - if( mIndicator && mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV; - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionUpEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionUp signal in first, AccessibilityActionUp for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionUpSignal.Empty() ) - { - mActionUpSignal.Emit( handle ); - } - } - - if( mIndicator && mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_UP; - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionUp(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -bool AccessibilityManager::HandleActionDownEvent() -{ - bool ret = false; - - Dali::AccessibilityManager handle( this ); - - /* - * In order to application decide reading action first, - * emit ActionDown signal in first, AccessibilityActionDown for handler in next - */ - if ( !mIndicatorFocused ) - { - if( !mActionDownSignal.Empty() ) - { - mActionDownSignal.Emit( handle ); - } - } - - if( mIndicator && mIndicatorFocused ) - { - Elm_Access_Action_Info actionInfo; - actionInfo.action_type = ELM_ACCESS_ACTION_DOWN; - - ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo)); - } - else if( mActionHandler ) - { - ret = mActionHandler->AccessibilityActionDown(); - } - - DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE"); - - return ret; -} - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali diff --git a/adaptors/x11/event-handler-x.cpp b/adaptors/x11/event-handler-x.cpp index 090cd0f..a2d3e3c 100644 --- a/adaptors/x11/event-handler-x.cpp +++ b/adaptors/x11/event-handler-x.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. @@ -36,6 +36,10 @@ #include #endif // DALI_PROFILE_UBUNTU +#ifdef DALI_ELDBUS_AVAILABLE +#include +#endif // DALI_ELDBUS_AVAILABLE + #include #include #include @@ -81,6 +85,16 @@ namespace const char * DETENT_DEVICE_NAME = "tizen_detent"; +// DBUS accessibility +#define A11Y_BUS "org.a11y.Bus" +#define A11Y_INTERFACE "org.a11y.Bus" +#define A11Y_PATH "/org/a11y/bus" +#define A11Y_GET_ADDRESS "GetAddress" +#define BUS "com.samsung.EModule" +#define INTERFACE "com.samsung.GestureNavigation" +#define PATH "/com/samsung/GestureNavigation" +#define SIGNAL "GestureDetected" + #ifndef DALI_PROFILE_UBUNTU const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced. #endif // DALI_PROFILE_UBUNTU @@ -109,6 +123,83 @@ const unsigned int DRAG_AND_DROP_TYPES_NUMBER = sizeof( DRAG_AND_DROP_TYPES ) / const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3; +#ifdef DALI_ELDBUS_AVAILABLE +// DBus gesture string matching lists. +// TODO: This needs moving to its own module. +const char * ElDBusAccessibilityFingerCountStrings[] = +{ + "OneFinger", + "TwoFingers", + "ThreeFingers" +}; +const unsigned int FingerCountStringsTotal = sizeof( ElDBusAccessibilityFingerCountStrings ) / sizeof( ElDBusAccessibilityFingerCountStrings[0] ); +enum GestureType +{ + GESTURE_TYPE_NONE, + GESTURE_TYPE_HOVER, + GESTURE_TYPE_SINGLE_TAP, + GESTURE_TYPE_DOUBLE_TAP, + GESTURE_TYPE_TRIPLE_TAP +}; +struct GestureTypeTable +{ + const char* name; + const GestureType type; +}; +GestureTypeTable ElDBusAccessibilityFullEventTypeStrings[] = +{ + { "Hover", GESTURE_TYPE_HOVER }, + { "SingleTap", GESTURE_TYPE_SINGLE_TAP }, + { "DoubleTap", GESTURE_TYPE_DOUBLE_TAP }, + { "TripleTap", GESTURE_TYPE_TRIPLE_TAP } +}; +const unsigned int FullEventTypeStringsTotal = sizeof( ElDBusAccessibilityFullEventTypeStrings ) / sizeof( ElDBusAccessibilityFullEventTypeStrings[0] ); +enum SubGestureType +{ + SUB_GESTURE_TYPE_NONE, + SUB_GESTURE_TYPE_FLICK +}; +struct SubGestureTypeTable +{ + const char* name; + const SubGestureType type; +}; +SubGestureTypeTable ElDBusAccessibilityDirectionalEventTypeStrings[] = +{ + { "Flick", SUB_GESTURE_TYPE_FLICK } +}; +const unsigned int DirectionalEventTypeStringsTotal = sizeof( ElDBusAccessibilityDirectionalEventTypeStrings ) / sizeof( ElDBusAccessibilityDirectionalEventTypeStrings[0] ); +enum GestureDirection +{ + GESTURE_DIRECTION_NONE, + GESTURE_DIRECTION_UP, + GESTURE_DIRECTION_DOWN, + GESTURE_DIRECTION_LEFT, + GESTURE_DIRECTION_RIGHT, + GESTURE_DIRECTION_UP_RETURN, + GESTURE_DIRECTION_DOWN_RETURN, + GESTURE_DIRECTION_LEFT_RETURN, + GESTURE_DIRECTION_RIGHT_RETURN +}; +struct GestureDirectionTable +{ + const char* name; + const GestureDirection direction; +}; +GestureDirectionTable ElDBusAccessibilityDirectionStrings[] = +{ + { "Up", GESTURE_DIRECTION_UP }, + { "Down", GESTURE_DIRECTION_DOWN }, + { "Left", GESTURE_DIRECTION_LEFT }, + { "Right", GESTURE_DIRECTION_RIGHT }, + { "UpReturn", GESTURE_DIRECTION_UP_RETURN }, + { "DownReturn", GESTURE_DIRECTION_DOWN_RETURN }, + { "LeftReturn", GESTURE_DIRECTION_LEFT_RETURN }, + { "RightReturn", GESTURE_DIRECTION_RIGHT_RETURN } +}; +const unsigned int DirectionStringsTotal = sizeof( ElDBusAccessibilityDirectionStrings ) / sizeof( ElDBusAccessibilityDirectionStrings[0] ); +#endif // DALI_ELDBUS_AVAILABLE + /** * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h. * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums. @@ -309,6 +400,25 @@ struct EventHandler::Impl vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, handler ); vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler ); #endif // DALI_PROFILE_UBUNTU + +#ifdef DALI_ELDBUS_AVAILABLE + + // Initialize ElDBus. + DALI_LOG_INFO( gImfLogging, Debug::General, "Starting DBus Initialization" ); + eldbus_init(); + + Eldbus_Connection *sessionConnection; + sessionConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SESSION ); + + Eldbus_Object *a11yObject = eldbus_object_get( sessionConnection, A11Y_BUS, A11Y_PATH ); + Eldbus_Proxy *elDBusManager = eldbus_proxy_get( a11yObject, A11Y_INTERFACE ); + + // Pass in handler in the cb_data field so we can access the accessibility adaptor within the callback. + eldbus_proxy_call( elDBusManager, A11Y_GET_ADDRESS, EcoreElDBusInitialisation, handler, -1, "" ); + + DALI_LOG_INFO( gImfLogging, Debug::General, "Finished DBus Initialization" ); + +#endif // DALI_ELDBUS_AVAILABLE } } @@ -326,6 +436,11 @@ struct EventHandler::Impl { ecore_event_handler_del( *iter ); } + +#ifdef DALI_ELDBUS_AVAILABLE + // Close down ElDBus + eldbus_shutdown(); +#endif // DALI_ELDBUS_AVAILABLE } // Static methods @@ -891,9 +1006,9 @@ struct EventHandler::Impl if (clientMessageEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL) { - if ( ( (unsigned int)clientMessageEvent->data.l[0] == handler->mImpl->mWindow ) && handler->mAccessibilityManager ) + if ( ( (unsigned int)clientMessageEvent->data.l[0] == handler->mImpl->mWindow ) && handler->mAccessibilityAdaptor ) { - AccessibilityManager* accessibilityManager( &AccessibilityManager::GetImplementation( handler->mAccessibilityManager ) ); + AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) ); if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_SCROLL) { @@ -926,11 +1041,11 @@ struct EventHandler::Impl (unsigned int)clientMessageEvent->data.l[2], (unsigned int)clientMessageEvent->data.l[3], (unsigned int)clientMessageEvent->data.l[4]); - // Send touch event to accessibility manager. + // Send touch event to accessibility adaptor. TouchPoint point( 0, state, (float)clientMessageEvent->data.l[3], (float)clientMessageEvent->data.l[4] ); // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control - accessibilityManager->HandleActionScrollEvent( point, GetCurrentMilliSeconds() ); + accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() ); } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_MOUSE) { @@ -963,51 +1078,51 @@ struct EventHandler::Impl (unsigned int)clientMessageEvent->data.l[2], (unsigned int)clientMessageEvent->data.l[3], (unsigned int)clientMessageEvent->data.l[4]); - // Send touch event to accessibility manager. + // Send touch event to accessibility adaptor. TouchPoint point( 0, state, (float)clientMessageEvent->data.l[3], (float)clientMessageEvent->data.l[4] ); // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control - accessibilityManager->HandleActionTouchEvent( point, GetCurrentMilliSeconds() ); + accessibilityAdaptor->HandleActionTouchEvent( point, GetCurrentMilliSeconds() ); } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_BACK) { // 2 finger circle draw, do back - accessibilityManager->HandleActionBackEvent(); + accessibilityAdaptor->HandleActionBackEvent(); } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT) { // one finger flick down // focus next object - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionNextEvent(); + accessibilityAdaptor->HandleActionNextEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV) { // one finger flick up // focus previous object - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionPreviousEvent(); + accessibilityAdaptor->HandleActionPreviousEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE) { // one finger double tap // same as one finger tap in normal mode (i.e. execute focused actor) - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionActivateEvent(); + accessibilityAdaptor->HandleActionActivateEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ) { // one finger tap // focus & read an actor at ( e->data.l[2], e->data.l[3] ) position according to finger - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionReadEvent((unsigned int)clientMessageEvent->data.l[2], (unsigned int)clientMessageEvent->data.l[3], true /* allow read again*/); + accessibilityAdaptor->HandleActionReadEvent((unsigned int)clientMessageEvent->data.l[2], (unsigned int)clientMessageEvent->data.l[3], true /* allow read again*/); } } #if defined(DALI_PROFILE_MOBILE) @@ -1018,9 +1133,9 @@ struct EventHandler::Impl // x : e->data.l[3] // y : e->data.l[4] // focus & read an actor at (x, y) position according to finger - if(accessibilityManager && (unsigned int)clientMessageEvent->data.l[2] == 1 /*only work for move event*/) + if(accessibilityAdaptor && (unsigned int)clientMessageEvent->data.l[2] == 1 /*only work for move event*/) { - accessibilityManager->HandleActionReadEvent((unsigned int)clientMessageEvent->data.l[3], (unsigned int)clientMessageEvent->data.l[4], false /* not allow read again*/); + accessibilityAdaptor->HandleActionReadEvent((unsigned int)clientMessageEvent->data.l[3], (unsigned int)clientMessageEvent->data.l[4], false /* not allow read again*/); } } #endif @@ -1028,50 +1143,50 @@ struct EventHandler::Impl { // one finger flick right // focus next object - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionReadNextEvent(); + accessibilityAdaptor->HandleActionReadNextEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV) { // one finger flick left // focus previous object - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionReadPreviousEvent(); + accessibilityAdaptor->HandleActionReadPreviousEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP) { // double down and move (right, up) // change slider value - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionUpEvent(); + accessibilityAdaptor->HandleActionUpEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN) { // double down and move (left, down) // change slider value - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionDownEvent(); + accessibilityAdaptor->HandleActionDownEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ENABLE) { - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionEnableEvent(); + accessibilityAdaptor->HandleActionEnableEvent(); } } else if((unsigned int)clientMessageEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DISABLE) { - if(accessibilityManager) + if(accessibilityAdaptor) { - accessibilityManager->HandleActionDisableEvent(); + accessibilityAdaptor->HandleActionDisableEvent(); } } // TODO: some more actions could be added later @@ -1108,6 +1223,317 @@ struct EventHandler::Impl return ECORE_CALLBACK_PASS_ON; } + + ///////////////////////////////////////////////////////////////////////////////////////////////// + // ElDBus Accessibility Callbacks + ///////////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef DALI_ELDBUS_AVAILABLE + // Callback for Ecore ElDBus accessibility events. + static void OnEcoreElDBusAccessibilityNotification( void *context EINA_UNUSED, const Eldbus_Message *message ) + { + EventHandler* handler( (EventHandler*)context ); + + if ( !handler->mAccessibilityAdaptor ) + { + DALI_LOG_ERROR( "Invalid accessibility adaptor\n" ); + return; + } + + AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) ); + if ( !accessibilityAdaptor ) + { + DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" ); + return; + } + + const char *gestureName; + int xS, yS, xE, yE; + unsigned int state; + + // The string defines the arg-list's respective types. + if( !eldbus_message_arguments_get( message, "siiiiu", &gestureName, &xS, &yS, &xE, &yE, &state ) ) + { + DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" ); + } + + DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %s Args: %d,%d,%d,%d State: %d\n", gestureName, xS, yS, xE, yE ); + + unsigned int fingers = 0; + char* stringPosition = ( char* )gestureName; + + // Check how many fingers the gesture uses. + for( unsigned int i = 0; i < FingerCountStringsTotal; ++i ) + { + unsigned int matchLength = strlen( ElDBusAccessibilityFingerCountStrings[ i ] ); + if( strncmp( gestureName, ElDBusAccessibilityFingerCountStrings[ i ], matchLength ) == 0 ) + { + fingers = i + 1; + stringPosition += matchLength; + break; + } + } + + if( fingers == 0 ) + { + // Error: invalid gesture. + return; + } + + GestureType gestureType = GESTURE_TYPE_NONE; + SubGestureType subGestureType = SUB_GESTURE_TYPE_NONE; + GestureDirection direction = GESTURE_DIRECTION_NONE; + + // Check for full gesture type names first. + for( unsigned int i = 0; i < FullEventTypeStringsTotal; ++i ) + { + unsigned int matchLength = strlen( ElDBusAccessibilityFullEventTypeStrings[ i ].name ); + if( strncmp( stringPosition, ElDBusAccessibilityFullEventTypeStrings[ i ].name, matchLength ) == 0 ) + { + gestureType = ElDBusAccessibilityFullEventTypeStrings[ i ].type; + break; + } + } + + // If we didn't find a full gesture, check for sub gesture type names. + if( gestureType == GESTURE_TYPE_NONE ) + { + // No full gesture name found, look for partial types. + for( unsigned int i = 0; i < DirectionalEventTypeStringsTotal; ++i ) + { + unsigned int matchLength = strlen( ElDBusAccessibilityDirectionalEventTypeStrings[ i ].name ); + if( strncmp( stringPosition, ElDBusAccessibilityDirectionalEventTypeStrings[ i ].name, matchLength ) == 0 ) + { + subGestureType = ElDBusAccessibilityDirectionalEventTypeStrings[ i ].type; + stringPosition += matchLength; + break; + } + } + + if( subGestureType == SUB_GESTURE_TYPE_NONE ) + { + // ERROR: Gesture not recognised. + return; + } + + // If the gesture was a sub type, get it's respective direction. + for( unsigned int i = 0; i < DirectionStringsTotal; ++i ) + { + unsigned int matchLength = strlen( ElDBusAccessibilityDirectionStrings[ i ].name ); + if( strncmp( stringPosition, ElDBusAccessibilityDirectionStrings[ i ].name, matchLength ) == 0 ) + { + direction = ElDBusAccessibilityDirectionStrings[ i ].direction; + stringPosition += matchLength; + break; + } + } + + if( direction == GESTURE_DIRECTION_NONE ) + { + // ERROR: Gesture not recognised. + return; + } + } + + // Action the detected gesture here. + if( gestureType != GESTURE_TYPE_NONE ) + { + DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Fingers: %d Gesture type: %d\n", fingers, gestureType ); + } + else + { + DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Fingers: %d Gesture sub type: %d Gesture direction: %d\n", + fingers, subGestureType, direction ); + } + + // Create a touch point object. + TouchPoint::State touchPointState( TouchPoint::Down ); + if ( state == 0 ) + { + touchPointState = TouchPoint::Down; // Mouse down. + } + else if ( state == 1 ) + { + touchPointState = TouchPoint::Motion; // Mouse move. + } + else if ( state == 2 ) + { + touchPointState = TouchPoint::Up; // Mouse up. + } + else + { + touchPointState = TouchPoint::Interrupted; // Error. + } + + // Send touch event to accessibility adaptor. + TouchPoint point( 0, touchPointState, (float)xS, (float)yS ); + + // Perform actions based on received gestures. + // Note: This is seperated from the reading so we can (in future) + // have other input readers without changing the below code. + switch( fingers ) + { + case 1: + { + if( gestureType == GESTURE_TYPE_SINGLE_TAP || ( gestureType == GESTURE_TYPE_HOVER && touchPointState == TouchPoint::Motion ) ) + { + // Focus, read out. + accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ ); + } + else if( gestureType == GESTURE_TYPE_DOUBLE_TAP ) + { + if( false ) // TODO: how to detect double tap + hold? + { + // Move or drag icon / view more options for selected items. + // accessibilityAdaptor->HandleActionTouchEvent( point, GetCurrentMilliSeconds() ); + } + else + { + // Activate selected item / active edit mode. + accessibilityAdaptor->HandleActionActivateEvent(); + } + } + else if( gestureType == GESTURE_TYPE_TRIPLE_TAP ) + { + // Zoom + accessibilityAdaptor->HandleActionZoomEvent(); + } + else if( subGestureType == SUB_GESTURE_TYPE_FLICK ) + { + if( direction == GESTURE_DIRECTION_LEFT ) + { + // Move to previous item. + accessibilityAdaptor->HandleActionReadPreviousEvent(); + } + else if( direction == GESTURE_DIRECTION_RIGHT ) + { + // Move to next item. + accessibilityAdaptor->HandleActionReadNextEvent(); + } + else if( direction == GESTURE_DIRECTION_UP ) + { + // Move to next item. + accessibilityAdaptor->HandleActionPreviousEvent(); + } + else if( direction == GESTURE_DIRECTION_DOWN ) + { + // Move to next item. + accessibilityAdaptor->HandleActionNextEvent(); + } + else if( direction == GESTURE_DIRECTION_LEFT_RETURN ) + { + // Scroll up to the previous page + accessibilityAdaptor->HandleActionPageUpEvent(); + } + else if( direction == GESTURE_DIRECTION_RIGHT_RETURN ) + { + // Scroll down to the next page + accessibilityAdaptor->HandleActionPageDownEvent(); + } + else if( direction == GESTURE_DIRECTION_UP_RETURN ) + { + // Move to the first item on screen + accessibilityAdaptor->HandleActionMoveToFirstEvent(); + } + else if( direction == GESTURE_DIRECTION_DOWN_RETURN ) + { + // Move to the last item on screen + accessibilityAdaptor->HandleActionMoveToLastEvent(); + } + } + break; + } + + case 2: + { + if( gestureType == GESTURE_TYPE_HOVER ) + { + // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control + accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() ); + } + else if( gestureType == GESTURE_TYPE_SINGLE_TAP ) + { + // Pause/Resume current speech + accessibilityAdaptor->HandleActionReadPauseResumeEvent(); + } + else if( gestureType == GESTURE_TYPE_DOUBLE_TAP ) + { + // Start/Stop current action + accessibilityAdaptor->HandleActionStartStopEvent(); + } + else if( gestureType == GESTURE_TYPE_TRIPLE_TAP ) + { + // Read information from indicator + accessibilityAdaptor->HandleActionReadIndicatorInformationEvent(); + } + else if( subGestureType == SUB_GESTURE_TYPE_FLICK ) + { + if( direction == GESTURE_DIRECTION_LEFT ) + { + // Scroll left to the previous page + accessibilityAdaptor->HandleActionPageLeftEvent(); + } + else if( direction == GESTURE_DIRECTION_RIGHT ) + { + // Scroll right to the next page + accessibilityAdaptor->HandleActionPageRightEvent(); + } + else if( direction == GESTURE_DIRECTION_UP ) + { + // Scroll up the list. + accessibilityAdaptor->HandleActionScrollUpEvent(); + } + else if( direction == GESTURE_DIRECTION_DOWN ) + { + // Scroll down the list. + accessibilityAdaptor->HandleActionScrollDownEvent(); + } + } + break; + } + + case 3: + { + if( gestureType == GESTURE_TYPE_SINGLE_TAP ) + { + // Read from top item on screen continuously. + accessibilityAdaptor->HandleActionReadFromTopEvent(); + } + else if( gestureType == GESTURE_TYPE_DOUBLE_TAP ) + { + // Read from next item continuously. + accessibilityAdaptor->HandleActionReadFromNextEvent(); + } + break; + } + } + } + + // Callback for to set up Ecore ElDBus for accessibility callbacks. + static void EcoreElDBusInitialisation( void *handle, const Eldbus_Message *message, Eldbus_Pending *pending EINA_UNUSED ) + { + Eldbus_Object *object; + Eldbus_Proxy *manager; + const char *a11yBusAddress = NULL; + + // The string defines the arg-list's respective types. + if( !eldbus_message_arguments_get( message, "s", &a11yBusAddress ) ) + { + DALI_LOG_ERROR( "EcoreElDBusInitialisation: Error getting arguments\n" ); + } + + DALI_LOG_INFO( gImfLogging, Debug::General, "Ecore ElDBus Accessibility address: %s\n", a11yBusAddress ); + + Eldbus_Connection *a11yConnection = eldbus_address_connection_get( a11yBusAddress ); + + object = eldbus_object_get( a11yConnection, BUS, PATH ); + manager = eldbus_proxy_get( object, INTERFACE ); + + // Pass the callback data through to the signal handler. + eldbus_proxy_signal_handler_add( manager, SIGNAL, OnEcoreElDBusAccessibilityNotification, handle ); + } +#endif // DALI_ELDBUS_AVAILABLE + /** * Called when the source window notifies us the content in clipboard is selected. */ @@ -1222,7 +1648,7 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven mDamageObserver( damageObserver ), mRotationObserver( NULL ), mDragAndDropDetector( dndDetector ), - mAccessibilityManager( AccessibilityManager::Get() ), + mAccessibilityAdaptor( AccessibilityAdaptor::Get() ), mClipboardEventNotifier( ClipboardEventNotifier::Get() ), mClipboard(Clipboard::Get()), mImpl( NULL ) diff --git a/adaptors/x11/file.list b/adaptors/x11/file.list index f9573c4..98ec298 100644 --- a/adaptors/x11/file.list +++ b/adaptors/x11/file.list @@ -21,14 +21,14 @@ adaptor_x11_ubuntu_internal_src_files = \ adaptor_x11_tizen_internal_src_files = \ $(_adaptor_x11_internal_src_files) \ - $(adaptor_x11_dir)/accessibility-manager-impl-x.cpp \ + $(adaptor_x11_dir)/accessibility-adaptor-impl-x.cpp \ $(adaptor_x11_dir)/framework-x.cpp \ $(adaptor_x11_dir)/key-impl-x.cpp \ $(adaptor_x11_dir)/window-extensions.cpp adaptor_x11_tv_internal_src_files = \ $(_adaptor_x11_internal_src_files) \ - $(adaptor_x11_dir)/accessibility-manager-impl-x.cpp \ + $(adaptor_x11_dir)/accessibility-adaptor-impl-x.cpp \ $(adaptor_x11_dir)/framework-x.cpp adaptor_x11_internal_default_profile_src_files = \ diff --git a/automated-tests/src/dali-adaptor/utc-Dali-TtsPlayer.cpp b/automated-tests/src/dali-adaptor/utc-Dali-TtsPlayer.cpp index 9269756..d286765 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-TtsPlayer.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-TtsPlayer.cpp @@ -162,6 +162,7 @@ int UtcDaliTtsPlayerGetStateN(void) try { Dali::TtsPlayer::State state = player.GetState(); + tet_printf( "Error: TtsPlayer state = %d, expected exception\n", (unsigned int)state ); DALI_TEST_CHECK( false ); // Should not reach here! } catch( ... ) diff --git a/build/tizen/adaptor/Makefile.am b/build/tizen/adaptor/Makefile.am index ed609c7..f61b4f8 100644 --- a/build/tizen/adaptor/Makefile.am +++ b/build/tizen/adaptor/Makefile.am @@ -276,7 +276,8 @@ libdali_adaptor_la_CXXFLAGS = \ $(LIBEXIF_CFLAGS) \ $(LIBCURL_CFLAGS) \ $(ASSIMP_CFLAGS) \ - $(CAPI_SYSTEM_SYSTEM_SETTINGS_CFLAGS) + $(CAPI_SYSTEM_SYSTEM_SETTINGS_CFLAGS) \ + $(ELDBUS_CFLAGS) libdali_adaptor_la_LIBADD = \ $(DALICORE_LIBS) \ @@ -299,6 +300,7 @@ libdali_adaptor_la_LIBADD = \ $(CAPI_APPFW_APPLICATION_LIBS) \ $(HARFBUZZ_LIBS) \ $(CAPI_SYSTEM_INFO_LIBS) \ + $(ELDBUS_LIBS) \ -lgif \ -lboost_thread diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index 4fe7ac7..0e94e91 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -55,7 +55,17 @@ PKG_CHECK_MODULES(TTRACE, ttrace, AC_DEFINE(ENABLE_TTRACE, 1, [ttrace available ) -# Check for availability of BulletPhysics +# Check for EldBus.h in ECore +PKG_CHECK_MODULES(ELDBUS, eldbus, [ eldbus_available=yes ], [ eldbus_available=no ] ) + +DALI_ELDBUS_AVAILABLE= +if test "x$eldbus_available" = "xyes"; then + DALI_ELDBUS_AVAILABLE=true + DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDALI_ELDBUS_AVAILABLE " +fi +AC_SUBST(DALI_ELDBUS_AVAILABLE) + + PKG_CHECK_EXISTS(bullet, [ BULLET_CFLAGS=`pkg-config --cflags bullet` BULLET_LIBS=`pkg-config --libs bullet` @@ -288,4 +298,5 @@ Configuration Data Dir (Read/Write): $dataReadWriteDir Data Dir (Read Only): $dataReadOnlyDir OVERTIZEN2.2: $with_over_tizen_2_2 + EldBus: $eldbus_available "