if UBUNTU_PROFILE
LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_accessibility_common_src_files) \
+ $(adaptor_accessibility_ubuntu_src_files) \
$(adaptor_adaptor_common_src_files) \
$(adaptor_adaptor_ubuntu_src_files) \
$(adaptor_clipboard_common_src_files) \
if MOBILE_PROFILE
LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_accessibility_common_src_files) \
+ $(adaptor_accessibility_tizen_wayland_src_files) \
+ $(adaptor_accessibility_tizen_mobile_src_files) \
$(adaptor_adaptor_common_src_files) \
$(adaptor_adaptor_tizen_wayland_src_files) \
$(adaptor_clipboard_common_src_files) \
if IVI_PROFILE
LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_accessibility_common_src_files) \
+ $(adaptor_accessibility_tizen_wayland_src_files) \
+ $(adaptor_accessibility_tizen_ivi_src_files) \
$(adaptor_adaptor_common_src_files) \
$(adaptor_adaptor_tizen_wayland_src_files) \
$(adaptor_clipboard_common_src_files) \
if TV_PROFILE
LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_accessibility_common_src_files) \
+ $(adaptor_accessibility_tizen_wayland_src_files) \
+ $(adaptor_accessibility_tizen_tv_src_files) \
$(adaptor_adaptor_common_src_files) \
$(adaptor_adaptor_tizen_wayland_src_files) \
$(adaptor_clipboard_common_src_files) \
if COMMON_PROFILE
LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_accessibility_common_src_files) \
+ $(adaptor_accessibility_tizen_wayland_src_files) \
+ $(adaptor_accessibility_tizen_common_src_files) \
$(adaptor_adaptor_common_src_files) \
$(adaptor_adaptor_tizen_wayland_src_files) \
$(adaptor_clipboard_common_src_files) \
if WEARABLE_PROFILE
LIBDALI_ADAPTOR_LA_SOURCES = \
$(adaptor_accessibility_common_src_files) \
+ $(adaptor_accessibility_tizen_wayland_src_files) \
+ $(adaptor_accessibility_tizen_wearable_src_files) \
$(adaptor_adaptor_common_src_files) \
$(adaptor_adaptor_tizen_wayland_src_files) \
$(adaptor_adaptor_tizen_wearable_src_files) \
--- /dev/null
+/*
+ * 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 <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
+
+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::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
--- /dev/null
+#ifndef DALI_ACCESSIBILITY_ADAPTOR_H
+#define DALI_ACCESSIBILITY_ADAPTOR_H
+
+/*
+ * Copyright (c) 2019 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 <dali/public-api/events/touch-event.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/dali-adaptor-common.h>
+
+namespace Dali
+{
+
+namespace Internal DALI_INTERNAL
+{
+namespace Adaptor
+{
+class AccessibilityAdaptor;
+}
+}
+
+class AccessibilityActionHandler;
+class AccessibilityGestureHandler;
+class TouchPoint;
+
+/**
+ * @brief The AccessibilityAdaptor provides communication to the accessibility manager interface (implemented in toolkit).
+ *
+ */
+class DALI_ADAPTOR_API AccessibilityAdaptor : public BaseHandle
+{
+public:
+
+ /**
+ * @brief Create an uninitialized handle.
+ *
+ * This can be initialized by calling getting the adaptor from Dali::Adaptor.
+ */
+ AccessibilityAdaptor();
+
+ /**
+ * @brief Retrieve a handle to the AccessibilityAdaptor.
+ *
+ * @return A handle to the AccessibilityAdaptor.
+ */
+ static AccessibilityAdaptor Get();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~AccessibilityAdaptor();
+
+ /**
+ * @brief Returns the current position of the read action.
+ * @return The current event position.
+ */
+ Vector2 GetReadPosition() const;
+
+ /**
+ * @brief Query whether the accessibility(screen-reader) is enabled.
+ *
+ * The accessibility will be enabled by system setting.
+ * @return True if the accessibility(screen-reader) is enabled.
+ */
+ bool IsEnabled() const;
+
+ /**
+ * @brief Set the handler to handle accessibility actions.
+ *
+ * @param[in] handler The Accessibility action handler.
+ * @note Handlers should remove themselves when they are destroyed.
+ */
+ void SetActionHandler(AccessibilityActionHandler& handler);
+
+ /**
+ * @brief Set the handler to handle accessibility gestures.
+ *
+ * @param[in] handler The Accessibility gesture handler.
+ * @note Handlers should remove themselves when they are destroyed.
+ */
+ void SetGestureHandler(AccessibilityGestureHandler& handler);
+
+ /**
+ * @brief Handle the accessibility action to move focus to the next focusable actor
+ * (by one finger flick down).
+ *
+ * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionNextEvent(bool allowEndFeedback = true);
+
+ /**
+ * @brief Handle 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 action is performed successfully or not.
+ */
+ bool HandleActionPreviousEvent(bool allowEndFeedback = true);
+
+ /**
+ * @brief Handle the accessibility action to activate the current focused actor (by one
+ * finger )
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionActivateEvent();
+
+ /**
+ * @brief Handle the accessibility action to focus and read the actor (by one finger tap or move).
+ *
+ * @param x x position of event
+ * @param y y position of event
+ * @param allowReadAgain true if the action read again the same object (i.e. read action)
+ * false if the action just read when the focus object is changed (i.e. over action)
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
+
+ /**
+ * @brief Handle the accessibility action to move focus to the next focusable actor
+ * (by one finger flick right).
+ *
+ * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionReadNextEvent(bool allowEndFeedback = true);
+
+ /**
+ * @brief Handle 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 front
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionReadPreviousEvent(bool allowEndFeedback = true);
+
+ /**
+ * @brief Handle the accessibility action to change the value when the current focused
+ * actor is a slider (by double finger down and move up and right).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionUpEvent();
+
+ /**
+ * @brief Handle the accessibility action to change the value when the current focused
+ * actor is a slider (by double finger down and move down and left).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionDownEvent();
+
+ /**
+ * @brief Handle the accessibility action to clear the focus from the current focused
+ * actor if any, so that no actor is focused in the focus chain.
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionClearFocusEvent();
+
+ /**
+ * @brief Handle the accessibility action to scroll when there is a scroller on the touched position
+ * (by 2 finger touch & move, 2 finger flick).
+ *
+ * @param[in] point The touch point information.
+ * @param[in] timeStamp The time the touch occurred.
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp);
+
+ /**
+ * @brief Handle the accessibility action to move for the current focused actor
+ * (by 1 finger tap & hold and move).
+ *
+ * @param[in] point The touch point information.
+ * @param[in] timeStamp The time the touch occurred.
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp);
+
+ /**
+ * @brief Handle the accessibility action to navigate back (by two fingers circle draw).
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionBackEvent();
+
+ /**
+ * @brief Handle the accessibility action to enable the feature.
+ */
+ void HandleActionEnableEvent();
+
+ /**
+ * @brief Handle the accessibility action to disable the feature.
+ */
+ void HandleActionDisableEvent();
+
+ /**
+ * @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 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).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionScrollDownEvent();
+
+ /**
+ * @brief Handle the accessibility action to scroll left to the previous page
+ * (by two finger swipe left).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionPageLeftEvent();
+
+ /**
+ * @brief Handle the accessibility action to scroll right to the next page
+ * (by two finger swipe right).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionPageRightEvent();
+
+ /**
+ * @brief Handle the accessibility action to scroll up to the previous page
+ * (by one finger swipe left and right).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionPageUpEvent();
+
+ /**
+ * @brief Handle the accessibility action to scroll down to the next page
+ * (by one finger swipe right and left).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionPageDownEvent();
+
+ /**
+ * @brief Handle the accessibility action to move the focus to the first item on the screen
+ * (by one finger swipe up and down).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionMoveToFirstEvent();
+
+ /**
+ * @brief Handle the accessibility action to move the focus to the last item on the screen
+ * (by one finger swipe down and up).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionMoveToLastEvent();
+
+ /**
+ * @brief Handle the accessibility action to move the focus to the first item on the top
+ * and read from the top item continuously (by three fingers single tap).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionReadFromTopEvent();
+
+ /**
+ * @brief Handle the accessibility action to move focus to and read from the next focusable
+ * actor continuously (by three fingers double tap).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionReadFromNextEvent();
+
+ /**
+ * @brief Handle the accessibility action to do the zooming
+ * (by one finger triple tap).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionZoomEvent();
+
+ /**
+ * @brief Handle the accessibility action to pause/resume the current speech
+ * (by two fingers single tap).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionReadPauseResumeEvent();
+
+ /**
+ * @brief Handle the accessibility action to start/stop the current action
+ * (by two fingers double tap).
+ *
+ * @return Whether the action is performed successfully or not.
+ */
+ bool HandleActionStartStopEvent();
+
+public: // Not intended for application developers
+
+ /**
+ * @brief Creates a handle using the Adaptor::Internal implementation.
+ *
+ * @param[in] adaptor The AccessibilityAdaptor implementation.
+ */
+ DALI_INTERNAL AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor& adaptor );
+
+ /**
+ * @brief This constructor is used by AccessibilityAdaptor::Get().
+ *
+ * @param[in] adaptor A pointer to the accessibility adaptor.
+ */
+ explicit DALI_INTERNAL AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor );
+};
+
+} // namespace Dali
+
+#endif // DALI_ACCESSIBILITY_ADAPTOR_H
--- /dev/null
+#ifndef DALI_ACCESSIBILITY_GESTURE_HANDLER_H
+#define DALI_ACCESSIBILITY_GESTURE_HANDLER_H
+
+/*
+ * Copyright (c) 2019 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 <dali/devel-api/adaptor-framework/accessibility-gesture-event.h>
+
+namespace Dali
+{
+
+/**
+ * AccessibilityGestureHandler is an interface used by Dali to handle accessibility gestures
+ * passed by the accessibility manager.
+ */
+class AccessibilityGestureHandler
+{
+public:
+
+ /**
+ * Handle the accessibility pan gesture.
+ * @param[in] panEvent The pan event to be handled.
+ * @return whether the gesture is handled successfully or not.
+ */
+ virtual bool HandlePanGesture( const AccessibilityGestureEvent& panEvent ) = 0;
+
+}; // class AccessibilityGestureHandler
+
+} // namespace Dali
+
+#endif // DALI_ACCESSIBILITY_GESTURE_HANDLER_H
devel_api_src_files = \
+ $(adaptor_devel_api_dir)/adaptor-framework/accessibility-adaptor.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/application-devel.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/autofill-group.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/autofill-item.cpp \
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-gesture-event.h \
$(adaptor_devel_api_dir)/adaptor-framework/application-devel.h \
$(adaptor_devel_api_dir)/adaptor-framework/autofill-group.h \
$(adaptor_devel_api_dir)/adaptor-framework/autofill-item.h \
--- /dev/null
+/*
+ * Copyright (c) 2019 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 <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/hover-event-integ.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/system/common/system-settings.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace // unnamed namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR");
+#endif
+
+} // unnamed namespace
+
+AccessibilityAdaptor::AccessibilityAdaptor()
+: mReadPosition(),
+ mActionHandler( NULL ),
+ mIsEnabled( false )
+{
+ mAccessibilityGestureDetector = new AccessibilityGestureDetector();
+}
+
+void AccessibilityAdaptor::EnableAccessibility()
+{
+ if(mIsEnabled == false)
+ {
+ mIsEnabled = true;
+
+ if( mActionHandler )
+ {
+ mActionHandler->ChangeAccessibilityStatus();
+ }
+ }
+}
+
+void AccessibilityAdaptor::DisableAccessibility()
+{
+ if(mIsEnabled == true)
+ {
+ mIsEnabled = false;
+
+ if( mActionHandler )
+ {
+ mActionHandler->ChangeAccessibilityStatus();
+ }
+
+ // Destroy the TtsPlayer if exists.
+ if ( Adaptor::IsAvailable() )
+ {
+ Dali::Adaptor& adaptor = Dali::Adaptor::Get();
+ Adaptor& adaptorImpl = Adaptor::GetImplementation( adaptor );
+ adaptorImpl.DestroyTtsPlayer( Dali::TtsPlayer::SCREEN_READER );
+ }
+ }
+}
+
+bool AccessibilityAdaptor::IsEnabled() const
+{
+ return mIsEnabled;
+}
+
+Vector2 AccessibilityAdaptor::GetReadPosition() const
+{
+ return mReadPosition;
+}
+
+void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler)
+{
+ mActionHandler = &handler;
+}
+
+void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler)
+{
+ if( mAccessibilityGestureDetector )
+ {
+ mAccessibilityGestureDetector->SetGestureHandler(handler);
+ }
+}
+
+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 = static_cast< float > (x);
+ mReadPosition.y = static_cast< float > (y);
+
+ if( mActionHandler )
+ {
+ 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::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, uint32_t 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( Integration::Point( 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, uint32_t timeStamp)
+{
+ bool ret = false;
+
+ Dali::TouchEvent touchEvent(timeStamp);
+ touchEvent.points.push_back(point);
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionTouch(touchEvent);
+ }
+ return ret;
+}
+
+bool AccessibilityAdaptor::HandleActionBackEvent()
+{
+ bool ret = false;
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionBack();
+ }
+
+ DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+void AccessibilityAdaptor::HandleActionEnableEvent()
+{
+ EnableAccessibility();
+}
+
+void AccessibilityAdaptor::HandleActionDisableEvent()
+{
+ DisableAccessibility();
+}
+
+bool AccessibilityAdaptor::HandleActionScrollUpEvent()
+{
+ bool ret = false;
+
+ 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::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;
+}
+
+AccessibilityAdaptor::~AccessibilityAdaptor()
+{
+ // Do any platform specific clean-up in OnDestroy()
+ OnDestroy();
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H
+#define DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H
+
+/*
+ * Copyright (c) 2019 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 <string>
+
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/events/touch-point.h>
+#include <dali/integration-api/events/touch-event-combiner.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
+#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
+#include <dali/internal/accessibility/common/accessibility-gesture-detector.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * This class detects to accessibility action
+ */
+class AccessibilityAdaptor : public Dali::BaseObject
+{
+public:
+
+ /**
+ * Constructor.
+ */
+ AccessibilityAdaptor();
+
+ /**
+ * @brief Get an instance of the AccessibilityAdaptor.
+ *
+ * @note This singleton-style getter can be reimplemented for different platforms.
+ * @return The instance of the AccessibilityAdaptor.
+ */
+ static Dali::AccessibilityAdaptor Get();
+
+ /**
+ * 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);
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent()
+ */
+ virtual bool HandleActionNextEvent( bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionPreviousEvent()
+ */
+ virtual bool HandleActionPreviousEvent( bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionActivateEvent()
+ */
+ virtual bool HandleActionActivateEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionReadEvent()
+ */
+ virtual bool HandleActionReadEvent( unsigned int x, unsigned int y, bool allowReadAgain );
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionReadNextEvent()
+ */
+ virtual bool HandleActionReadNextEvent( bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPreviousEvent()
+ */
+ virtual bool HandleActionReadPreviousEvent( bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionUpEvent()
+ */
+ virtual bool HandleActionUpEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionDownEvent()
+ */
+ virtual bool HandleActionDownEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionClearFocusEvent()
+ */
+ bool HandleActionClearFocusEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionScrollEvent()
+ */
+ bool HandleActionScrollEvent(const TouchPoint& point, uint32_t timeStamp);
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionTouchEvent()
+ */
+ bool HandleActionTouchEvent(const TouchPoint& point, uint32_t 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::HandleActionReadPauseResumeEvent()
+ */
+ bool HandleActionReadPauseResumeEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionStartStopEvent()
+ */
+ bool HandleActionStartStopEvent();
+
+protected:
+
+ /**
+ * Destructor.
+ */
+ virtual ~AccessibilityAdaptor();
+
+private:
+
+ /**
+ * @brief Called when the singleton is destroyed.
+ *
+ * @note This can be reimplemented for different platforms.
+ * @return The instance of the AccessibilityAdaptor.
+ */
+ static void OnDestroy();
+
+ // Undefined
+ AccessibilityAdaptor( const AccessibilityAdaptor& );
+ AccessibilityAdaptor& operator=( AccessibilityAdaptor& );
+
+protected:
+
+ Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events.
+
+ Vector2 mReadPosition; ///< ActionRead position
+
+ AccessibilityActionHandler* mActionHandler; ///< The pointer of accessibility action handler
+
+ AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector
+
+ bool mIsEnabled : 1; ///< enable/disable the accessibility action
+
+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<Internal::Adaptor::AccessibilityAdaptor&>(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<const Internal::Adaptor::AccessibilityAdaptor&>(handle);
+ }
+
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H
--- /dev/null
+/*
+ * Copyright (c) 2019 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 <dali/internal/accessibility/common/accessibility-gesture-detector.h>
+
+// EXTERNAL INCLUDES
+#include <cmath>
+
+#include <dali/public-api/events/touch-point.h>
+
+#include <dali/integration-api/events/touch-event-integ.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+ const float MINIMUM_MOTION_DISTANCE_BEFORE_PAN( 15.0f );
+ const float MINIMUM_MOTION_DISTANCE_BEFORE_PAN_SQUARED( MINIMUM_MOTION_DISTANCE_BEFORE_PAN * MINIMUM_MOTION_DISTANCE_BEFORE_PAN );
+ const float MINIMUM_MOTION_DISTANCE_TO_THRESHOLD_ADJUSTMENTS_RATIO( 2.0f / 3.0f );
+ const unsigned long MAXIMUM_TIME_DIFF_ALLOWED( 500 );
+ const unsigned long MINIMUM_TIME_BEFORE_THRESHOLD_ADJUSTMENTS( 100 );
+ const unsigned int MINIMUM_MOTION_EVENTS_BEFORE_PAN(2);
+ const unsigned int MINIMUM_TOUCHES_BEFORE_PAN(1);
+ const unsigned int MAXIMUM_TOUCHES_BEFORE_PAN(1);
+} // unnamed namespace
+
+
+AccessibilityGestureDetector::AccessibilityGestureDetector()
+: mState( Clear ),
+ mScene(nullptr),
+ mGestureHandler(nullptr),
+ mPanning(false),
+ mThresholdAdjustmentsRemaining( 0 ),
+ mThresholdTotalAdjustments( MINIMUM_MOTION_DISTANCE_BEFORE_PAN * MINIMUM_MOTION_DISTANCE_TO_THRESHOLD_ADJUSTMENTS_RATIO ),
+ mPrimaryTouchDownTime( 0 ),
+ mMinimumTouchesRequired( MINIMUM_TOUCHES_BEFORE_PAN ),
+ mMaximumTouchesRequired( MAXIMUM_TOUCHES_BEFORE_PAN ),
+ mMinimumDistanceSquared( MINIMUM_MOTION_DISTANCE_BEFORE_PAN_SQUARED ),
+ mMinimumMotionEvents( MINIMUM_MOTION_EVENTS_BEFORE_PAN ),
+ mMotionEvents( 0 )
+{
+}
+
+AccessibilityGestureDetector::~AccessibilityGestureDetector()
+{
+}
+
+void AccessibilityGestureDetector::SetGestureHandler(AccessibilityGestureHandler& handler)
+{
+ mGestureHandler = &handler;
+}
+
+void AccessibilityGestureDetector::EmitPan(const AccessibilityGestureEvent gesture)
+{
+ if( mGestureHandler )
+ {
+ if(gesture.state == AccessibilityGestureEvent::Started)
+ {
+ mPanning = true;
+ }
+
+ if( mPanning )
+ {
+ mGestureHandler->HandlePanGesture(gesture);
+
+ if( (gesture.state == AccessibilityGestureEvent::Finished) ||
+ (gesture.state == AccessibilityGestureEvent::Cancelled) )
+ {
+ mPanning = false;
+ }
+ }
+ }
+}
+
+void AccessibilityGestureDetector::SendEvent(const Integration::TouchEvent& event)
+{
+ PointState::Type primaryPointState(event.points[0].GetState());
+
+ if (primaryPointState == PointState::INTERRUPTED)
+ {
+ if ( ( mState == Started ) || ( mState == Possible ) )
+ {
+ // If our pan had started and we are interrupted, then tell Core that pan is cancelled.
+ mTouchEvents.push_back(event);
+ SendPan(AccessibilityGestureEvent::Cancelled, event);
+ }
+ mState = Clear; // We should change our state to Clear.
+ mTouchEvents.clear();
+ }
+ else
+ {
+ switch (mState)
+ {
+ case Clear:
+ {
+ if ( ( primaryPointState == PointState::DOWN ) || ( primaryPointState == PointState::STATIONARY ) )
+ {
+ mPrimaryTouchDownLocation = event.points[0].GetScreenPosition();
+ mPrimaryTouchDownTime = event.time;
+ mMotionEvents = 0;
+ if (event.GetPointCount() == mMinimumTouchesRequired)
+ {
+ // We have satisfied the minimum touches required for a pan, tell core that a gesture may be possible and change our state accordingly.
+ mState = Possible;
+ SendPan(AccessibilityGestureEvent::Possible, event);
+ }
+
+ mTouchEvents.push_back(event);
+ }
+ break;
+ }
+
+ case Possible:
+ {
+ unsigned int pointCount(event.GetPointCount());
+ if ( (pointCount >= mMinimumTouchesRequired)&&(pointCount <= mMaximumTouchesRequired) )
+ {
+ if (primaryPointState == PointState::MOTION)
+ {
+ mTouchEvents.push_back(event);
+ mMotionEvents++;
+
+ Vector2 delta(event.points[0].GetScreenPosition() - mPrimaryTouchDownLocation);
+
+ if ( ( mMotionEvents >= mMinimumMotionEvents ) &&
+ ( delta.LengthSquared() >= static_cast<float>( mMinimumDistanceSquared ) ) )
+ {
+ // If the touch point(s) have moved enough distance to be considered a pan, then tell Core that the pan gesture has started and change our state accordingly.
+ mState = Started;
+ SendPan(AccessibilityGestureEvent::Started, event);
+ }
+ }
+ else if (primaryPointState == PointState::UP)
+ {
+ Vector2 delta(event.points[0].GetScreenPosition() - mPrimaryTouchDownLocation);
+ if (delta.LengthSquared() >= static_cast<float>( mMinimumDistanceSquared ) )
+ {
+ SendPan(AccessibilityGestureEvent::Started, event);
+ mTouchEvents.push_back(event);
+ SendPan(AccessibilityGestureEvent::Finished, event);
+ }
+ else
+ {
+ // If we have lifted the primary touch point then tell core the pan is cancelled and change our state to Clear.
+ SendPan(AccessibilityGestureEvent::Cancelled, event);
+ }
+ mState = Clear;
+ mTouchEvents.clear();
+ }
+ }
+ else
+ {
+ // We do not satisfy pan conditions, tell Core our Gesture has been cancelled.
+ SendPan(AccessibilityGestureEvent::Cancelled, event);
+
+ if (pointCount == 1 && primaryPointState == PointState::UP)
+ {
+ // If we have lifted the primary touch point, then change our state to Clear...
+ mState = Clear;
+ mTouchEvents.clear();
+ }
+ else
+ {
+ // ...otherwise change it to Failed.
+ mState = Failed;
+ }
+ }
+ break;
+ }
+
+ case Started:
+ {
+ mTouchEvents.push_back(event);
+
+ unsigned int pointCount(event.GetPointCount());
+ if ( (pointCount >= mMinimumTouchesRequired)&&(pointCount <= mMaximumTouchesRequired) )
+ {
+ switch (primaryPointState)
+ {
+ case PointState::MOTION:
+ // Pan is continuing, tell Core.
+ SendPan(AccessibilityGestureEvent::Continuing, event);
+ break;
+
+ case PointState::UP:
+ // Pan is finally finished when our primary point is lifted, tell Core and change our state to Clear.
+ SendPan(AccessibilityGestureEvent::Finished, event);
+ mState = Clear;
+ mTouchEvents.clear();
+ break;
+
+ case PointState::STATIONARY:
+ if (pointCount == mMinimumTouchesRequired)
+ {
+ Integration::PointContainerConstIterator iter = event.points.begin() + 1; // We already know the state of the first point
+ for(; iter != event.points.end(); ++iter)
+ {
+ if(iter->GetState() == PointState::UP)
+ {
+ // The number of touch points will be less than the minimum required. Inform core and change our state to Finished.
+ SendPan(AccessibilityGestureEvent::Finished, event);
+ mState = Finished;
+ break;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ // We have gone outside of the pan requirements, inform Core that the gesture is finished.
+ SendPan(AccessibilityGestureEvent::Finished, event);
+
+ if (pointCount == 1 && primaryPointState == PointState::UP)
+ {
+ // If this was the primary point being released, then we change our state back to Clear...
+ mState = Clear;
+ mTouchEvents.clear();
+ }
+ else
+ {
+ // ...otherwise we change it to Finished.
+ mState = Finished;
+ }
+ }
+ break;
+ }
+
+ case Finished:
+ case Failed:
+ {
+ if (primaryPointState == PointState::UP)
+ {
+ // Change our state back to clear when the primary touch point is released.
+ mState = Clear;
+ mTouchEvents.clear();
+ }
+ break;
+ }
+ }
+ }
+}
+
+void AccessibilityGestureDetector::SendPan(AccessibilityGestureEvent::State state, const Integration::TouchEvent& currentEvent)
+{
+ AccessibilityGestureEvent gesture(state);
+ gesture.currentPosition = currentEvent.points[0].GetScreenPosition();
+ gesture.numberOfTouches = currentEvent.GetPointCount();
+
+ if ( mTouchEvents.size() > 1 )
+ {
+ // Get the second last event in the queue, the last one is the current event
+ const Integration::TouchEvent& previousEvent( *( mTouchEvents.rbegin() + 1 ) );
+
+ Vector2 previousPosition( mPreviousPosition );
+ uint32_t previousTime( previousEvent.time );
+
+ // If we've just started then we want to remove the threshold from Core calculations.
+ if ( state == AccessibilityGestureEvent::Started )
+ {
+ previousPosition = mPrimaryTouchDownLocation;
+ previousTime = mPrimaryTouchDownTime;
+
+ // If it's a slow pan, we do not want to phase in the threshold over the first few pan-events
+ // A slow pan is defined as one that starts the specified number of milliseconds after the down-event
+ if ( ( currentEvent.time - previousTime ) > MINIMUM_TIME_BEFORE_THRESHOLD_ADJUSTMENTS )
+ {
+ mThresholdAdjustmentsRemaining = mThresholdTotalAdjustments;
+ mThresholdAdjustmentPerFrame = ( gesture.currentPosition - previousPosition ) / static_cast<float>( mThresholdTotalAdjustments );
+ }
+ else
+ {
+ mThresholdAdjustmentsRemaining = 0;
+ mThresholdAdjustmentPerFrame = Vector2::ZERO;
+ }
+ }
+
+ gesture.previousPosition = previousPosition;
+ gesture.timeDelta = currentEvent.time - previousTime;
+
+ // Apply the threshold with a phased approach
+ if ( mThresholdAdjustmentsRemaining > 0 )
+ {
+ --mThresholdAdjustmentsRemaining;
+ gesture.currentPosition -= mThresholdAdjustmentPerFrame * static_cast<float>( mThresholdAdjustmentsRemaining );
+ }
+
+ mPreviousPosition = gesture.currentPosition;
+ }
+ else
+ {
+ gesture.previousPosition = gesture.currentPosition;
+ gesture.timeDelta = 0;
+ }
+
+ gesture.time = currentEvent.time;
+
+ EmitPan(gesture);
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H
+#define DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H
+
+/*
+ * Copyright (c) 2019 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
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-event.h>
+#include <dali/integration-api/scene.h>
+#include <dali/public-api/events/touch-event.h>
+
+namespace Dali
+{
+
+namespace Integration
+{
+struct TouchEvent;
+}
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Detects an accessibility pan gesture and sends it to the gesture handler.
+ */
+class AccessibilityGestureDetector : public RefObject
+{
+public:
+
+ /**
+ * Constructor
+ */
+ AccessibilityGestureDetector();
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~AccessibilityGestureDetector();
+
+ /**
+ * Set the handler to handle accessibility gestures.
+ * @param[in] handler The Accessibility gesture handler.
+ * @note Handlers should remove themselves when they are destroyed.
+ */
+ void SetGestureHandler(AccessibilityGestureHandler& handler);
+
+ void SendEvent(const Integration::TouchEvent& event);
+
+ void SendEvent(Integration::Scene& scene, const Integration::TouchEvent& event)
+ {
+ mScene = &scene;
+ SendEvent(event);
+ }
+
+private:
+
+ /**
+ * Emits the pan gesture event (performs some smoothing operation).
+ * @param[in] state The state of the pan.
+ * @param[in] currentEvent The latest touch event.
+ */
+ void SendPan(AccessibilityGestureEvent::State state, const Integration::TouchEvent& currentEvent);
+
+ /**
+ * Emits the pan gesture event to the gesture handler.
+ * @param[in] gesture The pan gesture event.
+ */
+ void EmitPan(const AccessibilityGestureEvent gesture);
+
+private:
+
+ /**
+ * Internal state machine.
+ */
+ enum State
+ {
+ Clear, ///< No gesture detected.
+ Possible, ///< The current touch event data suggests that a gesture is possible.
+ Started, ///< A gesture has been detected.
+ Finished, ///< A previously started pan gesture has finished.
+ Failed, ///< Current touch event data suggests a pan gesture is not possible.
+ };
+
+ State mState; ///< The current state of the detector.
+
+ Integration::Scene* mScene;
+ AccessibilityGestureHandler* mGestureHandler; ///< The pointer of accessibility gesture handler
+ bool mPanning; ///< Keep track of panning state, when panning is occuring, this is true.
+
+ std::vector<Integration::TouchEvent> mTouchEvents; ///< A container of all touch events after an initial down event.
+
+ Vector2 mPrimaryTouchDownLocation; ///< The initial touch down point.
+ Vector2 mThresholdAdjustmentPerFrame; ///< The adjustment per frame at the start of a slow pan.
+ Vector2 mPreviousPosition; ///< The previous position.
+
+ unsigned int mThresholdAdjustmentsRemaining; ///< No. of threshold adjustments still to apply (for a slow-pan).
+ unsigned int mThresholdTotalAdjustments; ///< The total number of adjustments required.
+
+ uint32_t mPrimaryTouchDownTime; ///< The initial touch down time.
+ unsigned int mMinimumTouchesRequired; ///< The minimum touches required before a pan should be emitted.
+ unsigned int mMaximumTouchesRequired; ///< The maximum touches after which a pan should not be emitted.
+ unsigned int mMinimumDistanceSquared; ///< The minimum distance squared before pan should start.
+ unsigned int mMinimumMotionEvents; ///< The minimum motion events before pan should start.
+ unsigned int mMotionEvents; ///< The motion events received so far (before pan is emitted).
+};
+
+using AccessibilityGestureDetectorPtr = Dali::IntrusivePtr<AccessibilityGestureDetector>;
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H
$(adaptor_accessibility_dir)/bridge/bridge-impl.cpp \
$(adaptor_accessibility_dir)/bridge/dbus.cpp \
$(adaptor_accessibility_dir)/bridge/bridge-text.cpp \
- $(adaptor_accessibility_dir)/bridge/bridge-editable-text.cpp
+ $(adaptor_accessibility_dir)/bridge/bridge-editable-text.cpp \
+ ${adaptor_accessibility_dir}/common/accessibility-adaptor-impl.cpp \
+ ${adaptor_accessibility_dir}/common/accessibility-gesture-detector.cpp
# module: accessibility, backend: tizen-wayland
adaptor_accessibility_tizen_wayland_src_files=\
${adaptor_accessibility_dir}/tizen-wayland/tts-player-factory-tizen.cpp \
${adaptor_accessibility_dir}/tizen-wayland/tts-player-impl-tizen.cpp
+# module: accessibility, backend: tizen-common profile
+adaptor_accessibility_tizen_common_src_files=\
+ ${adaptor_accessibility_dir}/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp
+
+# module: accessibility, backend: tizen-ivi profile
+adaptor_accessibility_tizen_ivi_src_files=\
+ ${adaptor_accessibility_dir}/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp
+
+# module: accessibility, backend: tizen-mobile profile
+adaptor_accessibility_tizen_mobile_src_files=\
+ ${adaptor_accessibility_dir}/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp
+
+# module: accessibility, backend: tizen-tv profile
+adaptor_accessibility_tizen_tv_src_files=\
+ ${adaptor_accessibility_dir}/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp
+
+# module: accessibility, backend: tizen-wearable profile
+adaptor_accessibility_tizen_wearable_src_files=\
+ ${adaptor_accessibility_dir}/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp
+
# module: accessibility, backend: generic
adaptor_accessibility_ubuntu_src_files=\
${adaptor_accessibility_dir}/generic/accessibility-adaptor-impl-generic.cpp \
--- /dev/null
+/*
+ * Copyright (c) 2019 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 <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/singleton-service-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+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() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() );
+ service.Register( typeid( adaptor ), adaptor );
+ }
+ }
+
+ return adaptor;
+}
+
+void AccessibilityAdaptor::OnDestroy()
+{
+ // Nothing to do here
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2018 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 <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <vconf.h>
+
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/singleton-service-impl.h>
+#include <dali/internal/system/common/system-settings.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS = "db/setting/accessibility/atspi";
+
+// Disabled Accessibility temporarily in Tizen platform
+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 static_cast<bool>(isEnabled);
+}
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR" );
+#endif
+
+void AccessibilityOnOffNotification(keynode_t* node, void* data)
+{
+ AccessibilityAdaptor* adaptor = static_cast<AccessibilityAdaptor*>( data );
+
+ bool isEnabled = GetEnabledVConf();
+
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ if( isEnabled )
+ {
+ adaptor->EnableAccessibility();
+ }
+ else
+ {
+ adaptor->DisableAccessibility();
+ }
+}
+
+} // 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() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() );
+ AccessibilityAdaptor& adaptorImpl = AccessibilityAdaptor::GetImplementation( adaptor );
+
+ bool isEnabled = GetEnabledVConf();
+
+ if( isEnabled )
+ {
+ adaptorImpl.EnableAccessibility();
+ }
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+ vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+
+ service.Register( typeid( adaptor ), adaptor );
+ }
+ }
+
+ return adaptor;
+}
+
+void AccessibilityAdaptor::OnDestroy()
+{
+ vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification );
+ vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification );
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2019 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 <dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.h>
+
+// EXTERNAL INCLUDES
+#include <vconf.h>
+
+#ifndef WAYLAND
+#include <dali/internal/system/linux/dali-ecore-x.h>
+#include <dali/internal/system/linux/dali-elementary.h>
+#endif
+
+#include <vconf.h>
+
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/singleton-service-impl.h>
+#include <dali/internal/system/common/system-settings.h>
+
+#ifndef WAYLAND
+#define MSG_DOMAIN_CONTROL_ACCESS static_cast< int >( ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL )
+#endif
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace // unnamed namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR");
+#endif
+
+const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS = "db/setting/accessibility/atspi";
+
+bool GetEnabledVConf()
+{
+ int isEnabled = 0;
+ vconf_get_bool( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, &isEnabled );
+
+ if( isEnabled == 0 )
+ {
+ vconf_get_bool( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled );
+ }
+
+ return bool( isEnabled );
+}
+
+
+void AccessibilityOnOffNotification(keynode_t* node, void* data)
+{
+ AccessibilityAdaptor* adaptor = static_cast<AccessibilityAdaptor*>( data );
+
+ bool isEnabled = GetEnabledVConf();
+
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ if( isEnabled )
+ {
+ adaptor->EnableAccessibility();
+ }
+ else
+ {
+ adaptor->DisableAccessibility();
+ }
+}
+
+} // 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() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() );
+ AccessibilityAdaptorMobile& adaptorImpl = AccessibilityAdaptorMobile::GetImplementation( adaptor );
+
+ bool isEnabled = GetEnabledVConf();
+
+ if( isEnabled )
+ {
+ adaptorImpl.EnableAccessibility();
+ }
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+ vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+
+ service.Register( typeid( adaptor ), adaptor );
+ }
+ }
+
+ return adaptor;
+}
+
+void AccessibilityAdaptor::OnDestroy()
+{
+ vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification );
+ vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification );
+}
+
+AccessibilityAdaptorMobile::AccessibilityAdaptorMobile()
+{
+}
+
+bool AccessibilityAdaptorMobile::HandleActionNextEvent(bool allowEndFeedback)
+{
+ bool ret = false;
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
+ }
+
+ DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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;
+
+ if( mActionHandler )
+ {
+ // 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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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;
+}
+
+AccessibilityAdaptorMobile::~AccessibilityAdaptorMobile()
+{
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2019 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 <dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.h>
+
+// EXTERNAL INCLUDES
+#include <vconf.h>
+
+#ifndef WAYLAND
+#include <dali/internal/system/linux/dali-ecore-x.h>
+#include <dali/internal/system/linux/dali-elementary.h>
+#endif
+
+#include <vconf.h>
+
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/singleton-service-impl.h>
+#include <dali/internal/system/common/system-settings.h>
+
+#ifndef WAYLAND
+#define MSG_DOMAIN_CONTROL_ACCESS static_cast< int >( ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL )
+#endif
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace // unnamed namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR");
+#endif
+
+const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS = "db/setting/accessibility/atspi";
+
+bool GetEnabledVConf()
+{
+ int isEnabled = 0;
+ vconf_get_bool( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, &isEnabled );
+
+ if( isEnabled == 0 )
+ {
+ vconf_get_bool( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled );
+ }
+
+ return bool( isEnabled );
+}
+
+
+void AccessibilityOnOffNotification(keynode_t* node, void* data)
+{
+ AccessibilityAdaptor* adaptor = static_cast<AccessibilityAdaptor*>( data );
+
+ bool isEnabled = GetEnabledVConf();
+
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ if( isEnabled )
+ {
+ adaptor->EnableAccessibility();
+ }
+ else
+ {
+ adaptor->DisableAccessibility();
+ }
+}
+
+} // 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() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() );
+ AccessibilityAdaptorMobile& adaptorImpl = AccessibilityAdaptorMobile::GetImplementation( adaptor );
+
+ bool isEnabled = GetEnabledVConf();
+
+ if( isEnabled )
+ {
+ adaptorImpl.EnableAccessibility();
+ }
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+ vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+
+ service.Register( typeid( adaptor ), adaptor );
+ }
+ }
+
+ return adaptor;
+}
+
+void AccessibilityAdaptor::OnDestroy()
+{
+ vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification );
+ vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification );
+}
+
+AccessibilityAdaptorMobile::AccessibilityAdaptorMobile()
+{
+}
+
+bool AccessibilityAdaptorMobile::HandleActionNextEvent(bool allowEndFeedback)
+{
+ bool ret = false;
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
+ }
+
+ DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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;
+
+ if( mActionHandler )
+ {
+ // 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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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;
+}
+
+AccessibilityAdaptorMobile::~AccessibilityAdaptorMobile()
+{
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_MOBILE_H
+#define DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_MOBILE_H
+
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
+#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
+#include <dali/internal/accessibility/common/accessibility-gesture-detector.h>
+#include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * This mobile version is different since it forwards events to the indicator.
+ */
+class AccessibilityAdaptorMobile : public AccessibilityAdaptor
+{
+public:
+
+ /**
+ * Constructor.
+ */
+ AccessibilityAdaptorMobile();
+
+ // From AccessibilityAdaptor base class
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent()
+ */
+ virtual bool HandleActionNextEvent( bool allowEndFeedback );
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionPreviousEvent()
+ */
+ virtual bool HandleActionPreviousEvent( bool allowEndFeedback );
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionActivateEvent()
+ */
+ virtual bool HandleActionActivateEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionReadEvent()
+ */
+ virtual bool HandleActionReadEvent( unsigned int x, unsigned int y, bool allowReadAgain );
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionReadNextEvent()
+ */
+ virtual bool HandleActionReadNextEvent( bool allowEndFeedback );
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPreviousEvent()
+ */
+ virtual bool HandleActionReadPreviousEvent( bool allowEndFeedback );
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionUpEvent()
+ */
+ virtual bool HandleActionUpEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityAdaptor::HandleActionDownEvent()
+ */
+ virtual bool HandleActionDownEvent();
+
+private:
+
+ /**
+ * Destructor.
+ */
+ virtual ~AccessibilityAdaptorMobile();
+
+ // Undefined
+ AccessibilityAdaptorMobile( const AccessibilityAdaptorMobile& );
+ AccessibilityAdaptorMobile& operator=( AccessibilityAdaptorMobile& );
+
+public:
+
+ // Helpers for public-api forwarding methods
+
+ inline static Internal::Adaptor::AccessibilityAdaptorMobile& GetImplementation(Dali::AccessibilityAdaptor& adaptor)
+ {
+ DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptorMobile handle is empty" );
+
+ BaseObject& handle = adaptor.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::AccessibilityAdaptorMobile&>(handle);
+ }
+
+ inline static const Internal::Adaptor::AccessibilityAdaptorMobile& GetImplementation(const Dali::AccessibilityAdaptor& adaptor)
+ {
+ DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptorMobile handle is empty" );
+
+ const BaseObject& handle = adaptor.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::AccessibilityAdaptorMobile&>(handle);
+ }
+
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_MOBILE_H
--- /dev/null
+/*
+ * Copyright (c) 2018 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 <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
+
+// EXTERNAL INCLUDES
+#include <vconf.h>
+
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/singleton-service-impl.h>
+#include <dali/internal/system/common/system-settings.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS = "db/setting/accessibility/atspi";
+
+// Disabled Accessibility temporarily in Tizen platform
+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 static_cast<bool>(isEnabled);
+}
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR" );
+#endif
+
+void AccessibilityOnOffNotification(keynode_t* node, void* data)
+{
+ AccessibilityAdaptor* adaptor = static_cast<AccessibilityAdaptor*>( data );
+
+ bool isEnabled = GetEnabledVConf();
+
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ if( isEnabled )
+ {
+ adaptor->EnableAccessibility();
+ }
+ else
+ {
+ adaptor->DisableAccessibility();
+ }
+}
+
+} // 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() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptor() );
+ AccessibilityAdaptor& adaptorImpl = AccessibilityAdaptor::GetImplementation( adaptor );
+
+ bool isEnabled = GetEnabledVConf();
+
+ if( isEnabled )
+ {
+ adaptorImpl.EnableAccessibility();
+ }
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+ vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+
+ service.Register( typeid( adaptor ), adaptor );
+ }
+ }
+
+ return adaptor;
+}
+
+void AccessibilityAdaptor::OnDestroy()
+{
+ vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification );
+ vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification );
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2019 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 <dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.h>
+
+// EXTERNAL INCLUDES
+#include <vconf.h>
+
+#ifndef WAYLAND
+#include <dali/internal/system/linux/dali-ecore-x.h>
+#include <dali/internal/system/linux/dali-elementary.h>
+#endif
+
+#include <vconf.h>
+
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/singleton-service-impl.h>
+#include <dali/internal/system/common/system-settings.h>
+
+#ifndef WAYLAND
+#define MSG_DOMAIN_CONTROL_ACCESS static_cast< int >( ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL )
+#endif
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace // unnamed namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityAdaptorLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_ADAPTOR");
+#endif
+
+const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS = "db/setting/accessibility/atspi";
+
+bool GetEnabledVConf()
+{
+ int isEnabled = 0;
+ vconf_get_bool( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, &isEnabled );
+
+ if( isEnabled == 0 )
+ {
+ vconf_get_bool( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled );
+ }
+
+ return bool( isEnabled );
+}
+
+
+void AccessibilityOnOffNotification(keynode_t* node, void* data)
+{
+ AccessibilityAdaptor* adaptor = static_cast<AccessibilityAdaptor*>( data );
+
+ bool isEnabled = GetEnabledVConf();
+
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ if( isEnabled )
+ {
+ adaptor->EnableAccessibility();
+ }
+ else
+ {
+ adaptor->DisableAccessibility();
+ }
+}
+
+} // 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() ) );
+ }
+ else
+ {
+ adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() );
+ AccessibilityAdaptorMobile& adaptorImpl = AccessibilityAdaptorMobile::GetImplementation( adaptor );
+
+ bool isEnabled = GetEnabledVConf();
+
+ if( isEnabled )
+ {
+ adaptorImpl.EnableAccessibility();
+ }
+ DALI_LOG_INFO( gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled ? "ENABLED" : "DISABLED" );
+
+ vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+ vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
+
+ service.Register( typeid( adaptor ), adaptor );
+ }
+ }
+
+ return adaptor;
+}
+
+void AccessibilityAdaptor::OnDestroy()
+{
+ vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification );
+ vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_DBUS_TTS, AccessibilityOnOffNotification );
+}
+
+AccessibilityAdaptorMobile::AccessibilityAdaptorMobile()
+{
+}
+
+bool AccessibilityAdaptorMobile::HandleActionNextEvent(bool allowEndFeedback)
+{
+ bool ret = false;
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
+ }
+
+ DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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;
+
+ if( mActionHandler)
+ {
+ // 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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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 AccessibilityAdaptorMobile::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;
+}
+
+AccessibilityAdaptorMobile::~AccessibilityAdaptorMobile()
+{
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
#include <dali/internal/system/common/callback-manager.h>
#include <dali/internal/accessibility/common/tts-player-impl.h>
+#include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
#include <dali/internal/window-system/common/event-handler.h>
#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
#include <dali/internal/graphics/gles/gl-implementation.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
#include <dali/devel-api/adaptor-framework/style-monitor.h>
#include <dali/integration-api/render-surface.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>