From: Adeel Kazmi Date: Thu, 12 Nov 2020 09:59:19 +0000 (+0000) Subject: Merge "Use existing callback ID for recurring callbacks" into devel/master X-Git-Tag: dali_2.0.1~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=26771f49800f03bac50943b9ca711f3eb38ccd4d;hp=9c73ad5ecec2923563dad00d0c54929a33144e26 Merge "Use existing callback ID for recurring callbacks" into devel/master --- diff --git a/automated-tests/patch-coverage.pl b/automated-tests/patch-coverage.pl index 3a97dac..b3cf098 100755 --- a/automated-tests/patch-coverage.pl +++ b/automated-tests/patch-coverage.pl @@ -1105,7 +1105,7 @@ sub calc_patch_coverage_percentage my $percent = 0; if($total_exec > 0) { $percent = 100 * $total_covered_lines / $total_exec; } - return [ $total_exec, $percent ]; + return [ $total_exec, $percent, $total_covered_lines ]; } # @@ -1417,6 +1417,7 @@ elsif( ! $opt_quiet ) print RESET; } +printf("Line Coverage: %d/%d\n", $percentref->[2], $percentref->[0]); printf("Percentage of change covered: %5.2f%\n", $percent); exit($percent<90); diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.cpp index a694eeb..9e8c7a8 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.cpp @@ -112,6 +112,31 @@ bool TestGlAbstraction::IsSurfacelessContextSupported() const return true; } +bool TestGlAbstraction::IsAdvancedBlendEquationSupported() +{ + return true; +} + +bool TestGlAbstraction::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) +{ + return true; +} + +std::string TestGlAbstraction::GetShaderVersionPrefix() +{ + return std::string(""); +} + +std::string TestGlAbstraction::GetVertexShaderPrefix() +{ + return std::string(""); +} + +std::string TestGlAbstraction::GetFragmentShaderPrefix() +{ + return std::string(""); +} + bool TestGlAbstraction::TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const { return ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA)); diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h index 99dca10..861f4ae 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-gl-abstraction.h @@ -61,6 +61,16 @@ public: bool IsSurfacelessContextSupported() const override; + bool IsAdvancedBlendEquationSupported() override; + + bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) override; + + std::string GetShaderVersionPrefix(); + + std::string GetVertexShaderPrefix(); + + std::string GetFragmentShaderPrefix(); + bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override; /* OpenGL ES 2.0 */ @@ -1889,6 +1899,10 @@ public: { } + inline void BlendBarrier(void) + { + } + private: inline void AddUniformCallToTraceStack(GLint location, std::string& value) { diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.cpp index 0b814e7..b53630d 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.cpp @@ -21,8 +21,11 @@ #include #include #include + +#include #include +#include #include #include #include @@ -31,6 +34,8 @@ namespace TestHarness { typedef std::map RunningTestCases; +const double MAXIMUM_CHILD_LIFETIME(60.0f); // 1 minute + const char* basename(const char* path) { const char* ptr = path; @@ -247,25 +252,42 @@ int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], bool re else // Parent process { TestCase tc(nextTestCase, tc_array[nextTestCase].name); + tc.startTime = std::chrono::steady_clock::now(); + children[pid] = tc; nextTestCase++; numRunningChildren++; } } - // Wait for the next child to finish - + // Check to see if any children have finished yet int32_t status = 0; - int32_t childPid = waitpid(-1, &status, 0); - if(childPid == -1) + int32_t childPid = waitpid(-1, &status, WNOHANG); + if(childPid == 0) + { + // No children have finished. + // Check if any have exceeded execution time + auto endTime = std::chrono::steady_clock::now(); + + for(auto& tc : children) + { + std::chrono::steady_clock::duration timeSpan = endTime - tc.second.startTime; + std::chrono::duration seconds = std::chrono::duration_cast>(timeSpan); + if(seconds.count() > MAXIMUM_CHILD_LIFETIME) + { + // Kill the child process. A subsequent call to waitpid will process signal result below. + kill(tc.first, SIGKILL); + } + } + } + else if(childPid == -1) // waitpid errored { perror("waitpid"); exit(EXIT_STATUS_WAITPID_FAILED); } - - if(WIFEXITED(status)) + else // a child has finished { - if(childPid > 0) + if(WIFEXITED(status)) { int32_t testResult = WEXITSTATUS(status); if(testResult) @@ -280,14 +302,11 @@ int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], bool re } numRunningChildren--; } - } - - else if(WIFSIGNALED(status) || WIFSTOPPED(status)) - { - status = WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status); - if(childPid > 0) + else if(WIFSIGNALED(status) || WIFSTOPPED(status)) { + status = WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status); + RunningTestCases::iterator iter = children.find(childPid); if(iter != children.end()) { diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.h index c4b5e03..b210918 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-harness.h @@ -20,6 +20,7 @@ #include #include +#include #include namespace TestHarness @@ -39,29 +40,34 @@ const int32_t MAX_NUM_CHILDREN(16); struct TestCase { - int32_t testCase; - const char* testCaseName; + int32_t testCase; + const char* testCaseName; + std::chrono::steady_clock::time_point startTime; TestCase() : testCase(0), - testCaseName(NULL) + testCaseName(NULL), + startTime() { } TestCase(int32_t tc, const char* name) : testCase(tc), - testCaseName(name) + testCaseName(name), + startTime() { } TestCase(const TestCase& rhs) : testCase(rhs.testCase), - testCaseName(rhs.testCaseName) + testCaseName(rhs.testCaseName), + startTime(rhs.startTime) { } TestCase& operator=(const TestCase& rhs) { testCase = rhs.testCase; testCaseName = rhs.testCaseName; + startTime = rhs.startTime; return *this; } }; diff --git a/automated-tests/src/dali-adaptor/utc-Dali-Gl-Window.cpp b/automated-tests/src/dali-adaptor/utc-Dali-Gl-Window.cpp index d77d9bf..493cdf7 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-Gl-Window.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-Gl-Window.cpp @@ -309,15 +309,15 @@ int UtcDaliGlWindowSetAvailableOrientations(void) try { - Dali::Vector< Dali::GlWindow::GlWindowOrientation> orientations; - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::PORTRAIT ); - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::LANDSCAPE ); - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::PORTRAIT_INVERSE ); - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::LANDSCAPE_INVERSE ); - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::NO_ORIENTATION_PREFERENCE ); - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::PORTRAIT ); - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::LANDSCAPE ); - orientations.PushBack( Dali::GlWindow::GlWindowOrientation::PORTRAIT_INVERSE ); + Dali::Vector< Dali::WindowOrientation> orientations; + orientations.PushBack( Dali::WindowOrientation::PORTRAIT ); + orientations.PushBack( Dali::WindowOrientation::LANDSCAPE ); + orientations.PushBack( Dali::WindowOrientation::PORTRAIT_INVERSE ); + orientations.PushBack( Dali::WindowOrientation::LANDSCAPE_INVERSE ); + orientations.PushBack( Dali::WindowOrientation::NO_ORIENTATION_PREFERENCE ); + orientations.PushBack( Dali::WindowOrientation::PORTRAIT ); + orientations.PushBack( Dali::WindowOrientation::LANDSCAPE ); + orientations.PushBack( Dali::WindowOrientation::PORTRAIT_INVERSE ); window.SetAvailableOrientations(orientations); DALI_TEST_CHECK( false ); @@ -335,7 +335,7 @@ int UtcDaliGlWindowSetPreferredOrientation(void) try { - window.SetPreferredOrientation(Dali::GlWindow::GlWindowOrientation::PORTRAIT); + window.SetPreferredOrientation(Dali::WindowOrientation::PORTRAIT); DALI_TEST_CHECK( false ); } @@ -352,7 +352,7 @@ int UtcDaliGlWindowSetPreferredOrientation1(void) try { - window.SetPreferredOrientation(Dali::GlWindow::GlWindowOrientation::NO_ORIENTATION_PREFERENCE); + window.SetPreferredOrientation(Dali::WindowOrientation::NO_ORIENTATION_PREFERENCE); DALI_TEST_CHECK( false ); } @@ -369,8 +369,8 @@ int UtcDaliWindowGetCurrentOrientation(void) try { - Dali::GlWindow::GlWindowOrientation orientation = window.GetCurrentOrientation(); - DALI_TEST_CHECK( orientation == Dali::GlWindow::GlWindowOrientation::PORTRAIT ); + Dali::WindowOrientation orientation = window.GetCurrentOrientation(); + DALI_TEST_CHECK( orientation == Dali::WindowOrientation::PORTRAIT ); DALI_TEST_CHECK( false ); } @@ -382,15 +382,17 @@ int UtcDaliWindowGetCurrentOrientation(void) } // Internal callback function -void glInit() +void glInit(void) { } -void glRenderFrame() +int glRenderFrame(void) { + static unsigned int retFlag = 0; + return retFlag++; } -void glTerminate() +void glTerminate(void) { } @@ -400,7 +402,7 @@ int UtcDaliGlWindowRegisterGlCallback(void) try { - window.RegisterGlCallback( glInit, glRenderFrame, glTerminate ); + window.RegisterGlCallback( Dali::MakeCallback( glInit ), Dali::MakeCallback( glRenderFrame ), Dali::MakeCallback( glTerminate ) ); DALI_TEST_CHECK( false ); } @@ -417,7 +419,7 @@ int UtcDaliGlWindowRenderOnce(void) try { - window.RegisterGlCallback( glInit, glRenderFrame, glTerminate ); + window.RegisterGlCallback( Dali::MakeCallback( glInit ), Dali::MakeCallback( glRenderFrame ), Dali::MakeCallback( glTerminate ) ); window.RenderOnce(); DALI_TEST_CHECK( false ); diff --git a/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp b/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp index 673d561..8a165d2 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp @@ -203,7 +203,7 @@ int UtcDaliWindowAddAvailableOrientationN(void) Dali::Window window; try { - window.AddAvailableOrientation(Dali::Window::PORTRAIT); + window.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT); DALI_TEST_CHECK(false); // Should not reach here! } catch(...) @@ -219,7 +219,7 @@ int UtcDaliWindowRemoveAvailableOrientationN(void) Dali::Window window; try { - window.RemoveAvailableOrientation(Dali::Window::PORTRAIT); + window.RemoveAvailableOrientation(Dali::WindowOrientation::PORTRAIT); DALI_TEST_CHECK(false); // Should not reach here! } catch(...) @@ -235,7 +235,7 @@ int UtcDaliWindowSetPreferredOrientationN(void) Dali::Window window; try { - window.SetPreferredOrientation(Dali::Window::PORTRAIT); + window.SetPreferredOrientation(Dali::WindowOrientation::PORTRAIT); DALI_TEST_CHECK(false); // Should not reach here! } catch(...) @@ -251,8 +251,8 @@ int UtcDaliWindowGetPreferredOrientationN(void) Dali::Window window; try { - Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation(); - DALI_TEST_CHECK(orientation == Dali::Window::PORTRAIT); // Should not reach here! + Dali::WindowOrientation orientation = window.GetPreferredOrientation(); + DALI_TEST_CHECK(orientation == Dali::WindowOrientation::PORTRAIT); // Should not reach here! } catch(...) { diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 3ece9fd..da3510f 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -17,6 +17,7 @@ ENDIF() OPTION(ENABLE_PKG_CONFIGURE "Use pkgconfig" ON) OPTION(ENABLE_LINK_TEST "Enable the link test" ON) +OPTION(ENABLE_ATSPI "Enable AT-SPI accessibility" ON) # Include additional macros INCLUDE( common.cmake ) @@ -104,6 +105,10 @@ IF( UNIX ) INCLUDE( deps-check.cmake ) ENDIF() +IF( NOT DALI_ELDBUS_AVAILABLE ) + SET( ENABLE_ATSPI OFF ) +ENDIF() + # Set up compiler flags and warnings IF( UNIX ) ADD_COMPILE_OPTIONS( -Wall ${DALI_CFLAGS} )# -Wextra -Wno-unused-parameter )# -Wfloat-equal ) @@ -135,6 +140,12 @@ INCLUDE( module-list.cmake ) # Include profile specific setup INCLUDE( profiles/${PROFILE_LCASE}-profile.cmake ) +IF ( ENABLE_ATSPI ) + SET( SOURCES ${SOURCES} ${adaptor_accessibility_atspi_bridge_src_files} ) +ELSE() + SET( SOURCES ${SOURCES} ${adaptor_accessibility_atspi_dummy_src_files} ) +ENDIF() + IF( ENABLE_PKG_CONFIGURE ) # Configure the pkg-config file # Requires the following variables to be setup: @@ -393,7 +404,6 @@ MESSAGE( STATUS "Freetype bitmap support (Emoji): ${freetype_bitmap_support_ENA MESSAGE( STATUS "Profile: ${ENABLE_PROFILE}") MESSAGE( STATUS "Data Dir (Read/Write): ${dataReadWriteDir}") MESSAGE( STATUS "Data Dir (Read Only): ${dataReadOnlyDir}") -MESSAGE( STATUS "EldBus: ${eldbus_available_ENABLED}") MESSAGE( STATUS "WebP: ${webp_available_ENABLED}") MESSAGE( STATUS "Shader Binary Cache: ${ENABLE_SHADERBINCACHE}") MESSAGE( STATUS "Network logging enabled: ${ENABLE_NETWORKLOGGING}") @@ -401,6 +411,7 @@ MESSAGE( STATUS "Font config file: ${fontConfigurationFile}") MESSAGE( STATUS "Using Tizen APP FW libraries: ${ENABLE_APPFW}") MESSAGE( STATUS "Use pkg configure: ${ENABLE_PKG_CONFIGURE}" ) MESSAGE( STATUS "Enable link test: ${ENABLE_LINK_TEST}" ) +MESSAGE( STATUS "Enable AT-SPI: ${ENABLE_ATSPI}" ) MESSAGE( STATUS "Tizen Platform Config supported ${TIZEN_PLATFORM_CONFIG_SUPPORTED_LOGMSG}") MESSAGE( STATUS "Compile flags: ${CMAKE_CXX_FLAGS}") MESSAGE( STATUS "Compile flags: ${CMAKE_C_FLAGS}") diff --git a/build/tizen/deps-check.cmake b/build/tizen/deps-check.cmake index 371d8ea..7ce0606 100644 --- a/build/tizen/deps-check.cmake +++ b/build/tizen/deps-check.cmake @@ -60,6 +60,8 @@ ELSE() SET( FREETYPE_BITMAP_SUPPORT_VERSION 17.1.11 ) ENDIF() +SET( ELDBUS_REQUIRED 1.16.0 ) + # checking all possibly used modules (required and optionals) CHECK_MODULE_AND_SET( EXIF exif exif_available ) CHECK_MODULE_AND_SET( FREETYPE freetype2>=${FREETYPE_REQUIRED} freetype_available ) @@ -79,7 +81,8 @@ CHECK_MODULE_AND_SET( TTRACE ttrace ENABLE_TTRACE ) CHECK_MODULE_AND_SET( ECORE ecore [] ) CHECK_MODULE_AND_SET( ECORE_IPC ecore-ipc [] ) CHECK_MODULE_AND_SET( ECORE_IMF ecore-imf [] ) -CHECK_MODULE_AND_SET( ELDBUS eldbus eldbus_available ) +CHECK_MODULE_AND_SET( ELDBUS eldbus>=${ELDBUS_REQUIRED} eldbus_available ) +CHECK_MODULE_AND_SET( TPKP_CURL tpkp-curl tpkp_curl_available ) CHECK_MODULE_AND_SET( UTILX utilX utilx_available ) CHECK_MODULE_AND_SET( OPENGLES20 glesv2 [] ) CHECK_MODULE_AND_SET( EGL egl [] ) diff --git a/dali/devel-api/adaptor-framework/accessibility-action-handler.h b/dali/devel-api/adaptor-framework/accessibility-action-handler.h deleted file mode 100644 index 9ceaf58..0000000 --- a/dali/devel-api/adaptor-framework/accessibility-action-handler.h +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef DALI_ACCESSIBILITY_ACTION_HANDLER_H -#define DALI_ACCESSIBILITY_ACTION_HANDLER_H - -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include - -namespace Dali -{ -/** - * AccessibilityActionHandler is an abstract interface, used by Dali to handle accessibility actions - * passed by the accessibility manager. - */ -class AccessibilityActionHandler -{ -public: - /** - * Change the accessibility status when Accessibility feature(screen-reader) turned on or off. - * @return whether the status is changed or not. - */ - virtual bool ChangeAccessibilityStatus() = 0; - - /** - * Clear the accessibility focus from the current focused actor. - * @return whether the focus is cleared or not. - */ - virtual bool ClearAccessibilityFocus() = 0; - - /** - * Perform the accessibility action associated with a scroll event. - * @param touch The touch point (and time) of the event. - * @return whether the focus is cleared or not. - */ - virtual bool AccessibilityActionScroll(Dali::TouchEvent& touch) = 0; - - /** - * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up). - * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionPrevious(bool allowEndFeedback) = 0; - - /** - * Perform 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 accessibility action is performed or not. - */ - virtual bool AccessibilityActionNext(bool allowEndFeedback) = 0; - - /** - * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick left). - * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionReadPrevious(bool allowEndFeedback) = 0; - - /** - * Perform 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 accessibility action is performed or not. - */ - virtual bool AccessibilityActionReadNext(bool allowEndFeedback) = 0; - - /** - * Perform the accessibility action to focus and read the actor (by one finger tap or move). - * @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 accessibility action is performed or not. - */ - virtual bool AccessibilityActionRead(bool allowReadAgain) = 0; - - /** - * Perform the accessibility action to activate the current focused actor (by one finger double tap). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionActivate() = 0; - - /** - * Perform 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 accessibility action is performed or not. - */ - virtual bool AccessibilityActionUp() = 0; - - /** - * Perform 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 accessibility action is performed or not. - */ - virtual bool AccessibilityActionDown() = 0; - - /** - * Perform the accessibility action to navigate back (by two fingers circle draw). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionBack() = 0; - - /** - * Perform the accessibility action to scroll up the list and focus on the first item on the list - * after the scrolling and read the item (by two finger swipe up). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionScrollUp() = 0; - - /** - * Perform the accessibility action to scroll down the list and focus on the first item on the list - * after the scrolling and read the item (by two finger swipe down). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionScrollDown() = 0; - - /** - * Perform the accessibility action to scroll left to the previous page (by two finger swipe left). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionPageLeft() = 0; - - /** - * Perform the accessibility action to scroll right to the next page (by two finger swipe right). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionPageRight() = 0; - - /** - * Perform the accessibility action to scroll up to the previous page (by one finger swipe left and right). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionPageUp() = 0; - - /** - * Perform the accessibility action to scroll down to the next page (by one finger swipe right and left). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionPageDown() = 0; - - /** - * Perform the accessibility action to move the focus to the first item on the screen - * (by one finger swipe up and down). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionMoveToFirst() = 0; - - /** - * Perform the accessibility action to move the focus to the last item on the screen - * (by one finger swipe down and up). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionMoveToLast() = 0; - - /** - * Perform the accessibility action to move the focus to the first item on the top - * and read from the top item continuously (by three fingers single tap). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionReadFromTop() = 0; - - /** - * Perform the accessibility action to move the focus to and read from the next item - * continuously (by three fingers double tap). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionReadFromNext() = 0; - - /** - * Perform the accessibility action to move the focus to do the zooming (by one finger triple tap). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionZoom() = 0; - - /** - * Perform the accessibility action to pause/resume the current read out (by two fingers single tap). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionReadPauseResume() = 0; - - /** - * Perform the accessibility action to start/stop the current action (by two fingers double tap). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionStartStop() = 0; - -}; // class AccessibilityActionHandler - -} // namespace Dali - -#endif // DALI_ACCESSIBILITY_ACTION_HANDLER_H diff --git a/dali/devel-api/adaptor-framework/accessibility-adaptor.cpp b/dali/devel-api/adaptor-framework/accessibility-adaptor.cpp deleted file mode 100644 index c6938d6..0000000 --- a/dali/devel-api/adaptor-framework/accessibility-adaptor.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ -AccessibilityAdaptor::AccessibilityAdaptor() -{ -} - -AccessibilityAdaptor AccessibilityAdaptor::Get() -{ - return Internal::Adaptor::AccessibilityAdaptor::Get(); -} - -AccessibilityAdaptor::~AccessibilityAdaptor() -{ -} - -Vector2 AccessibilityAdaptor::GetReadPosition() const -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).GetReadPosition(); -} - -bool AccessibilityAdaptor::IsEnabled() const -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).IsEnabled(); -} - -void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler) -{ - Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).SetActionHandler(handler); -} - -void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler) -{ - Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).SetGestureHandler(handler); -} - -bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionNextEvent(allowEndFeedback); -} - -bool AccessibilityAdaptor::HandleActionPreviousEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionPreviousEvent(allowEndFeedback); -} - -bool AccessibilityAdaptor::HandleActionActivateEvent() -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionActivateEvent(); -} - -bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain); -} - -bool AccessibilityAdaptor::HandleActionReadNextEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadNextEvent(allowEndFeedback); -} - -bool AccessibilityAdaptor::HandleActionReadPreviousEvent(bool allowEndFeedback) -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadPreviousEvent(allowEndFeedback); -} - -bool AccessibilityAdaptor::HandleActionUpEvent() -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionUpEvent(); -} - -bool AccessibilityAdaptor::HandleActionDownEvent() -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionDownEvent(); -} - -bool AccessibilityAdaptor::HandleActionClearFocusEvent() -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionClearFocusEvent(); -} - -bool AccessibilityAdaptor::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp) -{ - return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp); -} - -bool AccessibilityAdaptor::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 diff --git a/dali/devel-api/adaptor-framework/accessibility-adaptor.h b/dali/devel-api/adaptor-framework/accessibility-adaptor.h deleted file mode 100644 index f6f963c..0000000 --- a/dali/devel-api/adaptor-framework/accessibility-adaptor.h +++ /dev/null @@ -1,327 +0,0 @@ -#ifndef DALI_ACCESSIBILITY_ADAPTOR_H -#define DALI_ACCESSIBILITY_ADAPTOR_H - -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ -namespace Internal DALI_INTERNAL -{ -namespace Adaptor -{ -class AccessibilityAdaptor; -} -} // namespace DALI_INTERNAL - -class AccessibilityActionHandler; -class AccessibilityGestureHandler; -struct 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 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 diff --git a/dali/devel-api/adaptor-framework/accessibility-gesture-event.h b/dali/devel-api/adaptor-framework/accessibility-gesture-event.h deleted file mode 100644 index 816059b..0000000 --- a/dali/devel-api/adaptor-framework/accessibility-gesture-event.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef DALI_INTEGRAION_ACCESSIBILITY_GESTURE_STRUCTS_H -#define DALI_INTEGRAION_ACCESSIBILITY_GESTURE_STRUCTS_H - -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ -struct AccessibilityGestureEvent -{ - // Construction & Destruction - - /** - * Virtual destructor - */ - ~AccessibilityGestureEvent() - { - } - - // Data - - /** - * The previous touch position of the primary touch point in screen coordinates. - */ - Vector2 previousPosition; - - /** - * This current touch position of the primary touch point in screen coordinates. - */ - Vector2 currentPosition; - - /** - * The time difference between the previous and latest touch motion events (in ms). - */ - unsigned long timeDelta; - - /** - * The total number of fingers touching the screen in a pan gesture. - */ - unsigned int numberOfTouches; - - enum State - { - CLEAR, ///< There is no state associated with this gesture. @SINCE_1_9.28 - STARTED, ///< The touched points on the screen have moved enough to be considered a gesture. @SINCE_1_9.28 - CONTINUING, ///< The gesture is continuing. @SINCE_1_9.28 - FINISHED, ///< The user has lifted a finger or touched an additional point on the screen. @SINCE_1_9.28 - CANCELLED, ///< The gesture has been cancelled. @SINCE_1_9.28 - POSSIBLE ///< A gesture is possible. @SINCE_1_9.28 - }; - - State state; - - uint32_t time; - - /** - * Default Constructor - * @param[in] state The state of the gesture - */ - AccessibilityGestureEvent(AccessibilityGestureEvent::State state) - : timeDelta(0), - numberOfTouches(0), - state(state), - time(0) - { - } -}; - -} // namespace Dali - -#endif // DALI_INTEGRAION_ACCESSIBILITY_GESTURE_STRUCTS_H diff --git a/dali/devel-api/adaptor-framework/accessibility-gesture-handler.h b/dali/devel-api/adaptor-framework/accessibility-gesture-handler.h deleted file mode 100644 index 8ab2a8a..0000000 --- a/dali/devel-api/adaptor-framework/accessibility-gesture-handler.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef DALI_ACCESSIBILITY_GESTURE_HANDLER_H -#define DALI_ACCESSIBILITY_GESTURE_HANDLER_H - -/* - * Copyright (c) 2020 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 - -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 diff --git a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp b/dali/devel-api/adaptor-framework/accessibility-impl.cpp similarity index 97% rename from dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp rename to dali/devel-api/adaptor-framework/accessibility-impl.cpp index 98ee86f..dcf1149 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.cpp +++ b/dali/devel-api/adaptor-framework/accessibility-impl.cpp @@ -27,7 +27,7 @@ // INTERNAL INCLUDES #include -#include +#include #include using namespace Dali::Accessibility; @@ -635,10 +635,6 @@ public: { return false; } - int GetHighlightIndex() override - { - return 0; - } bool IsScrollable() override { return false; @@ -699,7 +695,6 @@ public: States s; if( root ) { - s[State::HIGHLIGHTABLE] = true; s[State::ENABLED] = true; s[State::SENSITIVE] = true; s[State::SHOWING] = true; @@ -741,6 +736,12 @@ std::function< Accessible*( Dali::Actor ) > convertingFunctor = []( Dali::Actor return nullptr; }; +ObjectRegistry objectRegistry; +} // namespace + +void Accessible::SetObjectRegistry(ObjectRegistry registry) +{ + objectRegistry = registry; } void Accessible::RegisterControlAccessibilityGetter( std::function< Accessible*( Dali::Actor ) > functor ) @@ -757,10 +758,9 @@ Accessible* Accessible::Get( Dali::Actor actor, bool root ) auto accessible = convertingFunctor( actor ); if( !accessible ) { - if( nonControlAccessibles.empty() ) + if( nonControlAccessibles.empty() && objectRegistry ) { - auto registry = Adaptor::Get().GetObjectRegistry(); - registry.ObjectDestroyedSignal().Connect( []( const Dali::RefObject* obj ) + objectRegistry.ObjectDestroyedSignal().Connect( []( const Dali::RefObject* obj ) { nonControlAccessibles.erase( obj ); } diff --git a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.h b/dali/devel-api/adaptor-framework/accessibility-impl.h similarity index 97% rename from dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.h rename to dali/devel-api/adaptor-framework/accessibility-impl.h index 534cf70..cb8b2a5 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-impl.h +++ b/dali/devel-api/adaptor-framework/accessibility-impl.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include #include @@ -33,20 +34,19 @@ #include //INTERNAL INCLUDES -#include -#include +#include #include namespace Dali { namespace Accessibility { -class Accessible; -class Text; -class Value; -class Component; -class Collection; -class Action; +class DALI_ADAPTOR_API Accessible; +class DALI_ADAPTOR_API Text; +class DALI_ADAPTOR_API Value; +class DALI_ADAPTOR_API Component; +class DALI_ADAPTOR_API Collection; +class DALI_ADAPTOR_API Action; /** * @brief Base class for different accessibility bridges @@ -57,7 +57,7 @@ class Action; * * @note This class is singleton. */ -struct Bridge +struct DALI_ADAPTOR_API Bridge { enum class ForceUpResult { @@ -417,7 +417,7 @@ public: /** * @brief Emits property-changed event - * @param[in] Property changed event + * @param[in] event Property changed event **/ void Emit( ObjectPropertyChangeEvent event ); @@ -607,10 +607,13 @@ protected: Accessible& operator=( const Accessible& ) = delete; Accessible& operator=( Accessible&& ) = delete; std::shared_ptr< Bridge::Data > GetBridgeData(); + +public: static Dali::Actor GetHighlightActor(); static void SetHighlightActor(Dali::Actor actor); static Dali::Actor GetCurrentlyHighlightedActor(); static void SetCurrentlyHighlightedActor(Dali::Actor); + static void SetObjectRegistry(ObjectRegistry registry); private: friend class Bridge; @@ -770,15 +773,6 @@ public: virtual bool ClearHighlight() = 0; /** - * @brief Get index of "highlighted" object - * - * @return The index of "highlighted" object - * - * @see Dali:Accessibility::State - */ - virtual int GetHighlightIndex() = 0; - - /** * @brief Check whether object can be scrolled * * @return true if object is scrollable, false otherwise @@ -861,7 +855,7 @@ public: * * @see Dali::Accessibility::EditableText */ -class Text : public virtual Accessible +class DALI_ADAPTOR_API Text : public virtual Accessible { public: /** @@ -891,7 +885,7 @@ public: /** * @brief Set caret offset * - * @param[in] caret offset + * @param[in] offset Caret offset * * @return True if successful */ @@ -952,7 +946,7 @@ public: * * @see Dali::Accessibility::EditableText */ -class EditableText : public virtual Accessible +class DALI_ADAPTOR_API EditableText : public virtual Accessible { public: /** @@ -983,7 +977,7 @@ public: * (embedding for example), but the object itself ain't planned to be used otherwise. * This object has null parent, no children, empty name and so on */ -class EmptyAccessibleWithAddress : public virtual Accessible +class DALI_ADAPTOR_API EmptyAccessibleWithAddress : public virtual Accessible { public: EmptyAccessibleWithAddress() = default; diff --git a/dali/internal/accessibility/tizen-wayland/atspi/accessibility.h b/dali/devel-api/adaptor-framework/accessibility.h similarity index 93% rename from dali/internal/accessibility/tizen-wayland/atspi/accessibility.h rename to dali/devel-api/adaptor-framework/accessibility.h index 9e88cf5..a6e373e 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/accessibility.h +++ b/dali/devel-api/adaptor-framework/accessibility.h @@ -19,6 +19,7 @@ // EXTERNAL INCLUDES +#include #include #include #include @@ -297,8 +298,8 @@ enum class State : uint32_t */ enum class TextChangedState : uint32_t { - INSERT, - DELETE, + INSERTED, + DELETED, MAX_COUNT }; @@ -619,7 +620,7 @@ using Attributes = std::unordered_map< std::string, std::string >; * @brief Class representing unique object address on accessibility bus * @see Dali::Accessibility::Accessible::GetAddress */ -class Address +class DALI_ADAPTOR_API Address { public: Address() = default; @@ -684,7 +685,7 @@ enum class Consumed /** * @brief Helper class representing two dimensional point with integer coordinates */ -struct Point +struct DALI_ADAPTOR_API Point { int x = 0; int y = 0; @@ -710,7 +711,7 @@ struct Point /** * @brief Helper class representing size of rectangle object with usage of two integer values */ -struct Size +struct DALI_ADAPTOR_API Size { int width = 0; int height = 0; @@ -739,7 +740,7 @@ struct Size * @see Dali::Accessibility::Text::GetTextAtOffset * @see Dali::Accessibility::Text::GetSelection */ -struct Range +struct DALI_ADAPTOR_API Range { int32_t startOffset = 0; int32_t endOffset = 0; @@ -770,7 +771,7 @@ struct Range * eventTime : time when event occured * @see Dali::Accessibility::Accessible::DoGesture */ -struct GestureInfo +struct DALI_ADAPTOR_API GestureInfo { GestureInfo() = default; GestureInfo(Gesture type, int32_t xBeg, int32_t xEnd, int32_t yBeg, int32_t yEnd, GestureState state, uint32_t eventTime) @@ -801,7 +802,7 @@ struct GestureInfo * @see Dali::Accessibility::Accessible::Address * @see Dali::Accessibility::Accessible::RelationType */ -struct Relation +struct DALI_ADAPTOR_API Relation { Relation(RelationType relationType, std::vector
targets) : relationType(relationType), diff --git a/dali/internal/accessibility/tizen-wayland/atspi/atspi-accessibility-tizen.cpp b/dali/devel-api/adaptor-framework/atspi-accessibility.cpp old mode 100755 new mode 100644 similarity index 89% rename from dali/internal/accessibility/tizen-wayland/atspi/atspi-accessibility-tizen.cpp rename to dali/devel-api/adaptor-framework/atspi-accessibility.cpp index dd5cb7c..575b8f7 --- a/dali/internal/accessibility/tizen-wayland/atspi/atspi-accessibility-tizen.cpp +++ b/dali/devel-api/adaptor-framework/atspi-accessibility.cpp @@ -16,13 +16,7 @@ */ #include -#include -#include - -#include -#include -#include -#include +#include void Dali::AtspiAccessibility::Pause() { diff --git a/dali/devel-api/adaptor-framework/gl-window.cpp b/dali/devel-api/adaptor-framework/gl-window.cpp index bbad021..7eccfec 100644 --- a/dali/devel-api/adaptor-framework/gl-window.cpp +++ b/dali/devel-api/adaptor-framework/gl-window.cpp @@ -28,11 +28,13 @@ namespace Dali { + GlWindow GlWindow::New() { PositionSize positionSize( 0, 0, 0, 0 ); return Dali::GlWindow::New( positionSize, "", "", false ); } + GlWindow GlWindow::New(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent ) { GlWindow newWindow; @@ -51,9 +53,11 @@ GlWindow GlWindow::New(PositionSize positionSize, const std::string& name, const } return newWindow; } + GlWindow::GlWindow() { } + GlWindow::~GlWindow() { } @@ -70,114 +74,142 @@ void GlWindow::SetEglConfig( bool depth, bool stencil, int msaa, GlesVersion ver { GetImplementation(*this).SetEglConfig( depth, stencil, msaa, version ); } + void GlWindow::Raise() { GetImplementation(*this).Raise(); } + void GlWindow::Lower() { GetImplementation(*this).Lower(); } + void GlWindow::Activate() { GetImplementation(*this).Activate(); } + void GlWindow::Show() { GetImplementation(*this).Show(); } + void GlWindow::Hide() { GetImplementation(*this).Hide(); } + unsigned int GlWindow::GetSupportedAuxiliaryHintCount() const { return GetImplementation(*this).GetSupportedAuxiliaryHintCount(); } + std::string GlWindow::GetSupportedAuxiliaryHint( unsigned int index ) const { return GetImplementation(*this).GetSupportedAuxiliaryHint( index ); } + unsigned int GlWindow::AddAuxiliaryHint( const std::string& hint, const std::string& value ) { return GetImplementation(*this).AddAuxiliaryHint( hint, value ); } + bool GlWindow::RemoveAuxiliaryHint( unsigned int id ) { return GetImplementation(*this).RemoveAuxiliaryHint( id ); } + bool GlWindow::SetAuxiliaryHintValue( unsigned int id, const std::string& value ) { return GetImplementation(*this).SetAuxiliaryHintValue( id, value ); } + std::string GlWindow::GetAuxiliaryHintValue( unsigned int id ) const { return GetImplementation(*this).GetAuxiliaryHintValue( id ); } + unsigned int GlWindow::GetAuxiliaryHintId( const std::string& hint ) const { return GetImplementation(*this).GetAuxiliaryHintId( hint ); } + void GlWindow::SetInputRegion( const Rect< int >& inputRegion ) { GetImplementation(*this).SetInputRegion( inputRegion ); } + void GlWindow::SetOpaqueState( bool opaque ) { GetImplementation(*this).SetOpaqueState( opaque ); } + bool GlWindow::IsOpaqueState() const { return GetImplementation(*this).IsOpaqueState(); } + void GlWindow::SetPositionSize( PositionSize positionSize ) { GetImplementation(*this).SetPositionSize( positionSize ); } + PositionSize GlWindow::GetPositionSize() const { return GetImplementation(*this).GetPositionSize(); } -Dali::GlWindow::GlWindowOrientation GlWindow::GetCurrentOrientation() const + +WindowOrientation GlWindow::GetCurrentOrientation() const { return GetImplementation( *this ).GetCurrentOrientation(); } -void GlWindow::SetAvailableOrientations( const Dali::Vector< Dali::GlWindow::GlWindowOrientation >& orientations ) + +void GlWindow::SetAvailableOrientations( const Dali::Vector< WindowOrientation >& orientations ) { GetImplementation( *this ).SetAvailableOrientations( orientations ); } -void GlWindow::SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation ) + +void GlWindow::SetPreferredOrientation( WindowOrientation orientation ) { GetImplementation(*this).SetPreferredOrientation( orientation ); } -void GlWindow::RegisterGlCallback( GlInitialize glInit, GlRenderFrame glRenderFrame, GlTerminate glTerminate ) + +void GlWindow::RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback ) { - GetImplementation(*this).RegisterGlCallback( glInit, glRenderFrame, glTerminate ); + GetImplementation(*this).RegisterGlCallback( initCallback, renderFrameCallback, terminateCallback ); } + void GlWindow::RenderOnce() { GetImplementation(*this).RenderOnce(); } + GlWindow::FocusChangeSignalType& GlWindow::FocusChangeSignal() { return GetImplementation(*this).FocusChangeSignal(); } + GlWindow::ResizeSignalType& GlWindow::ResizeSignal() { return GetImplementation(*this).ResizeSignal(); } + GlWindow::KeyEventSignalType& GlWindow::KeyEventSignal() { return GetImplementation(*this).KeyEventSignal(); } + GlWindow::TouchEventSignalType& GlWindow::TouchedSignal() { return GetImplementation(*this).TouchedSignal(); } + GlWindow::VisibilityChangedSignalType& GlWindow::VisibilityChangedSignal() { return GetImplementation(*this).VisibilityChangedSignal(); } + GlWindow::GlWindow( Internal::Adaptor::GlWindow* window ) : BaseHandle( window ) { diff --git a/dali/devel-api/adaptor-framework/gl-window.h b/dali/devel-api/adaptor-framework/gl-window.h index 1efc014..986c3ff 100644 --- a/dali/devel-api/adaptor-framework/gl-window.h +++ b/dali/devel-api/adaptor-framework/gl-window.h @@ -27,6 +27,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -48,13 +49,6 @@ class GlWindow; } } -namespace -{ -typedef void (*GlInitialize)(); -typedef void (*GlRenderFrame)(); -typedef void (*GlTerminate)(); -} - class TouchEvent; class KeyEvent; @@ -83,21 +77,6 @@ public: // Enumerations /** - * @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. - * - * This Enumeration is used the available orientation APIs and the preferred orientation. - * - */ - enum class GlWindowOrientation - { - PORTRAIT = 0, ///< Portrait orientation. The height of the display area is greater than the width. - LANDSCAPE = 1, ///< Landscape orientation. A wide view area is needed. - PORTRAIT_INVERSE = 2, ///< Portrait inverse orientation - LANDSCAPE_INVERSE = 3, ///< Landscape inverse orientation - NO_ORIENTATION_PREFERENCE = -1 ///< Invalid angle value. It is used to initialize or unset the preferred orientation. - }; - - /** * @brief Enumeration for GLES verion * * This Enumeration is used the GLES version for EGL configuration. @@ -326,7 +305,7 @@ public: * * @return The current GlWindow rotation angle if previously set, or none */ - Dali::GlWindow::GlWindowOrientation GetCurrentOrientation() const; + WindowOrientation GetCurrentOrientation() const; /** * @brief Sets available orientations of the window. @@ -335,7 +314,7 @@ public: * * @param[in] orientations The available orientations list to add */ - void SetAvailableOrientations( const Dali::Vector& orientations ); + void SetAvailableOrientations( const Dali::Vector& orientations ); /** * @brief Sets a preferred orientation. @@ -345,17 +324,36 @@ public: * * @note To unset the preferred orientation, angle should be set NO_ORIENTATION_PREFERENCE. */ - void SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation ); + void SetPreferredOrientation( WindowOrientation orientation ); /** * @brief Registers a GL callback function for application. * - * @param[in] glInit the callback function for application initialize - * @param[in] glRenderFrame the callback function to render to the frame. - * @param[in] glTerminate the callback function to clean-up application GL resource. + * @param[in] initCallback the callback function for application initialize + * @param[in] renderFrameCallback the callback function to render for the frame. + * @param[in] terminateCallback the callback function to clean-up application GL resource. * + * @note Function must be called on idle time + * + * A initCallback of the following type should be used: + * @code + * void intializeGL(); + * @endcode + * This callback will be called before renderFrame callback is called at once. + * + * A renderFrameCallback of the following type should be used: + * @code + * int renderFrameGL(); + * @endcode + * This callback's return value is not 0, the eglSwapBuffers() will be called. + * + * A terminateCallback of the following type should be used: + * @code + * void terminateGL(); + * @endcode + * This callback is called when GlWindow is deleted. */ - void RegisterGlCallback( GlInitialize glInit, GlRenderFrame glRenderFrame, GlTerminate glTerminate ); + void RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback ); /** * @brief Renders once more even if GL render functions are not added to idler. diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index 08b1a19..e29e213 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -18,6 +18,7 @@ // EXTERNAL INCLUDES #include #include +#include // INTERNAL INCLUDES #include @@ -120,12 +121,12 @@ Window DownCast(BaseHandle handle) return Window(dynamic_cast(handle.GetObjectPtr())); } -Dali::Window::WindowOrientation GetCurrentOrientation(Window window) +WindowOrientation GetCurrentOrientation(Window window) { return GetImplementation(window).GetCurrentOrientation(); } -void SetAvailableOrientations(Window window, const Dali::Vector& orientations) +void SetAvailableOrientations(Window window, const Dali::Vector& orientations) { GetImplementation(window).SetAvailableOrientations(orientations); } diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index 613a9c2..ea3577a 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -34,25 +35,6 @@ class RenderTaskList; namespace DevelWindow { -/** - * @brief Enumeration for transition effect's state. - */ -enum class EffectState -{ - NONE = 0, ///< None state - START, ///< Transition effect is started. - END ///< Transition effect is ended. -}; - -/** - * @brief Enumeration for transition effect's type. - */ -enum class EffectType -{ - NONE = 0, ///< None type - SHOW, ///< Window show effect. - HIDE, ///< Window hide effect. -}; typedef Signal EventProcessingFinishedSignalType; ///< Event Processing finished signal type @@ -64,7 +46,7 @@ typedef Signal WheelEventSignalType; ///< Touched signa typedef Signal VisibilityChangedSignalType; ///< Visibility changed signal type -typedef Signal TransitionEffectEventSignalType; ///< Effect signal type and state +typedef Signal TransitionEffectEventSignalType; ///< Effect signal type and state typedef Signal KeyboardRepeatSettingsChangedSignalType; ///< Keyboard repeat settings changed signal type @@ -207,7 +189,7 @@ DALI_ADAPTOR_API Window DownCast(BaseHandle handle); * @param[in] window The window instance * @return The current window orientation if previously set, or none */ -DALI_ADAPTOR_API Dali::Window::WindowOrientation GetCurrentOrientation(Window window); +DALI_ADAPTOR_API WindowOrientation GetCurrentOrientation(Window window); /** * @brief Sets available orientations of the window. @@ -217,7 +199,7 @@ DALI_ADAPTOR_API Dali::Window::WindowOrientation GetCurrentOrientation(Window wi * @param[in] window The window instance * @param[in] orientations The available orientation list to add */ -DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector& orientations); +DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector& orientations); /** * @brief Gets current window ID. diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index f8d1786..aa03a5f 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -1,9 +1,10 @@ SET( devel_api_src_files - ${adaptor_devel_api_dir}/adaptor-framework/accessibility-adaptor.cpp + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-impl.cpp ${adaptor_devel_api_dir}/adaptor-framework/animated-image-loading.cpp ${adaptor_devel_api_dir}/adaptor-framework/application-devel.cpp + ${adaptor_devel_api_dir}/adaptor-framework/atspi-accessibility.cpp ${adaptor_devel_api_dir}/adaptor-framework/bitmap-saver.cpp ${adaptor_devel_api_dir}/adaptor-framework/clipboard.cpp ${adaptor_devel_api_dir}/adaptor-framework/clipboard-event-notifier.cpp @@ -42,10 +43,8 @@ SET( devel_api_src_files SET( 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/accessibility.h + ${adaptor_devel_api_dir}/adaptor-framework/accessibility-impl.h ${adaptor_devel_api_dir}/adaptor-framework/animated-image-loading.h ${adaptor_devel_api_dir}/adaptor-framework/application-devel.h ${adaptor_devel_api_dir}/adaptor-framework/atspi-accessibility.h diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index fc29948..073372c 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -35,6 +35,7 @@ #include #include #include +#include namespace Dali { @@ -47,43 +48,6 @@ namespace #if defined(DEBUG_ENABLED) Debug::Filter* gSceneHolderLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_SCENE_HOLDER"); #endif - -// Copied from x server -static uint32_t GetCurrentMilliSeconds(void) -{ - struct timeval tv; - - struct timespec tp; - static clockid_t clockid; - - if(!clockid) - { -#ifdef CLOCK_MONOTONIC_COARSE - if(clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 && - (tp.tv_nsec / 1000) <= 1000 && clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0) - { - clockid = CLOCK_MONOTONIC_COARSE; - } - else -#endif - if(clock_gettime(CLOCK_MONOTONIC, &tp) == 0) - { - clockid = CLOCK_MONOTONIC; - } - else - { - clockid = ~0L; - } - } - if(clockid != ~0L && clock_gettime(clockid, &tp) == 0) - { - return static_cast((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L)); - } - - gettimeofday(&tv, NULL); - return static_cast((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); -} - } // unnamed namespace uint32_t SceneHolder::mSceneHolderCounter = 0; @@ -276,7 +240,7 @@ void SceneHolder::FeedTouchPoint(Dali::Integration::Point& point, int timeStamp) { if(timeStamp < 1) { - timeStamp = GetCurrentMilliSeconds(); + timeStamp = TimeService::GetMilliSeconds(); } RecalculateTouchPosition(point); diff --git a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-common.h b/dali/internal/accessibility/bridge/accessibility-common.h similarity index 85% rename from dali/internal/accessibility/tizen-wayland/atspi/accessibility-common.h rename to dali/internal/accessibility/bridge/accessibility-common.h index 80f7f17..7b5e5c8 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-common.h +++ b/dali/internal/accessibility/bridge/accessibility-common.h @@ -26,9 +26,9 @@ // INTERNAL INCLUDES #include -#include -#include -#include +#include +#include +#include #define A11yDbusName "org.a11y.Bus" #define A11yDbusPath "/org/a11y/bus" @@ -136,26 +136,12 @@ namespace detail { template < typename T > -struct signature_accessible_impl +struct signature_accessible_impl : signature_helper> { + using subtype = std::pair< std::string, ObjectPath >; -using subtype = std::pair< std::string, ObjectPath >; - - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "AtspiAccessiblePtr"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "(so)"; - } + static constexpr auto name_v = concat("AtspiAccessiblePtr"); + static constexpr auto sig_v = concat("(so)"); /** * @brief Marshals value v as marshalled type into message @@ -212,25 +198,12 @@ struct signature< Dali::Accessibility::Accessible* > : public signature_accessib }; template <> -struct signature< Dali::Accessibility::Address > +struct signature< Dali::Accessibility::Address > : signature_helper> { -using subtype = std::pair< std::string, ObjectPath >; + using subtype = std::pair< std::string, ObjectPath >; - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "AtspiAccessiblePtr"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "(so)"; - } + static constexpr auto name_v = concat("AtspiAccessiblePtr"); + static constexpr auto sig_v = concat("(so)"); /** * @brief Marshals value v as marshalled type into message @@ -267,32 +240,19 @@ using subtype = std::pair< std::string, ObjectPath >; { return false; } - + v = { std::move( tmp.first ), tmp.second.value.substr( strlen( ATSPI_PREFIX_PATH ) ) }; return true; } }; template <> -struct signature< Dali::Accessibility::States > +struct signature< Dali::Accessibility::States > : signature_helper> { -using subtype = std::array< uint32_t, 2 >; - - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return signature< subtype >::name(); - } + using subtype = std::array; - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return signature< subtype >::sig(); - } + static constexpr auto name_v = signature::name_v; + static constexpr auto sig_v = signature::sig_v; /** * @brief Marshals value v as marshalled type into message diff --git a/dali/internal/accessibility/tizen-wayland/atspi/accessible.cpp b/dali/internal/accessibility/bridge/accessible.cpp similarity index 95% rename from dali/internal/accessibility/tizen-wayland/atspi/accessible.cpp rename to dali/internal/accessibility/bridge/accessible.cpp index 4419f2c..f23e33f 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/accessible.cpp +++ b/dali/internal/accessibility/bridge/accessible.cpp @@ -18,7 +18,7 @@ // CLASS HEADER //INTERNAL INCLUDES -#include +#include #include #include @@ -36,6 +36,10 @@ std::vector< std::string > Accessible::GetInterfaces() { tmp.push_back(AtspiDbusInterfaceText); } + if (dynamic_cast(this)) + { + tmp.push_back(AtspiDbusInterfaceEditableText); + } if (dynamic_cast(this)) { tmp.push_back(AtspiDbusInterfaceValue); @@ -114,13 +118,13 @@ void Accessible::EmitFocused(bool set) void Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content) { if (auto b = GetBridgeData()) { - b->bridge->EmitTextChanged(this, TextChangedState::INSERT, position, length, content); + b->bridge->EmitTextChanged(this, TextChangedState::INSERTED, position, length, content); } } void Accessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content) { if (auto b = GetBridgeData()) { - b->bridge->EmitTextChanged(this, TextChangedState::DELETE, position, length, content); + b->bridge->EmitTextChanged(this, TextChangedState::DELETED, position, length, content); } } void Accessible::EmitTextCaretMoved(unsigned int cursorPosition) diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-accessible.cpp b/dali/internal/accessibility/bridge/bridge-accessible.cpp similarity index 98% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-accessible.cpp rename to dali/internal/accessibility/bridge/bridge-accessible.cpp index dd3bd71..03a6677 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-accessible.cpp +++ b/dali/internal/accessibility/bridge/bridge-accessible.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include @@ -156,9 +156,6 @@ static bool AcceptObject( Component* obj ) return false; if ( !AcceptObjectCheckRelations( obj ) ) return false; - // if (CALL(get_object_in_relation_by_type, obj, ATSPI_RELATION_CONTROLLED_BY) != NULL) return 0; - if ( !AcceptObjectCheckRelations( obj ) ) - return false; if( !states[State::HIGHLIGHTABLE] ) return false; @@ -277,11 +274,20 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() double maximumValue = 0.0; double minimumValue = 0.0; + auto *value = dynamic_cast(self); + if (value) + { + currentValue = value->GetCurrent(); + minimumIncrement = value->GetMinimumIncrement(); + maximumValue = value->GetMaximum(); + minimumValue = value->GetMinimum(); + } + auto description = self->GetDescription(); auto indexInParent = static_cast< int32_t >( self->GetIndexInParent() ); bool isSelectedInParent = false; bool hasCheckBoxChild = false; - int32_t firstSelectedChildIndex = 0; + int32_t firstSelectedChildIndex = -1; int32_t selectedChildCount = 0; for( auto i = 0u; i < static_cast< size_t >( childCount ); ++i ) @@ -290,9 +296,9 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() auto s = q->GetStates(); if( s[State::SELECTABLE] ) { - ++selectedChildCount; if( s[State::SELECTED] ) { + ++selectedChildCount; if( firstSelectedChildIndex < 0 ) firstSelectedChildIndex = static_cast< int32_t >( i ); } @@ -350,14 +356,6 @@ DBus::ValueOrError< Accessible*, uint8_t, Accessible* > BridgeAccessible::GetNav bool recurse = false; if( component ) { - const auto states = component->GetStates(); - if( states[State::MODAL] ) - { - component = nullptr; - } - } - if( component ) - { recurse = component->IsProxy(); } //TODO: add deputy diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-accessible.h b/dali/internal/accessibility/bridge/bridge-accessible.h similarity index 100% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-accessible.h rename to dali/internal/accessibility/bridge/bridge-accessible.h diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-action.cpp b/dali/internal/accessibility/bridge/bridge-action.cpp similarity index 97% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-action.cpp rename to dali/internal/accessibility/bridge/bridge-action.cpp index a632f30..47c5eae 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-action.cpp +++ b/dali/internal/accessibility/bridge/bridge-action.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-action.h b/dali/internal/accessibility/bridge/bridge-action.h similarity index 95% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-action.h rename to dali/internal/accessibility/bridge/bridge-action.h index 1a8213e..a47eb82 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-action.h +++ b/dali/internal/accessibility/bridge/bridge-action.h @@ -23,7 +23,7 @@ #include // INTERNAL INCLUDES -#include +#include class BridgeAction : public virtual BridgeBase { diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-base.cpp b/dali/internal/accessibility/bridge/bridge-base.cpp similarity index 98% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-base.cpp rename to dali/internal/accessibility/bridge/bridge-base.cpp index 6b122aa..c8f01c6 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-base.cpp +++ b/dali/internal/accessibility/bridge/bridge-base.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include @@ -139,7 +139,7 @@ Accessible* BridgeBase::FindByPath( const std::string& name ) const { return Find( name ); } - catch( std::domain_error ) + catch( std::domain_error& ) { return nullptr; } diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-base.h b/dali/internal/accessibility/bridge/bridge-base.h similarity index 99% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-base.h rename to dali/internal/accessibility/bridge/bridge-base.h index 64a046f..5ba0ee0 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-base.h +++ b/dali/internal/accessibility/bridge/bridge-base.h @@ -23,7 +23,7 @@ #include // INTERNAL INCLUDES -#include +#include class AppAccessible : public virtual Dali::Accessibility::Accessible, public virtual Dali::Accessibility::Collection { diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-collection.cpp b/dali/internal/accessibility/bridge/bridge-collection.cpp similarity index 98% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-collection.cpp rename to dali/internal/accessibility/bridge/bridge-collection.cpp index 0271c4a..022a310 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-collection.cpp +++ b/dali/internal/accessibility/bridge/bridge-collection.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include @@ -345,7 +345,7 @@ struct BridgeCollection::Comparer void BridgeCollection::VisitNodes( Accessible* obj, std::vector< Accessible* >& result, Comparer& cmp, size_t maxCount ) { - if( result.size() >= maxCount ) + if( maxCount > 0 && result.size() >= maxCount ) return; if( cmp( obj ) ) diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-collection.h b/dali/internal/accessibility/bridge/bridge-collection.h similarity index 96% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-collection.h rename to dali/internal/accessibility/bridge/bridge-collection.h index eb46db6..c4a279d 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-collection.h +++ b/dali/internal/accessibility/bridge/bridge-collection.h @@ -25,7 +25,7 @@ #include // INTERNAL INCLUDES -#include +#include class BridgeCollection : public virtual BridgeBase { diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-component.cpp b/dali/internal/accessibility/bridge/bridge-component.cpp similarity index 98% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-component.cpp rename to dali/internal/accessibility/bridge/bridge-component.cpp index b772147..1e65ddc 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-component.cpp +++ b/dali/internal/accessibility/bridge/bridge-component.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-component.h b/dali/internal/accessibility/bridge/bridge-component.h similarity index 96% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-component.h rename to dali/internal/accessibility/bridge/bridge-component.h index 49b14d1..dcc8f49 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-component.h +++ b/dali/internal/accessibility/bridge/bridge-component.h @@ -26,7 +26,7 @@ #include // INTERNAL INCLUDES -#include +#include class BridgeComponent : public virtual BridgeBase { diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-editable-text.cpp b/dali/internal/accessibility/bridge/bridge-editable-text.cpp similarity index 96% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-editable-text.cpp rename to dali/internal/accessibility/bridge/bridge-editable-text.cpp index 875c953..eb74e28 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-editable-text.cpp +++ b/dali/internal/accessibility/bridge/bridge-editable-text.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // INTERNAL INCLUDES #include diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-editable-text.h b/dali/internal/accessibility/bridge/bridge-editable-text.h similarity index 94% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-editable-text.h rename to dali/internal/accessibility/bridge/bridge-editable-text.h index 8538c27..e7d707b 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-editable-text.h +++ b/dali/internal/accessibility/bridge/bridge-editable-text.h @@ -19,7 +19,7 @@ */ // INTERNAL INCLUDES -#include +#include class BridgeEditableText : public virtual BridgeBase { diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-impl.cpp b/dali/internal/accessibility/bridge/bridge-impl.cpp similarity index 79% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-impl.cpp rename to dali/internal/accessibility/bridge/bridge-impl.cpp index 44daa00..91f68c8 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-impl.cpp +++ b/dali/internal/accessibility/bridge/bridge-impl.cpp @@ -23,14 +23,14 @@ #include // INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace Dali::Accessibility; @@ -125,33 +125,58 @@ public: void Pause() override { - auto r = directReadingClient.method< DBus::ValueOrError< void >( bool ) > ( "PauseResume" ).call( true ); - if (!r) + if (!IsUp()) { - LOG() << "Direct reading command failed (" << r.getError().message << ")"; + return; } + + directReadingClient.method< DBus::ValueOrError< void >( bool ) > ( "PauseResume" ).asyncCall( + []( DBus::ValueOrError< void > msg ) { + if (!msg) + { + LOG() << "Direct reading command failed (" << msg.getError().message << ")"; + } + }, + true); } void Resume() override { - auto r = directReadingClient.method< DBus::ValueOrError< void >( bool ) > ( "PauseResume" ).call( false ); - if (!r) + if (!IsUp()) { - LOG() << "Direct reading command failed (" << r.getError().message << ")"; + return; } + + directReadingClient.method< DBus::ValueOrError< void >( bool ) > ( "PauseResume" ).asyncCall( + []( DBus::ValueOrError< void > msg) { + if (!msg) + { + LOG() << "Direct reading command failed (" << msg.getError().message << ")"; + } + }, + false); } void Say( const std::string& text, bool discardable, std::function< void(std::string) > callback ) override { - auto commandId = directReadingClient.method< DBus::ValueOrError< std::string, bool, int32_t >( std::string, bool ) > ( "ReadCommand" ).call( text, discardable ); - if ( !commandId ) - { - LOG() << "Direct reading command failed (" << commandId.getError().message << ")"; - } - else if( callback ) + if (!IsUp()) { - directReadingCallbacks.emplace( std::get< 2 >( commandId ), callback); + return; } + + directReadingClient.method< DBus::ValueOrError< std::string, bool, int32_t >( std::string, bool ) > ( "ReadCommand" ).asyncCall( + [=]( DBus::ValueOrError msg ) { + if ( !msg ) + { + LOG() << "Direct reading command failed (" << msg.getError().message << ")"; + } + else if( callback ) + { + directReadingCallbacks.emplace( std::get< 2 >( msg ), callback); + } + }, + text, + discardable); } void ForceDown() override @@ -212,7 +237,8 @@ public: if (it != directReadingCallbacks.end()) { it->second( readingState ); - directReadingCallbacks.erase( it ); + if (readingState != "ReadingPaused" && readingState != "ReadingResumed" && readingState != "ReadingStarted") + directReadingCallbacks.erase( it ); } } ); diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-object.cpp b/dali/internal/accessibility/bridge/bridge-object.cpp similarity index 98% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-object.cpp rename to dali/internal/accessibility/bridge/bridge-object.cpp index 6b936fd..2a0d03e 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-object.cpp +++ b/dali/internal/accessibility/bridge/bridge-object.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include @@ -539,12 +539,12 @@ void BridgeObject::EmitTextChanged( Accessible* obj, TextChangedState state, uns const char* stateName = nullptr; switch( state ) { - case TextChangedState::INSERT: + case TextChangedState::INSERTED: { stateName = "insert"; break; } - case TextChangedState::DELETE: + case TextChangedState::DELETED: { stateName = "delete"; break; diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-object.h b/dali/internal/accessibility/bridge/bridge-object.h similarity index 97% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-object.h rename to dali/internal/accessibility/bridge/bridge-object.h index 2f0e572..18fa86b 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-object.h +++ b/dali/internal/accessibility/bridge/bridge-object.h @@ -25,7 +25,7 @@ #include // INTERNAL INCLUDES -#include +#include #include class BridgeObject : public virtual BridgeBase diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-text.cpp b/dali/internal/accessibility/bridge/bridge-text.cpp similarity index 97% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-text.cpp rename to dali/internal/accessibility/bridge/bridge-text.cpp index 5cdb744..0c3ed82 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-text.cpp +++ b/dali/internal/accessibility/bridge/bridge-text.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // INTERNAL INCLUDES #include diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-text.h b/dali/internal/accessibility/bridge/bridge-text.h similarity index 95% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-text.h rename to dali/internal/accessibility/bridge/bridge-text.h index 4fb9eec..f8661a7 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-text.h +++ b/dali/internal/accessibility/bridge/bridge-text.h @@ -19,7 +19,7 @@ */ // INTERNAL INCLUDES -#include +#include class BridgeText : public virtual BridgeBase { diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-value.cpp b/dali/internal/accessibility/bridge/bridge-value.cpp similarity index 96% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-value.cpp rename to dali/internal/accessibility/bridge/bridge-value.cpp index caae344..aa1a34c 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-value.cpp +++ b/dali/internal/accessibility/bridge/bridge-value.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // EXTERNAL INCLUDES #include diff --git a/dali/internal/accessibility/tizen-wayland/atspi/bridge-value.h b/dali/internal/accessibility/bridge/bridge-value.h similarity index 94% rename from dali/internal/accessibility/tizen-wayland/atspi/bridge-value.h rename to dali/internal/accessibility/bridge/bridge-value.h index daa3a95..0fb921f 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/bridge-value.h +++ b/dali/internal/accessibility/bridge/bridge-value.h @@ -26,7 +26,7 @@ #include // INTERNAL INCLUDES -#include +#include class BridgeValue : public virtual BridgeBase { diff --git a/dali/internal/accessibility/tizen-wayland/atspi/component.cpp b/dali/internal/accessibility/bridge/component.cpp similarity index 94% rename from dali/internal/accessibility/tizen-wayland/atspi/component.cpp rename to dali/internal/accessibility/bridge/component.cpp index 2a7dfce..73334a1 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/component.cpp +++ b/dali/internal/accessibility/bridge/component.cpp @@ -21,7 +21,7 @@ #include // INTERNAL INCLUDES -#include +#include using namespace Dali::Accessibility; diff --git a/dali/internal/accessibility/tizen-wayland/atspi/dbus-locators.h b/dali/internal/accessibility/bridge/dbus-locators.h similarity index 100% rename from dali/internal/accessibility/tizen-wayland/atspi/dbus-locators.h rename to dali/internal/accessibility/bridge/dbus-locators.h diff --git a/dali/internal/accessibility/tizen-wayland/atspi/dbus-tizen.cpp b/dali/internal/accessibility/bridge/dbus-tizen.cpp similarity index 99% rename from dali/internal/accessibility/tizen-wayland/atspi/dbus-tizen.cpp rename to dali/internal/accessibility/bridge/dbus-tizen.cpp index c657284..4d236d6 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/dbus-tizen.cpp +++ b/dali/internal/accessibility/bridge/dbus-tizen.cpp @@ -15,8 +15,8 @@ */ // CLASS HEADER -#include -#include +#include +#include // EXTERNAL INCLUDES #include diff --git a/dali/internal/accessibility/tizen-wayland/atspi/dbus.h b/dali/internal/accessibility/bridge/dbus.h similarity index 84% rename from dali/internal/accessibility/tizen-wayland/atspi/dbus.h rename to dali/internal/accessibility/bridge/dbus.h index f9be4e0..f2afcb0 100644 --- a/dali/internal/accessibility/tizen-wayland/atspi/dbus.h +++ b/dali/internal/accessibility/bridge/dbus.h @@ -17,25 +17,27 @@ * limitations under the License. */ - // EXTERNAL INCLUDES -#include +// EXTERNAL INCLUDES #include #include +#include #include +#include +#include #include +#include #include #include +#include #include #include #include #include #include -#include -#include // INTERNAL INCLUDES -#include -#include +#include +#include #define ATSPI_PREFIX_PATH "/org/a11y/atspi/accessible/" #define ATSPI_NULL_PATH "/org/a11y/atspi/null" @@ -537,6 +539,59 @@ namespace DBus */ namespace detail { + inline namespace strings { + template + using char_array = std::array; + + constexpr char *xcopy_n(const char *src, size_t n, char *dst) + { + for (std::size_t i = 0; i < n; ++i) + dst[i] = src[i]; + + return dst + n; + } + + template + constexpr std::size_t xlen(const char (&)[N]) + { + return N - 1; + } + + template + constexpr std::size_t xlen(const char_array &) + { + return N - 1; + } + + template + constexpr auto concat(const Args &... args) + { + char_array<(1U + ... + xlen(args))> arr{}; + char *ptr = arr.data(); + + if constexpr (!arr.empty()) + ((ptr = xcopy_n(std::data(args), xlen(args), ptr)), ...); + + return arr; + } + + template + struct to_chars { + static constexpr const char value[] = {('0' + static_cast(Digits))..., '\0'}; + + static_assert((true && ... && (Digits < 10))); + }; + + template + struct to_chars_helper : to_chars_helper {}; + + template + struct to_chars_helper<0, Digits...> : to_chars {}; + + template + using to_string = to_chars_helper; + } + template < typename T, typename = void > struct signature; template < typename... ARGS > @@ -552,27 +607,34 @@ namespace DBus template < typename A, typename B > struct signature< std::map< A, B > >; - /** - * @brief Signature class for marshalling uint8 type. - */ - template <> - struct signature< uint8_t > + template + struct signature_helper { /** * @brief Returns name of type marshalled, for informative purposes */ - static std::string name() + static constexpr std::string_view name() { - return "uint8_t"; + return {T::name_v.data()}; } /** * @brief Returns DBUS' signature of type marshalled */ - static std::string sig() + static constexpr std::string_view sig() { - return "y"; + return {T::sig_v.data()}; } + }; + + /** + * @brief Signature class for marshalling uint8 type. + */ + template <> + struct signature< uint8_t > : signature_helper> + { + static constexpr auto name_v = concat("uint8_t"); + static constexpr auto sig_v = concat("y"); /** * @brief Marshals value v as marshalled type into message @@ -595,23 +657,10 @@ namespace DBus * @brief Signature class for marshalling uint16 type. */ template <> - struct signature< uint16_t > + struct signature< uint16_t > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "uint16_t"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "q"; - } + static constexpr auto name_v = concat("uint16_t"); + static constexpr auto sig_v = concat("q"); /** * @brief Marshals value v as marshalled type into message @@ -634,23 +683,10 @@ namespace DBus * @brief Signature class for marshalling uint32 type. */ template <> - struct signature< uint32_t > + struct signature< uint32_t > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "uint32_t"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "u"; - } + static constexpr auto name_v = concat("uint32_t"); + static constexpr auto sig_v = concat("u"); /** * @brief Marshals value v as marshalled type into message @@ -673,23 +709,10 @@ namespace DBus * @brief Signature class for marshalling uint64 type. */ template <> - struct signature< uint64_t > + struct signature< uint64_t > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "uint64_t"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "t"; - } + static constexpr auto name_v = concat("uint64_t"); + static constexpr auto sig_v = concat("t"); /** * @brief Marshals value v as marshalled type into message @@ -712,23 +735,10 @@ namespace DBus * @brief Signature class for marshalling int16 type. */ template <> - struct signature< int16_t > + struct signature< int16_t > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "int16_t"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "n"; - } + static constexpr auto name_v = concat("int16_t"); + static constexpr auto sig_v = concat("n"); /** * @brief Marshals value v as marshalled type into message @@ -751,23 +761,10 @@ namespace DBus * @brief Signature class for marshalling int32 type. */ template <> - struct signature< int32_t > + struct signature< int32_t > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "int32_t"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "i"; - } + static constexpr auto name_v = concat("int32_t"); + static constexpr auto sig_v = concat("i"); /** * @brief Marshals value v as marshalled type into message @@ -790,23 +787,10 @@ namespace DBus * @brief Signature class for marshalling int64 type. */ template <> - struct signature< int64_t > + struct signature< int64_t > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "int64_t"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "x"; - } + static constexpr auto name_v = concat("int64_t"); + static constexpr auto sig_v = concat("x"); /** * @brief Marshals value v as marshalled type into message @@ -829,23 +813,10 @@ namespace DBus * @brief Signature class for marshalling double type. */ template <> - struct signature< double > + struct signature< double > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "double"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "d"; - } + static constexpr auto name_v = concat("double"); + static constexpr auto sig_v = concat("d"); /** * @brief Marshals value v as marshalled type into message @@ -879,23 +850,10 @@ namespace DBus * @brief Signature class for marshalling float type. */ template <> - struct signature< float > + struct signature< float > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "float"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "d"; - } + static constexpr auto name_v = concat("float"); + static constexpr auto sig_v = concat("d"); /** * @brief Marshals value v as marshalled type into message @@ -929,23 +887,10 @@ namespace DBus * @brief Signature class for marshalling boolean type. */ template <> - struct signature< bool > + struct signature< bool > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "bool"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "b"; - } + static constexpr auto name_v = concat("bool"); + static constexpr auto sig_v = concat("b"); /** * @brief Marshals value v as marshalled type into message @@ -965,23 +910,10 @@ namespace DBus }; template < typename T > - struct signature< T, typename std::enable_if< std::is_enum< T >::value, void >::type > + struct signature, void>> : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "enum"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return signature::type>::sig(); - } + static constexpr auto name_v = concat("enum"); + static constexpr auto sig_v = signature::type>::sig_v; /** * @brief Marshals value v as marshalled type into message @@ -1012,23 +944,10 @@ namespace DBus * Only std::string is accepted as value to receive. */ template <> - struct signature< std::string > + struct signature< std::string > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "string"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "s"; - } + static constexpr auto name_v = concat("string"); + static constexpr auto sig_v = concat("s"); /** * @brief Marshals value v as marshalled type into message @@ -1048,23 +967,10 @@ namespace DBus }; template <> - struct signature< ObjectPath > + struct signature< ObjectPath > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "path"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "o"; - } + static constexpr auto name_v = concat("path"); + static constexpr auto sig_v = concat("o"); /** * @brief Marshals value v as marshalled type into message @@ -1117,23 +1023,10 @@ namespace DBus * You can't use (const) char * variable type to receive value. */ template <> - struct signature< char* > + struct signature< char* > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "string"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "s"; - } + static constexpr auto name_v = concat("string"); + static constexpr auto sig_v = concat("s"); /** * @brief Marshals value v as marshalled type into message @@ -1172,27 +1065,12 @@ namespace DBus * until INDEX is equal to SIZE, where recursive calling ends. */ template < size_t INDEX, size_t SIZE, typename... ARGS > - struct signature_tuple_helper + struct signature_tuple_helper : signature_helper> { using current_type = typename signature_tuple_element_type_helper< INDEX, ARGS... >::type; - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - if (INDEX + 1 >= SIZE) - return signature< current_type >::name(); - return signature< current_type >::name() + ", " + signature_tuple_helper< INDEX + 1, SIZE, ARGS... >::name(); - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return signature< current_type >::sig() + signature_tuple_helper< INDEX + 1, SIZE, ARGS... >::sig(); - } + static constexpr auto name_v = concat(signature::name_v, ", ", signature_tuple_helper::name_v); + static constexpr auto sig_v = concat(signature::sig_v, signature_tuple_helper::sig_v); /** * @brief Marshals value v as marshalled type into message @@ -1220,23 +1098,10 @@ namespace DBus * when INDEX value is equal to SIZE. */ template < size_t SIZE, typename... ARGS > - struct signature_tuple_helper< SIZE, SIZE, ARGS... > + struct signature_tuple_helper< SIZE, SIZE, ARGS... > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return ""; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return ""; - } + static constexpr auto name_v = concat(""); + static constexpr auto sig_v = concat(""); /** * @brief Marshals value v as marshalled type into message @@ -1261,23 +1126,10 @@ namespace DBus * DBUS struct typle, encoded with character 'r' */ template < typename... ARGS > - struct signature< std::tuple< ARGS... > > + struct signature< std::tuple< ARGS... > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "tuple<" + signature_tuple_helper< 0, sizeof...(ARGS), ARGS... >::name() + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "(" + signature_tuple_helper< 0, sizeof...(ARGS), ARGS... >::sig() + ")"; - } + static constexpr auto name_v = concat("tuple<", signature_tuple_helper<0, sizeof...(ARGS), ARGS...>::name_v, ">"); + static constexpr auto sig_v = concat("(", signature_tuple_helper<0, sizeof...(ARGS), ARGS...>::sig_v, ")"); /** * @brief Marshals value v as marshalled type into message @@ -1311,23 +1163,10 @@ namespace DBus * \code{.cpp} ValueOrError>> \endcode */ template < typename... ARGS > - struct signature< ValueOrError< ARGS... > > + struct signature< ValueOrError< ARGS... > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "ValueOrError<" + signature_tuple_helper< 0, sizeof...(ARGS), ARGS... >::name() + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return signature_tuple_helper< 0, sizeof...(ARGS), ARGS... >::sig(); - } + static constexpr auto name_v = concat("ValueOrError<", signature_tuple_helper<0, sizeof...(ARGS), ARGS...>::name_v, ">"); + static constexpr auto sig_v = signature_tuple_helper<0, sizeof...(ARGS), ARGS...>::sig_v; /** * @brief Marshals value v as marshalled type into message @@ -1350,23 +1189,10 @@ namespace DBus * @brief Signature class for marshalling ValueOrError type */ template <> - struct signature< ValueOrError< void > > + struct signature< ValueOrError< void > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "ValueOrError"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return ""; - } + static constexpr auto name_v = concat("ValueOrError"); + static constexpr auto sig_v = concat(""); /** * @brief Marshals value v as marshalled type into message @@ -1388,23 +1214,10 @@ namespace DBus * @brief Signature class for marshalling ValueOrError<> type */ template <> - struct signature< ValueOrError<> > + struct signature< ValueOrError<> > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "ValueOrError<>"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return ""; - } + static constexpr auto name_v = concat("ValueOrError<>"); + static constexpr auto sig_v = concat(""); /** * @brief Marshals value v as marshalled type into message @@ -1426,23 +1239,10 @@ namespace DBus * @brief Signature class for marshalling pair of types */ template < typename A, typename B > - struct signature< std::pair< A, B > > + struct signature< std::pair< A, B > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "pair<" + signature_tuple_helper< 0, 2, A, B >::name() + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "(" + signature_tuple_helper< 0, 2, A, B >::sig() + ")"; - } + static constexpr auto name_v = concat("pair<", signature_tuple_helper<0, 2, A, B>::name_v, ">"); + static constexpr auto sig_v = concat("(", signature_tuple_helper<0, 2, A, B>::sig_v, ")"); /** * @brief Marshals value v as marshalled type into message @@ -1481,30 +1281,17 @@ namespace DBus * This marshals container's content as DBUS a ascii character type code. */ template < typename A > - struct signature< std::vector< A > > + struct signature< std::vector< A > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "vector<" + signature< A >::name() + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "a" + signature< A >::sig(); - } + static constexpr auto name_v = concat("vector<", signature::name_v, ">"); + static constexpr auto sig_v = concat("a", signature::sig_v); /** * @brief Marshals value v as marshalled type into message */ static void set(const DBusWrapper::MessageIterPtr& iter, const std::vector< A >& v) { - auto lst = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'a', signature< A >::sig()); + auto lst = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'a', std::string{signature< A >::sig()}); assert(lst); for (auto& a : v) { @@ -1534,30 +1321,17 @@ namespace DBus * This marshals container's content as DBUS a ascii character type code. */ template < typename A, size_t N > - struct signature< std::array< A, N > > + struct signature< std::array< A, N > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "array<" + signature< A >::name() + ", " + std::to_string(N) + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "a" + signature< A >::sig(); - } + static constexpr auto name_v = concat("array<", signature::name_v, ", ", to_string::value, ">"); + static constexpr auto sig_v = concat("a", signature::sig_v); /** * @brief Marshals value v as marshalled type into message */ static void set(const DBusWrapper::MessageIterPtr& iter, const std::array< A, N >& v) { - auto lst = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'a', signature< A >::sig()); + auto lst = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'a', std::string{signature< A >::sig()}); assert(lst); for (auto& a : v) { @@ -1588,23 +1362,10 @@ namespace DBus * This marshals variant's content as DBUS v ascii character type code. */ template < typename A > - struct signature< EldbusVariant< A > > + struct signature< EldbusVariant< A > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "variant<" + signature< A >::name() + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "v"; - } + static constexpr auto name_v = concat("variant<", signature::name_v, ">"); + static constexpr auto sig_v = concat("v"); /** * @brief Marshals value v as marshalled type into message @@ -1619,7 +1380,7 @@ namespace DBus */ static void set(const DBusWrapper::MessageIterPtr& iter, const A& v) { - auto var = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'v', signature< A >::sig()); + auto var = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'v', std::string{signature< A >::sig()}); signature< A >::set(var, v); } @@ -1646,30 +1407,17 @@ namespace DBus * Order of such values is unspecified. */ template < typename A, typename B > - struct signature< std::unordered_map< A, B > > + struct signature< std::unordered_map< A, B > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "unordered_map<" + signature< A >::name() + ", " + signature< B >::name() + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "a{" + signature_tuple_helper< 0, 2, A, B >::sig() + "}"; - } + static constexpr auto name_v = concat("unordered_map<", signature::name_v, ", ", signature::name_v, ">"); + static constexpr auto sig_v = concat("a{", signature_tuple_helper<0, 2, A, B>::sig_v, "}"); /** * @brief Marshals value v as marshalled type into message */ static void set(const DBusWrapper::MessageIterPtr& iter, const std::unordered_map< A, B >& v) { - auto sig = "{" + signature_tuple_helper< 0, 2, A, B >::sig() + "}"; + auto sig = "{" + std::string{signature_tuple_helper< 0, 2, A, B >::sig()} + "}"; auto lst = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'a', sig); assert(lst); for (auto& a : v) @@ -1705,30 +1453,17 @@ namespace DBus * Order of such values is unspecified. */ template < typename A, typename B > - struct signature< std::map< A, B > > + struct signature< std::map< A, B > > : signature_helper>> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "map<" + signature< A >::name() + ", " + signature< B >::name() + ">"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return "a{" + signature_tuple_helper< 0, 2, A, B >::sig() + "}"; - } + static constexpr auto name_v = concat("map<", signature::name_v, ", ", signature::name_v, ">"); + static constexpr auto sig_v = concat("a{", signature_tuple_helper<0, 2, A, B>::sig_v, "}"); /** * @brief Marshals value v as marshalled type into message */ static void set(const DBusWrapper::MessageIterPtr& iter, const std::map< A, B >& v) { - auto sig = "{" + signature_tuple_helper< 0, 2, A, B >::sig() + "}"; + auto sig = "{" + std::string{signature_tuple_helper< 0, 2, A, B >::sig()} + "}"; auto lst = DBUS_W->eldbus_message_iter_container_new_impl(iter, 'a', sig); assert(lst); for (auto& a : v) @@ -1756,23 +1491,10 @@ namespace DBus * @brief Signature helper class for marshalling const reference types */ template < typename A > - struct signature< const A& > + struct signature< const A& > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "const " + signature< A >::name() + "&"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return signature< A >::sig(); - } + static constexpr auto name_v = concat("const ", signature::name_v, "&"); + static constexpr auto sig_v = signature::sig_v; /** * @brief Marshals value v as marshalled type into message @@ -1795,23 +1517,10 @@ namespace DBus * @brief Signature helper class for marshalling reference types */ template < typename A > - struct signature< A& > + struct signature< A& > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return signature< A >::name() + "&"; - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return signature< A >::sig(); - } + static constexpr auto name_v = concat(signature::name_v, "&"); + static constexpr auto sig_v = signature::sig_v; /** * @brief Marshals value v as marshalled type into message @@ -1834,23 +1543,10 @@ namespace DBus * @brief Signature helper class for marshalling const types */ template < typename A > - struct signature< const A > + struct signature< const A > : signature_helper> { - /** - * @brief Returns name of type marshalled, for informative purposes - */ - static std::string name() - { - return "const " + signature< A >::name(); - } - - /** - * @brief Returns DBUS' signature of type marshalled - */ - static std::string sig() - { - return signature< A >::sig(); - } + static constexpr auto name_v = concat("const ", signature::name_v); + static constexpr auto sig_v = signature::sig_v; /** * @brief Marshals value v as marshalled type into message @@ -1874,6 +1570,8 @@ namespace DBus template < typename ValueType > ValueType unpackValues(CallId callId, const DBusWrapper::MessagePtr& msg) { + static const std::string sig{signature< ValueType >::sig().data()}; + auto iter = DBUS_W->eldbus_message_iter_get_impl(msg, false); ValueType r; @@ -1881,9 +1579,9 @@ namespace DBus { if (!signature< ValueType >::get(iter, r)) { - DBUS_DEBUG("ValueType is %s", signature< ValueType >::name().c_str()); + DBUS_DEBUG("ValueType is %s", signature< ValueType >::name().data()); r = Error{ "call " + std::to_string(callId.id) + ": failed to unpack values, got signature '" + - DBUS_W->eldbus_message_signature_get_impl(msg) + "', expected '" + signature< ValueType >::sig() + "'" }; + DBUS_W->eldbus_message_signature_get_impl(msg) + "', expected '" + sig + "'" }; } } else @@ -1909,85 +1607,6 @@ namespace DBus packValues_helper(iter, std::forward< ARGS >(r)...); } - template < typename > - struct ReturnType; - template < typename R, typename... ARGS > - struct ReturnType< R(ARGS...) > - { - using type = R; - }; - - template < typename R, typename... ARGS > - struct ReturnType< std::function< R(ARGS...) > > - { - using type = R; - }; - - template < int... > - struct sequence - { - }; - - template < int N, int... S > - struct sequence_gen : sequence_gen< N - 1, N - 1, S... > - { - }; - - template < int... S > - struct sequence_gen< 0, S... > - { - typedef sequence< S... > type; - }; - - template < typename C, typename... ARGS > - struct apply_helper - { - const std::function< C >& c; - const std::tuple< ARGS... >& args; - - template < int... S > - auto apply_2(sequence< S... >) const -> decltype(c(std::get< S >(args)...)) - { - return c(std::get< S >(args)...); - } - auto apply_1() const -> decltype(apply_2(typename sequence_gen< sizeof...(ARGS) >::type())) - { - return apply_2(typename sequence_gen< sizeof...(ARGS) >::type()); - } - }; - - template < typename C, typename A, typename... ARGS > - struct apply_helper_2 - { - const std::function< C >& c; - const A& a; - const std::tuple< ARGS... >& args; - - template < int... S > - auto apply_2(sequence< S... >) const -> decltype(c(a, std::get< S >(args)...)) - { - return c(a, std::get< S >(args)...); - } - auto apply_1() const -> decltype(apply_2(typename sequence_gen< sizeof...(ARGS) >::type())) - { - return apply_2(typename sequence_gen< sizeof...(ARGS) >::type()); - } - }; - - template < typename C, typename... ARGS > - auto apply(const std::function< C >& c, const std::tuple< ARGS... >& args) -> typename ReturnType< C >::type - { - apply_helper< C, ARGS... > ah{ c, args }; - return ah.apply_1(); - } - - template < typename C, typename D, typename... ARGS > - auto apply(const std::function< C >& c, const D& d, const std::tuple< ARGS... >& args) -> typename ReturnType< C >::type - { - apply_helper_2< C, D, ARGS... > ah{ c, d, args }; - return ah.apply_1(); - } - struct ConnectionState { DBusWrapper::ConnectionPtr connection; @@ -2113,7 +1732,7 @@ namespace DBus static void add(std::vector< std::pair >& r) { auto s = r.size(); - auto sig = signature< A >::sig(); + auto sig = std::string{signature< A >::sig()}; assert(!sig.empty()); auto name = "p" + std::to_string(s + 1); r.push_back({ std::move(sig), std::move(name) }); @@ -2183,7 +1802,7 @@ namespace DBus { static std::string name() { - return signature_tuple_helper< 0, sizeof...(ARGS), ARGS... >::name(); + return std::string{signature_tuple_helper< 0, sizeof...(ARGS), ARGS... >::name()}; } static std::vector< std::pair > get() { @@ -2200,7 +1819,7 @@ namespace DBus { static std::string name() { - return signature< RetType >::name(); + return std::string{signature< RetType >::name()}; } static std::vector< std::pair > get() { @@ -2513,9 +2132,9 @@ namespace DBus } try { - detail::apply(callback, params.getValues()); + std::apply(callback, params.getValues()); } - catch (...) + catch (const Dali::DaliException &e) { DBUS_DEBUG("unhandled exception"); assert(0); @@ -2614,11 +2233,11 @@ namespace DBus { detail::CallId getterId; z.getterId = getterId; - DBUS_DEBUG("call %d: property %s (get) type %s", getterId.id, memberName.c_str(), detail::signature< T >::name().c_str()); + DBUS_DEBUG("call %d: property %s (get) type %s", getterId.id, memberName.c_str(), detail::signature< T >::name().data()); z.getCallback = [=](const DBusWrapper::MessagePtr& src, const DBusWrapper::MessageIterPtr& dst) -> std::string { try { - auto v = detail::apply(getter, std::tuple<>{}); + auto v = std::apply(getter, std::tuple<>{}); if (v) { detail::signature< T >::set(dst, std::get< 0 >(v.getValues())); @@ -2632,9 +2251,9 @@ namespace DBus { return std::string("unhandled exception (") + e.what() + ")"; } - catch (...) + catch (const Dali::DaliException &e) { - return "unhandled exception"; + return std::string("unhandled exception (") + e.condition + ")"; } }; } @@ -2642,7 +2261,7 @@ namespace DBus { detail::CallId setterId; z.setterId = setterId; - DBUS_DEBUG("call %d: property %s (set) type %s", setterId.id, memberName.c_str(), detail::signature< T >::name().c_str()); + DBUS_DEBUG("call %d: property %s (set) type %s", setterId.id, memberName.c_str(), detail::signature< T >::name().data()); z.setCallback = [=](const DBusWrapper::MessagePtr& src, const DBusWrapper::MessageIterPtr& src_iter) -> std::string { std::tuple< T > value; auto src_signature = DBUS_W->eldbus_message_iter_signature_get_impl(src_iter); @@ -2650,7 +2269,7 @@ namespace DBus { try { - auto v = detail::apply(setter, std::move(value)); + auto v = std::apply(setter, std::move(value)); if (v) { DBUS_DEBUG("call %d: success", setterId.id); @@ -2663,15 +2282,15 @@ namespace DBus { return std::string("unhandled exception (") + e.what() + ")"; } - catch (...) + catch (const Dali::DaliException &e) { - return "unhandled exception"; + return std::string("unhandled exception (") + e.condition + ")"; } } DBUS_DEBUG("call %d: failed to unpack values, got signature '%s', expected '%s'", setterId.id, - src_signature.c_str(), detail::signature< T >::sig().c_str()); + src_signature.c_str(), detail::signature< T >::sig().data()); return "call " + std::to_string(setterId.id) + ": failed to unpack values, got signature '" + - src_signature + "', expected '" + detail::signature< T >::sig() + "'"; + src_signature + "', expected '" + std::string{detail::signature< T >::sig()} + "'"; }; } } @@ -2715,7 +2334,7 @@ namespace DBus { try { - auto v = detail::apply(callback, std::move(args.getValues())); + auto v = std::apply(callback, std::move(args.getValues())); if (v) { DBUS_DEBUG("call %d: success", callId.id); @@ -2734,10 +2353,11 @@ namespace DBus DBUS_DEBUG("call %d: failed: %s", callId.id, txt.c_str()); ret = DBUS_W->eldbus_message_error_new_impl(msg, "org.freedesktop.DBus.Error.Failed", txt); } - catch (...) + catch (const Dali::DaliException &e) { - DBUS_DEBUG("call %d: failed: %s", callId.id, "unhandled exception"); - ret = DBUS_W->eldbus_message_error_new_impl(msg, "org.freedesktop.DBus.Error.Failed", "unhandled exception"); + auto txt = std::string("unhandled exception (") + e.condition + ")"; + DBUS_DEBUG("call %d: failed: %s", callId.id, txt.c_str()); + ret = DBUS_W->eldbus_message_error_new_impl(msg, "org.freedesktop.DBus.Error.Failed", txt); } } else diff --git a/dali/internal/accessibility/bridge/dummy-atspi.cpp b/dali/internal/accessibility/bridge/dummy-atspi.cpp new file mode 100644 index 0000000..252628c --- /dev/null +++ b/dali/internal/accessibility/bridge/dummy-atspi.cpp @@ -0,0 +1,256 @@ +/* + * Copyright (c) 2020 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. + * + */ + +#include +#include + +namespace Dali { +namespace { + +struct DummyBridge : Dali::Accessibility::Bridge +{ + const std::string& GetBusName() const override + { + static const std::string name = ""; + return name; + } + + void AddTopLevelWindow(Accessibility::Accessible *) override + { + } + + void RemoveTopLevelWindow(Accessibility::Accessible *) override + { + } + + void AddPopup(Accessibility::Accessible *) override + { + } + + void RemovePopup(Accessibility::Accessible *) override + { + } + + void SetApplicationName(std::string) override + { + } + + Accessibility::Accessible *GetApplication() const override + { + return nullptr; + } + + Accessibility::Accessible *FindByPath(const std::string& s) const override + { + return nullptr; + } + + void ApplicationShown() override + { + } + + void ApplicationHidden() override + { + } + + void Initialize() override + { + } + + void Terminate() override + { + } + + ForceUpResult ForceUp() override + { + return ForceUpResult::JUST_STARTED; + } + + void ForceDown() override + { + } + + void EmitCaretMoved(Accessibility::Accessible *obj, unsigned int cursorPosition) override + { + } + + void EmitActiveDescendantChanged(Accessibility::Accessible *obj, Accessibility::Accessible *child) override + { + } + + void EmitTextChanged(Accessibility::Accessible *obj, Accessibility::TextChangedState state, unsigned int position, unsigned int length, const std::string &content) override + { + } + + void EmitStateChanged(Accessibility::Accessible *obj, Accessibility::State state, int val1, int val2) override + { + } + + void Emit(Accessibility::Accessible *obj, Accessibility::WindowEvent we, unsigned int detail1) override + { + } + + void Emit(Accessibility::Accessible *obj, Accessibility::ObjectPropertyChangeEvent event) override + { + } + + void EmitBoundsChanged(Accessibility::Accessible *obj, Rect<> rect) override + { + } + + Accessibility::Consumed Emit(Accessibility::KeyEventType type, unsigned int keyCode, const std::string& keyName, unsigned int timeStamp, bool isText) override + { + return Accessibility::Consumed::YES; + } + + void Say( const std::string& text, bool discardable, std::function callback ) override + { + } + + void Pause() override + { + } + + void Resume() override + { + } + + bool GetScreenReaderEnabled() override + { + return false; + } + + bool GetIsEnabled() override + { + return false; + } +}; + +DummyBridge dummyBridge; + +} // namespace + +Accessibility::Accessible::Accessible() +{ +} + +Accessibility::Accessible::~Accessible() +{ +} + +std::vector Accessibility::Accessible::GetChildren() +{ + return {}; +} + +Accessibility::Accessible *Accessibility::Accessible::GetDefaultLabel() +{ + return nullptr; +} + +Accessibility::Address Accessibility::Accessible::GetAddress() +{ + return {}; +} + +std::shared_ptr< Accessibility::Bridge::Data > Accessibility::Accessible::GetBridgeData() +{ + return {}; +} + +bool Accessibility::Accessible::IsProxy() +{ + return false; +} + +bool Accessibility::Component::IsScrollable() +{ + return false; +} + +bool Accessibility::Component::Contains(Point p, CoordType ctype) +{ + return false; +} + +Accessibility::Accessible *Accessibility::Component::GetAccessibleAtPoint(Accessibility::Point p, Accessibility::CoordType ctype) +{ + return nullptr; +} + +Accessibility::Bridge *Accessibility::Bridge::GetCurrentBridge() +{ + return &dummyBridge; +} + +void Accessibility::Accessible::EmitStateChanged(Accessibility::State state, int newValue1, int newValue2) +{ +} + +void Accessibility::Accessible::Emit(Accessibility::ObjectPropertyChangeEvent event) +{ +} + +void Accessibility::Accessible::EmitHighlighted(bool set) +{ +} + +void Accessibility::Accessible::EmitBoundsChanged(Rect<> rect) +{ +} + +void Accessibility::Accessible::EmitShowing(bool showing) +{ +} + +void Accessibility::Accessible::EmitFocused(bool set) +{ +} + +void Accessibility::Accessible::EmitVisible(bool visible) +{ +} + +void Accessibility::Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string &content) +{ +} + +void Accessibility::Accessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string &content) +{ +} + +void Accessibility::Accessible::EmitTextCaretMoved(unsigned int cursorPosition) +{ +} + +void Accessibility::Accessible::EmitActiveDescendantChanged(Accessibility::Accessible* obj, Accessibility::Accessible *child) +{ +} + +void Accessibility::Accessible::FindWordSeparationsUtf8(const utf8_t *s, size_t length, const char *language, char *breaks) +{ +} + +void Accessibility::Accessible::FindLineSeparationsUtf8(const utf8_t *s, size_t length, const char *language, char *breaks) +{ +} + +void Accessibility::Accessible::NotifyAccessibilityStateChange(Accessibility::States states, bool doRecursive) +{ +} + +} // namespace Dali diff --git a/dali/internal/accessibility/common/accessibility-adaptor-impl.cpp b/dali/internal/accessibility/common/accessibility-adaptor-impl.cpp deleted file mode 100644 index aed44c7..0000000 --- a/dali/internal/accessibility/common/accessibility-adaptor-impl.cpp +++ /dev/null @@ -1,490 +0,0 @@ -/* - * Copyright (c) 2020 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 - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include - -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 touch = Integration::NewTouchEvent( timeStamp, point ); - ret = mActionHandler->AccessibilityActionScroll( touch ); - } - - Integration::TouchEvent touchEvent; - Integration::HoverEvent hoverEvent; - Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent( Integration::Point( point ), timeStamp, touchEvent, hoverEvent ); - if( type == Integration::TouchEventCombiner::DISPATCH_TOUCH || type == Integration::TouchEventCombiner::DISPATCH_BOTH ) // hover event is ignored - { - // Process the touch event in accessibility gesture detector - if( mAccessibilityGestureDetector ) - { - mAccessibilityGestureDetector->SendEvent( touchEvent ); - ret = true; - } - } - - 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 diff --git a/dali/internal/accessibility/common/accessibility-adaptor-impl.h b/dali/internal/accessibility/common/accessibility-adaptor-impl.h deleted file mode 100644 index 29cbb08..0000000 --- a/dali/internal/accessibility/common/accessibility-adaptor-impl.h +++ /dev/null @@ -1,289 +0,0 @@ -#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 - -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include - -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::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. - */ - ~AccessibilityAdaptor() override; - -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(handle); - } - - inline static const Internal::Adaptor::AccessibilityAdaptor& GetImplementation(const Dali::AccessibilityAdaptor& adaptor) - { - DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptor handle is empty" ); - - const BaseObject& handle = adaptor.GetBaseObject(); - - return static_cast(handle); - } - -}; - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali - -#endif // DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_H diff --git a/dali/internal/accessibility/common/accessibility-gesture-detector.cpp b/dali/internal/accessibility/common/accessibility-gesture-detector.cpp deleted file mode 100644 index 18ae7c1..0000000 --- a/dali/internal/accessibility/common/accessibility-gesture-detector.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* - * 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 - -// EXTERNAL INCLUDES -#include -#include - - -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( 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( 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( 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( mThresholdAdjustmentsRemaining ); - } - - mPreviousPosition = gesture.currentPosition; - } - else - { - gesture.previousPosition = gesture.currentPosition; - gesture.timeDelta = 0; - } - - gesture.time = currentEvent.time; - - EmitPan(gesture); -} - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/accessibility/common/accessibility-gesture-detector.h b/dali/internal/accessibility/common/accessibility-gesture-detector.h deleted file mode 100644 index aa6bc54..0000000 --- a/dali/internal/accessibility/common/accessibility-gesture-detector.h +++ /dev/null @@ -1,134 +0,0 @@ -#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 -#include -#include - -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. - */ - ~AccessibilityGestureDetector() override; - - /** - * 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 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; - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali - -#endif // DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H diff --git a/dali/internal/accessibility/file.list b/dali/internal/accessibility/file.list index d2ff157..30f853a 100755 --- a/dali/internal/accessibility/file.list +++ b/dali/internal/accessibility/file.list @@ -3,72 +3,66 @@ SET( adaptor_accessibility_common_src_files ${adaptor_accessibility_dir}/common/tts-player-factory.cpp ${adaptor_accessibility_dir}/common/tts-player-impl.cpp - ${adaptor_accessibility_dir}/common/accessibility-adaptor-impl.cpp - ${adaptor_accessibility_dir}/common/accessibility-gesture-detector.cpp ) # module: accessibility, backend: tizen-wayland SET( 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 - ${adaptor_accessibility_dir}/tizen-wayland/atspi/atspi-accessibility-tizen.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/accessibility-impl.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/accessible.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-accessible.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-action.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-base.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-collection.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-component.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-editable-text.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-impl.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-object.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-text.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/bridge-value.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/component.cpp - ${adaptor_accessibility_dir}/tizen-wayland/atspi/dbus-tizen.cpp ) # module: accessibility, backend: tizen-common profile SET( adaptor_accessibility_tizen_common_src_files - ${adaptor_accessibility_dir}/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp ) # module: accessibility, backend: tizen-ivi profile SET( adaptor_accessibility_tizen_ivi_src_files - ${adaptor_accessibility_dir}/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp ) # module: accessibility, backend: tizen-mobile profile SET( adaptor_accessibility_tizen_mobile_src_files - ${adaptor_accessibility_dir}/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp ) # module: accessibility, backend: tizen-tv profile SET( adaptor_accessibility_tizen_tv_src_files - ${adaptor_accessibility_dir}/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp ) # module: accessibility, backend: tizen-wearable profile SET( adaptor_accessibility_tizen_wearable_src_files - ${adaptor_accessibility_dir}/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp ) # module: accessibility, backend: ubuntu SET( adaptor_accessibility_ubuntu_src_files - ${adaptor_accessibility_dir}/generic/accessibility-adaptor-impl-generic.cpp - ${adaptor_accessibility_dir}/generic/atspi-accessibility-generic.cpp ${adaptor_accessibility_dir}/generic/tts-player-factory-generic.cpp ${adaptor_accessibility_dir}/generic/tts-player-impl-generic.cpp ) # module: accessibility, backend: android SET( adaptor_accessibility_android_src_files - ${adaptor_accessibility_dir}/generic/accessibility-adaptor-impl-generic.cpp ${adaptor_accessibility_dir}/generic/tts-player-factory-generic.cpp ${adaptor_accessibility_dir}/generic/tts-player-impl-generic.cpp ) # module: accessibility, backend: windows SET( adaptor_accessibility_windows_src_files - ${adaptor_accessibility_dir}/generic/accessibility-adaptor-impl-generic.cpp +) + +SET( adaptor_accessibility_atspi_bridge_src_files + ${adaptor_accessibility_dir}/bridge/accessible.cpp + ${adaptor_accessibility_dir}/bridge/bridge-accessible.cpp + ${adaptor_accessibility_dir}/bridge/bridge-action.cpp + ${adaptor_accessibility_dir}/bridge/bridge-base.cpp + ${adaptor_accessibility_dir}/bridge/bridge-collection.cpp + ${adaptor_accessibility_dir}/bridge/bridge-component.cpp + ${adaptor_accessibility_dir}/bridge/bridge-editable-text.cpp + ${adaptor_accessibility_dir}/bridge/bridge-impl.cpp + ${adaptor_accessibility_dir}/bridge/bridge-object.cpp + ${adaptor_accessibility_dir}/bridge/bridge-text.cpp + ${adaptor_accessibility_dir}/bridge/bridge-value.cpp + ${adaptor_accessibility_dir}/bridge/component.cpp + ${adaptor_accessibility_dir}/bridge/dbus-tizen.cpp +) + +SET( adaptor_accessibility_atspi_dummy_src_files + ${adaptor_accessibility_dir}/bridge/dummy-atspi.cpp ) diff --git a/dali/internal/accessibility/generic/accessibility-adaptor-impl-generic.cpp b/dali/internal/accessibility/generic/accessibility-adaptor-impl-generic.cpp deleted file mode 100644 index 62cfcbf..0000000 --- a/dali/internal/accessibility/generic/accessibility-adaptor-impl-generic.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 - -// EXTERNAL INCLUDES -#include -#include - -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 diff --git a/dali/internal/accessibility/generic/atspi-accessibility-generic.cpp b/dali/internal/accessibility/generic/atspi-accessibility-generic.cpp deleted file mode 100755 index f606d01..0000000 --- a/dali/internal/accessibility/generic/atspi-accessibility-generic.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - * - */ - -#include -#include -#include - -void Dali::AtspiAccessibility::Pause() -{ - DALI_LOG_ERROR("[ERROR] This is NOT supported\n"); -} - -void Dali::AtspiAccessibility::Resume() -{ - DALI_LOG_ERROR("[ERROR] This is NOT supported\n"); -} - -void Dali::AtspiAccessibility::Say( const std::string &text, bool discardable, std::function callback ) -{ - DALI_LOG_ERROR("[ERROR] This is NOT supported\n"); -} - -int Dali::AtspiAccessibility::SetForcefully( bool turnOn ) -{ - DALI_LOG_ERROR("[ERROR] This is NOT supported\n"); - return -1; -} - -int Dali::AtspiAccessibility::GetStatus() -{ - DALI_LOG_ERROR("[ERROR] This is NOT supported\n"); - return -1; -} diff --git a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-optional.h b/dali/internal/accessibility/tizen-wayland/atspi/accessibility-optional.h deleted file mode 100644 index d7abacd..0000000 --- a/dali/internal/accessibility/tizen-wayland/atspi/accessibility-optional.h +++ /dev/null @@ -1,280 +0,0 @@ -#ifndef DALI_INTERNAL_ATSPI_ACCESSIBILITY_OPTIONAL_H -#define DALI_INTERNAL_ATSPI_ACCESSIBILITY_OPTIONAL_H - -/* - * Copyright 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 -#include -#include -#include - -/** - * Minimalistic implementation of standard library std::optional (c++17) for c++11 compiler. - * - * After project conversion to C++17 standard, this template class will be deleted and - * Optional will point to std::optional. - * - * Allowed operations (note, to make code simplier, than original, value class must have accessible copy and move constructor): - * - constructing empty (valueless) object - * - copying Optional (with and without value) - * - moving Optional (with and without value) - * - querying, if Optional has value (via explicit operator bool), for example: - * Optional v = ...; - * if (v) ... // if v has value, then do something - * - accessing value (via operator *), for example: - * Optional v = ...; - * auto z = *v; // z now has the same int, as v (copied) - * auto &y = *v; // y now has REFERENCE to int inside v, so modifying y modifies v - */ - -template < typename A > -class Optional -{ - union - { - A place; - }; - bool hasValue = false; - -public: - /** - * @brief Empty constructor. - * Creates empty Optional object, which will be false in boolean context. - * So: - * \code{.cpp} - * Optional o; - * if (o) printf("1\n"); - * \endcode - * won't print 1. - */ - Optional() {} - - /** - * @brief Single element constructor, when implicit convertion can be applied. - * This constructor will be selected, when type of given argument (U) is - * implicitly convertable to expected type A. In other words following - * code must be valid: - * \code{.cpp} - * A foo() { - * return U(); - * } - * \endcode - * @param a value held by Optional object will be initialized from a. - */ - template < typename U = A, typename std::enable_if< - std::is_convertible< U&&, A >::value && - std::is_constructible< A, U&& >::value && - !std::is_same< typename std::decay< U >::type, Optional< A > >::value, - int* >::type = nullptr > - constexpr Optional( U&& a ) - : place( std::forward< U >( a ) ), - hasValue( true ) - { - } - - /** - * @brief Single element constructor, when only explicit convertion can be applied. - * This constructor will be selected, when type of given argument (U) is - * convertable to expected type A. - * @param a value held by Optional object will be initialized from a. - */ - template < typename U = A, typename std::enable_if< - !std::is_convertible< U&&, A >::value && - std::is_constructible< A, U&& >::value && - !std::is_same< typename std::decay< U >::type, Optional< A > >::value, - int* >::type = nullptr > - explicit constexpr Optional( U&& a ) - : place( std::forward< U >( a ) ), - hasValue( true ) - { - } - - /** - * @brief Copy constructor. - * @param v Optional value to copy from. Will cause to copy data held by object v, - * if v has data. - */ - Optional( const Optional& v ) : hasValue( v.hasValue ) - { - if( hasValue ) - { - new( &place ) A( v.place ); - } - } - - /** - * @brief Move constructor. - * @param v Optional value to copy from. Will move data help by v, if any. - * After construction \code{.cpp} bool(v) \endcode will be false. - */ - Optional( Optional&& v ) : hasValue( v.hasValue ) - { - if( hasValue ) - { - new( &place ) A( std::move( v.place ) ); - } - } - - /** - * @brief Destructor. - */ - ~Optional() - { - if( hasValue ) - { - place.~A(); - } - } - - /** - * @brief Explicit bool operator - * Will return true if and only if object is helding data. - */ - explicit operator bool() const - { - return hasValue; - } - - /** - * @brief Accessor (*) operator - * Will return modifiable reference to held object. Will assert, if not object is held. - */ - A& operator*() - { - assert( hasValue ); - return place; - } - - /** - * @brief Accessor (*) const operator - * Will return const reference to held object. Will assert, if not object is held. - */ - const A& operator*() const - { - assert( hasValue ); - return place; - } - - /** - * @brief Accessor (->) operator - * Will return pointer to held object allowing access to the value's members. - * Will assert, if not object is held. - */ - A* operator->() - { - assert( hasValue ); - return &place; - } - - /** - * @brief Accessor (->) operator - * Will return pointer to (const) held object allowing access to the value's members. - * Will assert, if not object is held. - */ - const A* operator->() const - { - assert( hasValue ); - return &place; - } - - /** - * @brief Assignment operator - * Will copy held value from v, if any. - * @param v Value to copy from - */ - Optional& operator=( const Optional& v ) - { - if( this != &v ) - { - if( hasValue != v.hasValue ) - { - if( v.hasValue ) - { - new( &place ) A( v.place ); - } - else - { - place.~A(); - } - hasValue = v.hasValue; - } - else if( hasValue ) - { - place = v.place; - } - } - return *this; - } - - /** - * @brief Assignment move operator - * Will move held value from v, if any. In all cases v won't held a value - * after assignment is done. - * @param v Value to copy from - */ - Optional& operator=( Optional&& v ) - { - if( this != &v ) - { - if( hasValue != v.hasValue ) - { - if( v.hasValue ) - { - new( &place ) A( std::move( v.place ) ); - } - else - { - place.~A(); - } - hasValue = v.hasValue; - } - else if( hasValue ) - { - place = std::move( v.place ); - } - } - return *this; - } - - /** - * @brief Assignment operator from value of type held. - * Will initialize held value from given parameter a. - * Type of the parameter must be the same (barring cv convertions), - * as the type of the value held. - * @param a Value to copy from - */ - template < class U, class = typename std::enable_if< - std::is_same< typename std::remove_reference< U >::type, A >::value && - std::is_constructible< A, U >::value && - std::is_assignable< A&, U >::value >::type > - Optional& operator=( U&& a ) - { - if( hasValue ) - { - place = std::forward< U >( a ); - } - else - { - hasValue = true; - new( &place ) A( std::forward< U >( a ) ); - } - return *this; - } -}; - -#endif // DALI_INTERNAL_ATSPI_ACCESSIBILITY_OPTIONAL_H diff --git a/dali/internal/accessibility/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp b/dali/internal/accessibility/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp deleted file mode 100644 index b2418f8..0000000 --- a/dali/internal/accessibility/tizen-wayland/tizen-common/accessibility-adaptor-impl-tizen.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 - -// EXTERNAL INCLUDES -#include - -#include -#include -#include - -// INTERNAL INCLUDES -#include - -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(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( 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 diff --git a/dali/internal/accessibility/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp b/dali/internal/accessibility/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp deleted file mode 100644 index 95f8809..0000000 --- a/dali/internal/accessibility/tizen-wayland/tizen-ivi/accessibility-adaptor-impl-ivi.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * 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 - -// EXTERNAL INCLUDES -#include - -#ifndef WAYLAND -#include -#include -#endif - -#include - -#include -#include -#include - -// INTERNAL INCLUDES -#include - -#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( 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 diff --git a/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp b/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp deleted file mode 100644 index 95f8809..0000000 --- a/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * 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 - -// EXTERNAL INCLUDES -#include - -#ifndef WAYLAND -#include -#include -#endif - -#include - -#include -#include -#include - -// INTERNAL INCLUDES -#include - -#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( 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 diff --git a/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.h b/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.h deleted file mode 100644 index fd2939e..0000000 --- a/dali/internal/accessibility/tizen-wayland/tizen-mobile/accessibility-adaptor-impl-mobile.h +++ /dev/null @@ -1,132 +0,0 @@ -#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 -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * This mobile version is different since it forwards events to the indicator. - */ -class AccessibilityAdaptorMobile : public AccessibilityAdaptor -{ -public: - - /** - * Constructor. - */ - AccessibilityAdaptorMobile(); - - // From AccessibilityAdaptor base class - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent() - */ - virtual bool HandleActionNextEvent( bool allowEndFeedback ); - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionPreviousEvent() - */ - virtual bool HandleActionPreviousEvent( bool allowEndFeedback ); - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionActivateEvent() - */ - virtual bool HandleActionActivateEvent(); - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionReadEvent() - */ - virtual bool HandleActionReadEvent( unsigned int x, unsigned int y, bool allowReadAgain ); - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionReadNextEvent() - */ - virtual bool HandleActionReadNextEvent( bool allowEndFeedback ); - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionReadPreviousEvent() - */ - virtual bool HandleActionReadPreviousEvent( bool allowEndFeedback ); - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionUpEvent() - */ - virtual bool HandleActionUpEvent(); - - /** - * @copydoc Dali::AccessibilityAdaptor::HandleActionDownEvent() - */ - virtual bool HandleActionDownEvent(); - -private: - - /** - * Destructor. - */ - virtual ~AccessibilityAdaptorMobile(); - - // Undefined - AccessibilityAdaptorMobile( const AccessibilityAdaptorMobile& ); - AccessibilityAdaptorMobile& operator=( AccessibilityAdaptorMobile& ); - -public: - - // Helpers for public-api forwarding methods - - inline static Internal::Adaptor::AccessibilityAdaptorMobile& GetImplementation(Dali::AccessibilityAdaptor& adaptor) - { - DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptorMobile handle is empty" ); - - BaseObject& handle = adaptor.GetBaseObject(); - - return static_cast(handle); - } - - inline static const Internal::Adaptor::AccessibilityAdaptorMobile& GetImplementation(const Dali::AccessibilityAdaptor& adaptor) - { - DALI_ASSERT_ALWAYS( adaptor && "AccessibilityAdaptorMobile handle is empty" ); - - const BaseObject& handle = adaptor.GetBaseObject(); - - return static_cast(handle); - } - -}; - -} // namespace Adaptor - -} // namespace Internal - -} // namespace Dali - -#endif // DALI_INTERNAL_ACCESSIBILITY_ADAPTOR_MOBILE_H diff --git a/dali/internal/accessibility/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp b/dali/internal/accessibility/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp deleted file mode 100644 index b2418f8..0000000 --- a/dali/internal/accessibility/tizen-wayland/tizen-tv/accessibility-adaptor-impl-tv.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 - -// EXTERNAL INCLUDES -#include - -#include -#include -#include - -// INTERNAL INCLUDES -#include - -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(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( 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 diff --git a/dali/internal/accessibility/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp b/dali/internal/accessibility/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp deleted file mode 100644 index 525faaf..0000000 --- a/dali/internal/accessibility/tizen-wayland/tizen-wearable/accessibility-adaptor-impl-wearable.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* - * 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 - -// EXTERNAL INCLUDES -#include - -#ifndef WAYLAND -#include -#include -#endif - -#include - -#include -#include -#include - -// INTERNAL INCLUDES -#include - -#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( 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 diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index e75d156..bc70e9b 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -54,7 +55,6 @@ #include #include -#include #include #include #include @@ -67,6 +67,7 @@ #include #include +#include #include #include @@ -320,10 +321,36 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory ) } mConfigurationManager = Utils::MakeUnique( systemCachePath, eglGraphics, mThreadController ); + + auto appName = GetApplicationPackageName(); + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + bridge->SetApplicationName( appName ); + bridge->Initialize(); + Dali::Stage::GetCurrent().KeyEventSignal().Connect( &accessibilityObserver, &AccessibilityObserver::OnAccessibleKeyEvent ); +} + +void Adaptor::AccessibilityObserver::OnAccessibleKeyEvent( const Dali::KeyEvent& event ) +{ + Accessibility::KeyEventType type; + if( event.GetState() == Dali::KeyEvent::DOWN ) + { + type = Accessibility::KeyEventType::KEY_PRESSED; + } + else if( event.GetState() == Dali::KeyEvent::UP ) + { + type = Accessibility::KeyEventType::KEY_RELEASED; + } + else + { + return; + } + Dali::Accessibility::Bridge::GetCurrentBridge()->Emit( type, event.GetKeyCode(), event.GetKeyName(), event.GetTime(), !event.GetKeyString().empty() ); } Adaptor::~Adaptor() { + Accessibility::Bridge::GetCurrentBridge()->Terminate(); + // Ensure stop status Stop(); @@ -400,6 +427,13 @@ void Adaptor::Start() Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( maxTextureSize ); } + // Set cached isAdvancedBlendEquationSupported + GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match + auto eglGraphics = static_cast( graphics ); + GlImplementation& mGLES = eglGraphics->GetGlesInterface(); + mGLES.SetIsAdvancedBlendEquationSupported( mConfigurationManager->IsAdvancedBlendEquationSupported() ); + mGLES.SetShadingLanguageVersion( mConfigurationManager->GetShadingLanguageVersion() ); + ProcessCoreEvents(); // Ensure any startup messages are processed. // Initialize the image loader plugin @@ -937,6 +971,8 @@ void Adaptor::RequestProcessEventsOnIdle( bool forceProcess ) void Adaptor::OnWindowShown() { + Dali::Accessibility::Bridge::GetCurrentBridge()->ApplicationShown(); + if( PAUSED_WHILE_HIDDEN == mState ) { // Adaptor can now be resumed @@ -967,6 +1003,8 @@ void Adaptor::OnWindowShown() void Adaptor::OnWindowHidden() { + Dali::Accessibility::Bridge::GetCurrentBridge()->ApplicationHidden(); + if( RUNNING == mState || READY == mState ) { bool allWindowsHidden = true; diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index 6394b3a..0506ae0 100644 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -43,11 +43,18 @@ #include #include +#include + namespace Dali { class RenderSurfaceInterface; +namespace Accessibility +{ +class Bridge; +} + namespace Integration { class Core; @@ -168,6 +175,8 @@ public: */ void SceneCreated(); + static std::string GetApplicationPackageName(); + public: // AdaptorInternalServices implementation /** * @copydoc Dali::Adaptor::Start() @@ -688,6 +697,13 @@ private: // Data std::unique_ptr mAddOnManager; ///< Pointer to the addon manager + class AccessibilityObserver : public ConnectionTracker + { + public: + void OnAccessibleKeyEvent( const Dali::KeyEvent& event ); + }; + AccessibilityObserver accessibilityObserver; + public: inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) { return *adaptor.mImpl; } }; diff --git a/dali/internal/adaptor/common/adaptor.cpp b/dali/internal/adaptor/common/adaptor.cpp index 8f752ef..a32657c 100644 --- a/dali/internal/adaptor/common/adaptor.cpp +++ b/dali/internal/adaptor/common/adaptor.cpp @@ -23,7 +23,6 @@ #include // INTERNAL INCLUDES -#include #include #include #include diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index f54c4cf..9ad4c54 100644 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -26,6 +26,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include @@ -201,6 +202,8 @@ void Application::Quit() void Application::QuitFromMainLoop() { + Accessibility::Bridge::GetCurrentBridge()->Terminate(); + mAdaptor->Stop(); mFramework->Quit(); @@ -222,6 +225,7 @@ void Application::OnInit() // Run the adaptor mAdaptor->Start(); + Accessibility::Accessible::SetObjectRegistry(mAdaptor->GetObjectRegistry()); if( ! mStylesheet.empty() ) { diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index eb28975..a0f690e 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -561,7 +561,9 @@ void CombinedUpdateRenderController::UpdateRenderThread() } } - eglGraphics->GetGlesInterface().ContextCreated(); + GlImplementation& gles = eglGraphics->GetGlesInterface(); + gles.ContextCreated(); + eglGraphics->SetGlesVersion( gles.GetGlesVersion() ); // Tell core it has a context mCore.ContextCreated(); diff --git a/dali/internal/adaptor/generic/adaptor-impl-generic.cpp b/dali/internal/adaptor/generic/adaptor-impl-generic.cpp index 1b05919..2a983ee 100644 --- a/dali/internal/adaptor/generic/adaptor-impl-generic.cpp +++ b/dali/internal/adaptor/generic/adaptor-impl-generic.cpp @@ -27,6 +27,11 @@ namespace Internal namespace Adaptor { +std::string Adaptor::GetApplicationPackageName() +{ + return ""; +} + void Adaptor::GetDataStoragePath( std::string& path) { path = ""; diff --git a/dali/internal/adaptor/tizen-wayland/adaptor-impl-tizen.cpp b/dali/internal/adaptor/tizen-wayland/adaptor-impl-tizen.cpp index dda9e96..af3ceb2 100755 --- a/dali/internal/adaptor/tizen-wayland/adaptor-impl-tizen.cpp +++ b/dali/internal/adaptor/tizen-wayland/adaptor-impl-tizen.cpp @@ -32,6 +32,8 @@ #include #endif +#include +#include namespace Dali { @@ -66,6 +68,14 @@ static void OnSystemLanguageChanged( system_settings_key_e key, void* data ) } // namesapce +std::string Adaptor::GetApplicationPackageName() +{ + char appname[4096] = {0}; + int pid = getpid(); + aul_app_get_pkgname_bypid( pid, appname, sizeof( appname ) ); + return appname; +} + void Adaptor::GetDataStoragePath( std::string& path) { #ifdef USE_APPFW diff --git a/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp b/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp index e411b45..52b18d6 100755 --- a/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp +++ b/dali/internal/clipboard/tizen-wayland/clipboard-impl-ecore-wl.cpp @@ -62,6 +62,7 @@ struct Clipboard::Impl Impl() { Eldbus_Object *eldbus_obj; + eldbus_init(); cbhm_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); eldbus_obj = eldbus_object_get(cbhm_conn, CBHM_DBUS_INTERFACE, CBHM_DBUS_OBJPATH); eldbus_proxy = eldbus_proxy_get(eldbus_obj, CBHM_DBUS_INTERFACE); @@ -75,6 +76,7 @@ struct Clipboard::Impl { if (cbhm_conn) eldbus_connection_unref(cbhm_conn); + eldbus_shutdown(); } Eldbus_Proxy* cbhm_proxy_get() diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index 984b4e1..ee4e08e 100755 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -37,6 +37,7 @@ namespace { const uint32_t THRESHOLD_SWAPBUFFER_COUNT = 5; const uint32_t CHECK_EXTENSION_NUMBER = 4; + const uint32_t EGL_VERSION_SUPPORT_SURFACELESS_CONTEXT = 15; const std::string EGL_KHR_SURFACELESS_CONTEXT = "EGL_KHR_surfaceless_context"; const std::string EGL_KHR_CREATE_CONTEXT = "EGL_KHR_create_context"; const std::string EGL_KHR_PARTIAL_UPDATE = "EGL_KHR_partial_update"; @@ -131,38 +132,51 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn mIsOwnSurface = isOwnSurface; } - // Query EGL extensions to check whether surfaceless context is supported + const char* const versionStr = eglQueryString( mEglDisplay, EGL_VERSION ); const char* const extensionStr = eglQueryString( mEglDisplay, EGL_EXTENSIONS ); - std::istringstream stream( extensionStr ); - std::string currentExtension; + + // Query EGL extensions to check whether required extensions are supported + std::istringstream versionStream( versionStr ); + std::string majorVersion, minorVersion; + std::getline( versionStream, majorVersion, '.' ); + std::getline( versionStream, minorVersion ); uint32_t extensionCheckCount = 0; + if( stoul( majorVersion ) * 10 + stoul( minorVersion ) >= EGL_VERSION_SUPPORT_SURFACELESS_CONTEXT ) + { + mIsSurfacelessContextSupported = true; + mIsKhrCreateContextSupported = true; + extensionCheckCount += 2; + } + + std::istringstream stream(extensionStr); + std::string currentExtension; bool isKhrPartialUpdateSupported = false; bool isKhrSwapBuffersWithDamageSupported = false; - while( std::getline( stream, currentExtension, ' ' ) && extensionCheckCount < CHECK_EXTENSION_NUMBER ) + while(std::getline(stream, currentExtension, ' ') && extensionCheckCount < CHECK_EXTENSION_NUMBER) { - if( currentExtension == EGL_KHR_SURFACELESS_CONTEXT ) + if(currentExtension == EGL_KHR_SURFACELESS_CONTEXT && !mIsSurfacelessContextSupported) { mIsSurfacelessContextSupported = true; extensionCheckCount++; } - if( currentExtension == EGL_KHR_CREATE_CONTEXT ) + if(currentExtension == EGL_KHR_CREATE_CONTEXT && !mIsKhrCreateContextSupported) { mIsKhrCreateContextSupported = true; extensionCheckCount++; } - if( currentExtension == EGL_KHR_PARTIAL_UPDATE ) + if(currentExtension == EGL_KHR_PARTIAL_UPDATE) { isKhrPartialUpdateSupported = true; extensionCheckCount++; } - if( currentExtension == EGL_KHR_SWAP_BUFFERS_WITH_DAMAGE ) + if(currentExtension == EGL_KHR_SWAP_BUFFERS_WITH_DAMAGE) { isKhrSwapBuffersWithDamageSupported = true; extensionCheckCount++; } } - if( !isKhrPartialUpdateSupported || !isKhrSwapBuffersWithDamageSupported ) + if(!isKhrPartialUpdateSupported || !isKhrSwapBuffersWithDamageSupported) { mPartialUpdateRequired = false; } @@ -178,7 +192,7 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn " Extensions: %s\n", mPartialUpdateRequired, eglQueryString( mEglDisplay, EGL_VENDOR ), - eglQueryString( mEglDisplay, EGL_VERSION ), + versionStr, eglQueryString( mEglDisplay, EGL_CLIENT_APIS ), extensionStr); diff --git a/dali/internal/graphics/gles/egl-implementation.h b/dali/internal/graphics/gles/egl-implementation.h index 6d9e3c9..8a23ef1 100644 --- a/dali/internal/graphics/gles/egl-implementation.h +++ b/dali/internal/graphics/gles/egl-implementation.h @@ -65,7 +65,7 @@ public: public: /** - * (Called from ECoreX::RenderSurface, not RenderThread, so not in i/f, hence, not virtual) + * (Called from RenderSurface, not RenderThread, so not in i/f, hence, not virtual) * Initialize GL * @param display The display * @param isOwnSurface whether the surface is own or not diff --git a/dali/internal/graphics/gles/gl-extensions.cpp b/dali/internal/graphics/gles/gl-extensions.cpp index 429cbd5..54c781a 100644 --- a/dali/internal/graphics/gles/gl-extensions.cpp +++ b/dali/internal/graphics/gles/gl-extensions.cpp @@ -33,9 +33,6 @@ namespace Internal namespace Adaptor { -namespace ECoreX -{ - GlExtensions::GlExtensions() : #ifdef GL_EXT_discard_framebuffer @@ -118,6 +115,27 @@ void GlExtensions::ProgramBinaryOES(GLuint program, GLenum binaryFormat, const G #endif } +bool GlExtensions::BlendBarrierKHR() +{ + // initialize extension on first use as on some hw platforms a context + // has to be bound for the extensions to return correct pointer + if( !mInitialized ) + { + Initialize(); + } + +#ifdef GL_KHR_blend_equation_advanced + if (mBlendBarrierKHR) + { + mBlendBarrierKHR(); + return true; + } + return false; +#endif + + return false; +} + void GlExtensions::Initialize() { mInitialized = true; @@ -130,9 +148,11 @@ void GlExtensions::Initialize() mGlGetProgramBinaryOES = reinterpret_cast< PFNGLGETPROGRAMBINARYOESPROC >( eglGetProcAddress("glGetProgramBinaryOES") ); mGlProgramBinaryOES = reinterpret_cast< PFNGLPROGRAMBINARYOESPROC >( eglGetProcAddress("glProgramBinaryOES") ); #endif -} -} // namespace ECoreX +#ifdef GL_KHR_blend_equation_advanced + mBlendBarrierKHR = reinterpret_cast< PFNGLBLENDBARRIERKHRPROC >( eglGetProcAddress("glBlendBarrierKHR") ); +#endif +} } // namespace Adaptor diff --git a/dali/internal/graphics/gles/gl-extensions.h b/dali/internal/graphics/gles/gl-extensions.h index b3a8085..887c714 100644 --- a/dali/internal/graphics/gles/gl-extensions.h +++ b/dali/internal/graphics/gles/gl-extensions.h @@ -34,9 +34,6 @@ namespace Internal namespace Adaptor { -namespace ECoreX -{ - /** * GlExtensions class provides GL extensions support */ @@ -91,6 +88,12 @@ public: */ void ProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); + /** + * KHR extension + * Specify a boundary between passes when using advanced blend equations. + */ + bool BlendBarrierKHR (); + private: /** @@ -107,12 +110,14 @@ private: PFNGLPROGRAMBINARYOESPROC mGlProgramBinaryOES; #endif +#ifdef GL_KHR_blend_equation_advanced + PFNGLBLENDBARRIERKHRPROC mBlendBarrierKHR; +#endif + bool mInitialized; }; -} // namespace ECoreX - } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/graphics/gles/gl-implementation.h b/dali/internal/graphics/gles/gl-implementation.h index 1cd7ed9..5f1078e 100644 --- a/dali/internal/graphics/gles/gl-implementation.h +++ b/dali/internal/graphics/gles/gl-implementation.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GL_IMPLEMENTATION_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -22,8 +22,10 @@ #include #include #include +#include #include #include +#include // INTERNAL INCLUDES #include @@ -39,6 +41,24 @@ namespace Internal namespace Adaptor { +namespace +{ + +const int32_t INITIAL_GLES_VERSION = 30; +const int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32; +const char* KHR_BLEND_EQUATION_ADVANCED = "GL_KHR_blend_equation_advanced"; + +const char* FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX = + "#extension GL_KHR_blend_equation_advanced : enable\n" + + "#if GL_KHR_blend_equation_advanced==1 || __VERSION__>=320\n" + " layout(blend_support_all_equations) out;\n" + "#endif\n"; + +const char* FRAGMENT_SHADER_OUTPUT_COLOR_STRING = + "out mediump vec4 fragColor;\n"; +} + /** * GlImplementation is a concrete implementation for GlAbstraction. * The class provides an OpenGL-ES 2.0 or 3.0 implementation. @@ -49,11 +69,16 @@ class GlImplementation : public Dali::Integration::GlAbstraction public: GlImplementation() - : mGlesVersion( 30 ), + : mContextCreatedWaitCondition(), + mMaxTextureSize( 0 ), + mVertexShaderPrefix(""), + mGlesVersion( INITIAL_GLES_VERSION ), + mShadingLanguageVersion( 100 ), + mShadingLanguageVersionCached( false ), mIsSurfacelessContextSupported( false ), - mIsContextCreated( false ), - mContextCreatedWaitCondition(), - mMaxTextureSize( 0 ) + mIsAdvancedBlendEquationSupportedCached( false ), + mIsAdvancedBlendEquationSupported( false ), + mIsContextCreated( false ) { mImpl.reset( new Gles3Implementation() ); } @@ -74,16 +99,64 @@ public: { glGetIntegerv( GL_MAX_TEXTURE_SIZE, &mMaxTextureSize ); - if( !mIsContextCreated ) + GLint majorVersion, minorVersion; + glGetIntegerv( GL_MAJOR_VERSION, &majorVersion ); + glGetIntegerv( GL_MINOR_VERSION, &minorVersion ); + mGlesVersion = majorVersion * 10 + minorVersion; + + if( mGlesVersion >= GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED ) + { + mIsAdvancedBlendEquationSupported = true; + } + else { - mContextCreatedWaitCondition.Notify(); + // when mIsAdvancedBlendEquationSupported is cached, we don't need to check all the extensions. + if( !mIsAdvancedBlendEquationSupportedCached ) + { + const char* const extensionStr = reinterpret_cast(glGetString(GL_EXTENSIONS)); + std::istringstream stream(extensionStr); + std::string currentExtension; + while(std::getline(stream, currentExtension, ' ')) + { + if(currentExtension == KHR_BLEND_EQUATION_ADVANCED) + { + mIsAdvancedBlendEquationSupported = true; + break; + } + } + } + } + + if(!mShadingLanguageVersionCached) + { + std::istringstream shadingLanguageVersionStream(reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION))); + std::string token; + uint32_t tokenCount = 0; + while(std::getline(shadingLanguageVersionStream, token, ' ')) + { + if(tokenCount == 3 && token == "ES") + { + std::getline(shadingLanguageVersionStream, token, '.'); + mShadingLanguageVersion = std::atoi(token.c_str()); + mShadingLanguageVersion *= 100; + std::getline(shadingLanguageVersionStream, token, '.'); + mShadingLanguageVersion += std::atoi(token.c_str()); + break; + } + tokenCount++; + } + } + + { + ConditionalWait::ScopedLock lock( mContextCreatedWaitCondition ); + mIsContextCreated = true; + mContextCreatedWaitCondition.Notify( lock ); } - mIsContextCreated = true; } void SetGlesVersion( const int32_t glesVersion ) { - if( mGlesVersion != glesVersion ) + if( mGlesVersion / 10 != glesVersion / 10 ) { mGlesVersion = glesVersion; if( mGlesVersion >= 30 ) @@ -107,6 +180,131 @@ public: return mIsSurfacelessContextSupported; } + void SetIsAdvancedBlendEquationSupported(const bool isSupported) + { + mIsAdvancedBlendEquationSupported = isSupported; + mIsAdvancedBlendEquationSupportedCached = true; + } + + bool IsAdvancedBlendEquationSupported() + { + ConditionalWait::ScopedLock lock( mContextCreatedWaitCondition ); + if(!mIsContextCreated && !mIsAdvancedBlendEquationSupportedCached) + { + mContextCreatedWaitCondition.Wait( lock ); + } + return mIsAdvancedBlendEquationSupported; + } + + bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) + { + switch(blendEquation) + { + case DevelBlendEquation::ADD: + case DevelBlendEquation::SUBTRACT: + case DevelBlendEquation::REVERSE_SUBTRACT: + { + return true; + } + case DevelBlendEquation::MIN: + case DevelBlendEquation::MAX: + { + return (GetGlesVersion() >= 30); + } + case DevelBlendEquation::MULTIPLY: + case DevelBlendEquation::SCREEN: + case DevelBlendEquation::OVERLAY: + case DevelBlendEquation::DARKEN: + case DevelBlendEquation::LIGHTEN: + case DevelBlendEquation::COLOR_DODGE: + case DevelBlendEquation::COLOR_BURN: + case DevelBlendEquation::HARD_LIGHT: + case DevelBlendEquation::SOFT_LIGHT: + case DevelBlendEquation::DIFFERENCE: + case DevelBlendEquation::EXCLUSION: + case DevelBlendEquation::HUE: + case DevelBlendEquation::SATURATION: + case DevelBlendEquation::COLOR: + case DevelBlendEquation::LUMINOSITY: + { + return IsAdvancedBlendEquationSupported(); + } + + default: + { + return false; + } + } + + return false; + } + + std::string GetShaderVersionPrefix() + { + if(mShaderVersionPrefix == "") + { + mShaderVersionPrefix = "#version " + std::to_string( GetShadingLanguageVersion() ); + if(GetShadingLanguageVersion() < 300) + { + mShaderVersionPrefix += "\n"; + } + else + { + mShaderVersionPrefix += " es\n"; + } + } + return mShaderVersionPrefix; + } + + std::string GetVertexShaderPrefix() + { + if(mVertexShaderPrefix == "") + { + mVertexShaderPrefix = GetShaderVersionPrefix(); + + if(GetShadingLanguageVersion() < 300) + { + mVertexShaderPrefix += "#define INPUT attribute\n"; + mVertexShaderPrefix += "#define OUTPUT varying\n"; + } + else + { + mVertexShaderPrefix += "#define INPUT in\n"; + mVertexShaderPrefix += "#define OUTPUT out\n"; + } + } + return mVertexShaderPrefix; + } + + std::string GetFragmentShaderPrefix() + { + if(mFragmentShaderPrefix == "") + { + mFragmentShaderPrefix = GetShaderVersionPrefix(); + + if(GetShadingLanguageVersion() < 300) + { + mFragmentShaderPrefix += "#define INPUT varying\n"; + mFragmentShaderPrefix += "#define OUT_COLOR gl_FragColor\n"; + mFragmentShaderPrefix += "#define TEXTURE texture2D\n"; + } + else + { + mFragmentShaderPrefix += "#define INPUT in\n"; + mFragmentShaderPrefix += "#define OUT_COLOR fragColor\n"; + mFragmentShaderPrefix += "#define TEXTURE texture\n"; + + if(IsAdvancedBlendEquationSupported()) + { + mFragmentShaderPrefix += FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX; + } + + mFragmentShaderPrefix += FRAGMENT_SHADER_OUTPUT_COLOR_STRING; + } + } + return mFragmentShaderPrefix; + } + bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const override { bool convert = ( ( imageGlFormat == GL_RGB ) && ( textureGlFormat == GL_RGBA ) ); @@ -120,13 +318,40 @@ public: int GetMaxTextureSize() { + ConditionalWait::ScopedLock lock( mContextCreatedWaitCondition ); if( !mIsContextCreated ) { - mContextCreatedWaitCondition.Wait(); + mContextCreatedWaitCondition.Wait( lock ); } return mMaxTextureSize; } + int GetGlesVersion() + { + ConditionalWait::ScopedLock lock( mContextCreatedWaitCondition ); + if( !mIsContextCreated ) + { + mContextCreatedWaitCondition.Wait( lock ); + } + return mGlesVersion; + } + + void SetShadingLanguageVersion( int shadingLanguageVersion ) + { + mShadingLanguageVersion = shadingLanguageVersion; + mShadingLanguageVersionCached = true; + } + + int GetShadingLanguageVersion() + { + ConditionalWait::ScopedLock lock( mContextCreatedWaitCondition ); + if( !mIsContextCreated && !mShadingLanguageVersionCached ) + { + mContextCreatedWaitCondition.Wait( lock ); + } + return mShadingLanguageVersion; + } + /* OpenGL ES 2.0 */ void ActiveTexture( GLenum texture ) override @@ -1361,13 +1586,29 @@ public: mImpl->GetInternalformativ( target, internalformat, pname, bufSize, params ); } + void BlendBarrier(void) + { + if(mIsAdvancedBlendEquationSupported) + { + mImpl->BlendBarrier(); + } + } + private: - int32_t mGlesVersion; - bool mIsSurfacelessContextSupported; - bool mIsContextCreated; - ConditionalWait mContextCreatedWaitCondition; - GLint mMaxTextureSize; std::unique_ptr mImpl; + + ConditionalWait mContextCreatedWaitCondition; + GLint mMaxTextureSize; + std::string mShaderVersionPrefix; + std::string mVertexShaderPrefix; + std::string mFragmentShaderPrefix; + int32_t mGlesVersion; + int32_t mShadingLanguageVersion; + bool mShadingLanguageVersionCached; + bool mIsSurfacelessContextSupported; + bool mIsAdvancedBlendEquationSupportedCached; + bool mIsAdvancedBlendEquationSupported; + bool mIsContextCreated; }; } // namespace Adaptor diff --git a/dali/internal/graphics/gles/gles-abstraction.h b/dali/internal/graphics/gles/gles-abstraction.h index 8dc63e6..6334b27 100644 --- a/dali/internal/graphics/gles/gles-abstraction.h +++ b/dali/internal/graphics/gles/gles-abstraction.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GLES_ABSTRACTION_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -244,6 +244,8 @@ public: virtual void TexStorage3D( GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth ) = 0; virtual void GetInternalformativ( GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params ) = 0; + + virtual void BlendBarrier( void ) = 0; }; } // namespace Adaptor diff --git a/dali/internal/graphics/gles/gles2-implementation.h b/dali/internal/graphics/gles/gles2-implementation.h index 5bab59b..cee1c77 100644 --- a/dali/internal/graphics/gles/gles2-implementation.h +++ b/dali/internal/graphics/gles/gles2-implementation.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GLES2_IMPLEMENTATION_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -574,8 +574,13 @@ public: DALI_LOG_ERROR( "glGetInternalformativ is not supported in OpenGL es 2.0\n" ); } + void BlendBarrier( void ) override + { + DALI_LOG_ERROR( "BlendBarrier is not supported in OpenGL es 2.0\n" ); + } + private: - ECoreX::GlExtensions mGlExtensions; + GlExtensions mGlExtensions; }; } // namespace Adaptor diff --git a/dali/internal/graphics/gles/gles3-implementation.h b/dali/internal/graphics/gles/gles3-implementation.h index ace3849..173cd6a 100644 --- a/dali/internal/graphics/gles/gles3-implementation.h +++ b/dali/internal/graphics/gles/gles3-implementation.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GLES3_IMPLEMENTATION_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include @@ -560,6 +561,17 @@ public: { glGetInternalformativ( target, internalformat, pname, bufSize, params ); } + + void BlendBarrier( void ) override + { + if(!mGlExtensions.BlendBarrierKHR()) + { + glBlendBarrier(); + } + } + +private: + GlExtensions mGlExtensions; }; } // namespace Adaptor diff --git a/dali/internal/system/common/configuration-manager.cpp b/dali/internal/system/common/configuration-manager.cpp index 63b62dc..e37ae78 100644 --- a/dali/internal/system/common/configuration-manager.cpp +++ b/dali/internal/system/common/configuration-manager.cpp @@ -43,6 +43,8 @@ namespace const std::string SYSTEM_CACHE_FILE = "gpu-environment.conf"; const std::string DALI_ENV_MULTIPLE_WINDOW_SUPPORT = "DALI_ENV_MULTIPLE_WINDOW_SUPPORT"; +const std::string DALI_BLEND_EQUATION_ADVANCED_SUPPORT = "DALI_BLEND_EQUATION_ADVANCED_SUPPORT"; +const std::string DALI_GLSL_VERSION = "DALI_GLSL_VERSION"; bool RetrieveKeyFromConfigFile( std::iostream& stream, const std::string& key, std::string& value ) { @@ -81,8 +83,11 @@ ConfigurationManager::ConfigurationManager( std::string systemCachePath, EglGrap mThreadController( threadController ), mMaxTextureSize( 0u ), mIsMultipleWindowSupported( true ), - mMaxTextureSizeCached( false ) , - mIsMultipleWindowSupportedCached( false ) + mIsAdvancedBlendEquationSupported( true ), + mMaxTextureSizeCached( false ), + mIsMultipleWindowSupportedCached( false ), + mIsAdvancedBlendEquationSupportedCached( false ), + mGlslVersionCached( false ) { } @@ -104,16 +109,30 @@ void ConfigurationManager::RetrieveKeysFromConfigFile( const std::string& config mMaxTextureSizeCached = true; } + if( !mGlslVersionCached && + RetrieveKeyFromConfigFile( stream, DALI_GLSL_VERSION, value ) ) + { + mGlslVersion = std::atoi( value.c_str() ); + mGlslVersionCached = true; + } + if( !mIsMultipleWindowSupportedCached && RetrieveKeyFromConfigFile( stream, DALI_ENV_MULTIPLE_WINDOW_SUPPORT, value ) ) { mIsMultipleWindowSupported = std::atoi( value.c_str() ); mIsMultipleWindowSupportedCached = true; } + + if( !mIsAdvancedBlendEquationSupportedCached && + RetrieveKeyFromConfigFile( stream, DALI_BLEND_EQUATION_ADVANCED_SUPPORT, value ) ) + { + mIsAdvancedBlendEquationSupported = std::atoi( value.c_str() ); + mIsAdvancedBlendEquationSupportedCached = true; + } } } -unsigned int ConfigurationManager::GetMaxTextureSize() +uint32_t ConfigurationManager::GetMaxTextureSize() { if( !mMaxTextureSizeCached ) { @@ -141,6 +160,43 @@ unsigned int ConfigurationManager::GetMaxTextureSize() return mMaxTextureSize; } +uint32_t ConfigurationManager::GetShadingLanguageVersion() +{ + if ( !mGlslVersionCached ) + { + RetrieveKeysFromConfigFile( mSystemCacheFilePath ); + + if ( !mGlslVersionCached ) + { + EglImplementation& eglImpl = mEglGraphics->GetEglImplementation(); + if ( !eglImpl.IsGlesInitialized() ) + { + // Wait until GLES is initialised, but this will happen once. + // This method blocks until the render thread has initialised the graphics. + mThreadController->WaitForGraphicsInitialization(); + } + + // Query from GLES and save the cache + mGlslVersion = mEglGraphics->GetGlesInterface().GetShadingLanguageVersion(); + DALI_LOG_ERROR("mGlslVersion : %d\n", mGlslVersion); + mGlslVersionCached = true; + + Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT ); + std::fstream& stream = dynamic_cast( configFile.GetStream() ); + if ( stream.is_open() ) + { + stream << DALI_GLSL_VERSION << " " << mGlslVersion << std::endl; + } + else + { + DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() ); + } + } + } + + return mGlslVersion; +} + bool ConfigurationManager::IsMultipleWindowSupported() { if ( !mIsMultipleWindowSupportedCached ) @@ -177,6 +233,42 @@ bool ConfigurationManager::IsMultipleWindowSupported() return mIsMultipleWindowSupported; } +bool ConfigurationManager::IsAdvancedBlendEquationSupported() +{ + if ( !mIsAdvancedBlendEquationSupportedCached ) + { + RetrieveKeysFromConfigFile( mSystemCacheFilePath ); + + if ( !mIsAdvancedBlendEquationSupportedCached ) + { + EglImplementation& eglImpl = mEglGraphics->GetEglImplementation(); + if ( !eglImpl.IsGlesInitialized() ) + { + // Wait until GLES is initialised, but this will happen once. + // This method blocks until the render thread has initialised the graphics. + mThreadController->WaitForGraphicsInitialization(); + } + + // Query from GLES and save the cache + mIsAdvancedBlendEquationSupported = mEglGraphics->GetGlesInterface().IsAdvancedBlendEquationSupported(); + mIsAdvancedBlendEquationSupportedCached = true; + + Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT ); + std::fstream& stream = dynamic_cast( configFile.GetStream() ); + if ( stream.is_open() ) + { + stream << DALI_BLEND_EQUATION_ADVANCED_SUPPORT << " " << mIsAdvancedBlendEquationSupported << std::endl; + } + else + { + DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() ); + } + } + } + + return mIsAdvancedBlendEquationSupported; +} + } // Adaptor } // Internal diff --git a/dali/internal/system/common/configuration-manager.h b/dali/internal/system/common/configuration-manager.h index a6721ee..a3375ac 100644 --- a/dali/internal/system/common/configuration-manager.h +++ b/dali/internal/system/common/configuration-manager.h @@ -37,7 +37,8 @@ class ThreadController; /** * This class retrieves and caches the system configuration. - * + * Some of the methods in this class can block system until GL has been initialized, + * only at the first time the DALi application is launched in the system. */ class ConfigurationManager { @@ -62,7 +63,13 @@ public: * @brief Get the maximum texture size. * @return The maximum texture size */ - unsigned int GetMaxTextureSize(); + uint32_t GetMaxTextureSize(); + + /** + * @brief Get the GLSL version that the system supports + * @return the GLSL version. + */ + uint32_t GetShadingLanguageVersion(); /** * @brief Check whether multiple window is supported @@ -70,6 +77,12 @@ public: */ bool IsMultipleWindowSupported(); + /** + * @brief Check whether blend equation advanced (extension) is supported + * @return Whether blend equation advanced (extension is supported + */ + bool IsAdvancedBlendEquationSupported(); + // Deleted copy constructor. ConfigurationManager( const ConfigurationManager& ) = delete; @@ -88,9 +101,13 @@ private: // Data EglGraphics* mEglGraphics; ///< EGL graphics ThreadController* mThreadController; ///< The thread controller unsigned int mMaxTextureSize; ///< The largest texture that the GL can handle + unsigned int mGlslVersion; ///< The GLSL version that the system supports. bool mIsMultipleWindowSupported:1; ///< Whether multiple window is supported by the GLES + bool mIsAdvancedBlendEquationSupported:1; ///< Whether blend equation advanced (extension) is supported by the GLES bool mMaxTextureSizeCached:1; ///< Whether we have checked the maximum texture size bool mIsMultipleWindowSupportedCached:1; ///< Whether we have checked the support of multiple window + bool mIsAdvancedBlendEquationSupportedCached:1;///< Whether we have checked the support of blend equation advanced (extension) + bool mGlslVersionCached:1; ///< Whether we have checked the GLSL version }; } // Adaptor diff --git a/dali/internal/system/common/time-service.cpp b/dali/internal/system/common/time-service.cpp index aa310b7..c0bc646 100644 --- a/dali/internal/system/common/time-service.cpp +++ b/dali/internal/system/common/time-service.cpp @@ -19,7 +19,8 @@ #include // EXTERNAL INCLUDES -#include +#include +#include namespace Dali { @@ -33,36 +34,36 @@ namespace Adaptor namespace TimeService { -namespace +void GetNanoseconds( uint64_t& timeInNanoseconds ) { -const uint64_t NANOSECONDS_PER_SECOND = 1e+9; + // Get the time of a monotonic clock since its epoch. + auto epoch = std::chrono::steady_clock::now().time_since_epoch(); + + auto duration = std::chrono::duration_cast(epoch); + + timeInNanoseconds = static_cast(duration.count()); } -void GetNanoseconds( uint64_t& timeInNanoseconds ) +uint32_t GetMilliSeconds() { - timespec timeSpec; - if( clock_gettime( CLOCK_MONOTONIC, &timeSpec ) == 0 ) - { - // Convert all values to uint64_t to match our return type - timeInNanoseconds = ( static_cast< uint64_t >( timeSpec.tv_sec ) * NANOSECONDS_PER_SECOND ) + static_cast< uint64_t >( timeSpec.tv_nsec ); - } - else - { - timeInNanoseconds = 0; - } + // Get the time of a monotonic clock since its epoch. + auto epoch = std::chrono::steady_clock::now().time_since_epoch(); + + auto duration = std::chrono::duration_cast(epoch); + + return static_cast(duration.count()); } + void SleepUntil( uint64_t timeInNanoseconds ) { - timespec timeSpec; - timeSpec.tv_sec = timeInNanoseconds / NANOSECONDS_PER_SECOND; - timeSpec.tv_nsec = timeInNanoseconds % NANOSECONDS_PER_SECOND; - - // clock_nanosleep returns 0 if it sleeps for the period specified, otherwise it returns an error value - // If an error value is returned, just sleep again till the absolute time specified - while( clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &timeSpec, NULL ) ) - { - } + using Clock = std::chrono::steady_clock; + using TimePoint = std::chrono::time_point; + + const Clock::duration duration = std::chrono::nanoseconds(timeInNanoseconds); + const TimePoint timePoint(duration); + + std::this_thread::sleep_until(timePoint); } } // namespace TimeService diff --git a/dali/internal/system/common/time-service.h b/dali/internal/system/common/time-service.h index 094aeba..7f55328 100644 --- a/dali/internal/system/common/time-service.h +++ b/dali/internal/system/common/time-service.h @@ -33,7 +33,7 @@ namespace TimeService { /** - * @brief Get the monotonic time since some unspecified starting point (usually the boot time). + * @brief Get the monotonic time since the clock's epoch. * * @param[out] timeInNanoseconds The time in nanoseconds since the reference point. * @@ -42,7 +42,16 @@ namespace TimeService void GetNanoseconds( uint64_t& timeInNanoseconds ); /** - * @brief Sleeps until the monotonic time specified since some unspecified starting point (usually the boot time). + * @brief Get the monotonic time since the clock's epoch. + * + * @return The time in milliseconds since the reference point. + * + * @note The maximum value that can be returned is 0xFFFFFFFF which is 4,294,967,295. Therefore, this can overflow after approximately 49 days. + */ +uint32_t GetMilliSeconds(); + +/** + * @brief Sleeps until the monotonic time specified since the clock's epoch. * * If the time specified has already passed, then it returns immediately. * diff --git a/dali/internal/window-system/android/window-base-android.cpp b/dali/internal/window-system/android/window-base-android.cpp index fa75f42..b507124 100644 --- a/dali/internal/window-system/android/window-base-android.cpp +++ b/dali/internal/window-system/android/window-base-android.cpp @@ -249,32 +249,32 @@ void WindowBaseAndroid::SetInputRegion( const Rect< int >& inputRegion ) { } -void WindowBaseAndroid::SetType( Dali::Window::Type type ) +void WindowBaseAndroid::SetType( Dali::WindowType type ) { } -bool WindowBaseAndroid::SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) +bool WindowBaseAndroid::SetNotificationLevel( Dali::WindowNotificationLevel level ) { return false; } -Dali::Window::NotificationLevel::Type WindowBaseAndroid::GetNotificationLevel() const +Dali::WindowNotificationLevel WindowBaseAndroid::GetNotificationLevel() const { - return Dali::Window::NotificationLevel::NONE; + return Dali::WindowNotificationLevel::NONE; } void WindowBaseAndroid::SetOpaqueState( bool opaque ) { } -bool WindowBaseAndroid::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) +bool WindowBaseAndroid::SetScreenOffMode(WindowScreenOffMode screenOffMode) { return false; } -Dali::Window::ScreenOffMode::Type WindowBaseAndroid::GetScreenOffMode() const +WindowScreenOffMode WindowBaseAndroid::GetScreenOffMode() const { - return Dali::Window::ScreenOffMode::TIMEOUT; + return WindowScreenOffMode::TIMEOUT; } bool WindowBaseAndroid::SetBrightness( int brightness ) diff --git a/dali/internal/window-system/android/window-base-android.h b/dali/internal/window-system/android/window-base-android.h index d5cf325..8b212b6 100644 --- a/dali/internal/window-system/android/window-base-android.h +++ b/dali/internal/window-system/android/window-base-android.h @@ -265,17 +265,17 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetType() */ - void SetType( Dali::Window::Type type ) override; + void SetType( Dali::WindowType type ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel() */ - bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override; + bool SetNotificationLevel( Dali::WindowNotificationLevel level ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel() */ - Dali::Window::NotificationLevel::Type GetNotificationLevel() const override; + Dali::WindowNotificationLevel GetNotificationLevel() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState() @@ -285,12 +285,12 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode() */ - bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override; + bool SetScreenOffMode(WindowScreenOffMode screenOffMode) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode() */ - Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override; + WindowScreenOffMode GetScreenOffMode() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness() diff --git a/dali/internal/window-system/common/event-handler.cpp b/dali/internal/window-system/common/event-handler.cpp index 911a3bd..bf614d7 100755 --- a/dali/internal/window-system/common/event-handler.cpp +++ b/dali/internal/window-system/common/event-handler.cpp @@ -52,53 +52,9 @@ Integration::Log::Filter* gSelectionEventLogFilter = Integration::Log::Filter::N } // unnamed namespace #endif -#ifdef DALI_ELDBUS_AVAILABLE -namespace -{ - -// Copied from x server -static uint32_t GetCurrentMilliSeconds(void) -{ - struct timeval tv; - - struct timespec tp; - static clockid_t clockid; - - if (!clockid) - { -#ifdef CLOCK_MONOTONIC_COARSE - if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 && - (tp.tv_nsec / 1000) <= 1000 && clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0) - { - clockid = CLOCK_MONOTONIC_COARSE; - } - else -#endif - if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) - { - clockid = CLOCK_MONOTONIC; - } - else - { - clockid = ~0L; - } - } - if (clockid != ~0L && clock_gettime(clockid, &tp) == 0) - { - return static_cast( (tp.tv_sec * 1000 ) + (tp.tv_nsec / 1000000L) ); - } - - gettimeofday(&tv, NULL); - return static_cast( (tv.tv_sec * 1000 ) + (tv.tv_usec / 1000) ); -} - -} // unnamed namespace -#endif - EventHandler::EventHandler( WindowBase* windowBase, DamageObserver& damageObserver ) : mStyleMonitor( StyleMonitor::Get() ), mDamageObserver( damageObserver ), - mAccessibilityAdaptor( AccessibilityAdaptor::Get() ), mClipboardEventNotifier( ClipboardEventNotifier::Get() ), mClipboard( Clipboard::Get() ), mPaused( false ) @@ -115,7 +71,6 @@ EventHandler::EventHandler( WindowBase* windowBase, DamageObserver& damageObserv windowBase->SelectionDataSendSignal().Connect( this, &EventHandler::OnSelectionDataSend ); windowBase->SelectionDataReceivedSignal().Connect( this, &EventHandler::OnSelectionDataReceived ); windowBase->StyleChangedSignal().Connect( this, &EventHandler::OnStyleChanged ); - windowBase->AccessibilitySignal().Connect( this, &EventHandler::OnAccessibilityNotification ); } else { @@ -246,260 +201,6 @@ void EventHandler::OnStyleChanged( StyleChange::Type styleChange ) SendEvent( styleChange ); } -void EventHandler::OnAccessibilityNotification( const WindowBase::AccessibilityInfo& info ) -{ -#ifdef DALI_ELDBUS_AVAILABLE - if( mPaused ) - { - return; - } - - if( !mAccessibilityAdaptor ) - { - DALI_LOG_ERROR( "Invalid accessibility adaptor\n" ); - return; - } - - AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( mAccessibilityAdaptor ) ); - if( !accessibilityAdaptor ) - { - DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" ); - return; - } - - // Create a touch point object. - PointState::Type touchPointState( PointState::DOWN ); - if( info.state == 0 ) - { - touchPointState = PointState::DOWN; // Mouse down. - } - else if( info.state == 1 ) - { - touchPointState = PointState::MOTION; // Mouse move. - } - else if( info.state == 2 ) - { - touchPointState = PointState::UP; // Mouse up. - } - else - { - touchPointState = PointState::INTERRUPTED; // Error. - } - - // Send touch event to accessibility adaptor. - TouchPoint point( 0, touchPointState, static_cast< float >( info.startX ), static_cast< float >( info.startY ) ); - - // Perform actions based on received gestures. - // Note: This is seperated from the reading so we can have other input readers without changing the below code. - switch( info.gestureValue ) - { - case 0: // OneFingerHover - { - // Focus, read out. - accessibilityAdaptor->HandleActionReadEvent( static_cast< unsigned int >( info.startX ), static_cast< unsigned int >( info.startY ), true /* allow read again */ ); - break; - } - case 1: // TwoFingersHover - { - // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control - accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() ); - break; - } - case 2: // ThreeFingersHover - { - // Read from top item on screen continuously. - accessibilityAdaptor->HandleActionReadFromTopEvent(); - break; - } - case 3: // OneFingerFlickLeft - { - // Move to previous item. - accessibilityAdaptor->HandleActionReadPreviousEvent(); - break; - } - case 4: // OneFingerFlickRight - { - // Move to next item. - accessibilityAdaptor->HandleActionReadNextEvent(); - break; - } - case 5: // OneFingerFlickUp - { - // Move to previous item. - accessibilityAdaptor->HandleActionPreviousEvent(); - break; - } - case 6: // OneFingerFlickDown - { - // Move to next item. - accessibilityAdaptor->HandleActionNextEvent(); - break; - } - case 7: // TwoFingersFlickUp - { - // Scroll up the list. - accessibilityAdaptor->HandleActionScrollUpEvent(); - break; - } - case 8: // TwoFingersFlickDown - { - // Scroll down the list. - accessibilityAdaptor->HandleActionScrollDownEvent(); - break; - } - case 9: // TwoFingersFlickLeft - { - // Scroll left to the previous page - accessibilityAdaptor->HandleActionPageLeftEvent(); - break; - } - case 10: // TwoFingersFlickRight - { - // Scroll right to the next page - accessibilityAdaptor->HandleActionPageRightEvent(); - break; - } - case 11: // ThreeFingersFlickLeft - { - // Not exist yet - break; - } - case 12: // ThreeFingersFlickRight - { - // Not exist yet - break; - } - case 13: // ThreeFingersFlickUp - { - // Not exist yet - break; - } - case 14: // ThreeFingersFlickDown - { - // Not exist yet - break; - } - case 15: // OneFingerSingleTap - { - // Focus, read out. - accessibilityAdaptor->HandleActionReadEvent( static_cast< unsigned int >( info.startX ), static_cast< unsigned int >( info.startY ), true /* allow read again */ ); - break; - } - case 16: // OneFingerDoubleTap - { - // Activate selected item / active edit mode. - accessibilityAdaptor->HandleActionActivateEvent(); - break; - } - case 17: // OneFingerTripleTap - { - // Zoom - accessibilityAdaptor->HandleActionZoomEvent(); - break; - } - case 18: // TwoFingersSingleTap - { - // Pause/Resume current speech - accessibilityAdaptor->HandleActionReadPauseResumeEvent(); - break; - } - case 19: // TwoFingersDoubleTap - { - // Start/Stop current action - accessibilityAdaptor->HandleActionStartStopEvent(); - break; - } - case 20: // TwoFingersTripleTap - { - // Read information from indicator - // Not supported - break; - } - case 21: // ThreeFingersSingleTap - { - // Read from top item on screen continuously. - accessibilityAdaptor->HandleActionReadFromTopEvent(); - break; - } - case 22: // ThreeFingersDoubleTap - { - // Read from next item continuously. - accessibilityAdaptor->HandleActionReadFromNextEvent(); - break; - } - case 23: // ThreeFingersTripleTap - { - // Not exist yet - break; - } - case 24: // OneFingerFlickLeftReturn - { - // Scroll up to the previous page - accessibilityAdaptor->HandleActionPageUpEvent(); - break; - } - case 25: // OneFingerFlickRightReturn - { - // Scroll down to the next page - accessibilityAdaptor->HandleActionPageDownEvent(); - break; - } - case 26: // OneFingerFlickUpReturn - { - // Move to the first item on screen - accessibilityAdaptor->HandleActionMoveToFirstEvent(); - break; - } - case 27: // OneFingerFlickDownReturn - { - // Move to the last item on screen - accessibilityAdaptor->HandleActionMoveToLastEvent(); - break; - } - case 28: // TwoFingersFlickLeftReturn - { - // Not exist yet - break; - } - case 29: // TwoFingersFlickRightReturn - { - // Not exist yet - break; - } - case 30: // TwoFingersFlickUpReturn - { - // Not exist yet - break; - } - case 31: // TwoFingersFlickDownReturn - { - // Not exist yet - break; - } - case 32: // ThreeFingersFlickLeftReturn - { - // Not exist yet - break; - } - case 33: // ThreeFingersFlickRightReturn - { - // Not exist yet - break; - } - case 34: // ThreeFingersFlickUpReturn - { - // Not exist yet - break; - } - case 35: // ThreeFingersFlickDownReturn - { - // Not exist yet - break; - } - } -#endif -} - void EventHandler::AddObserver( Observer& observer ) { ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) ); diff --git a/dali/internal/window-system/common/event-handler.h b/dali/internal/window-system/common/event-handler.h index ba23ce3..808f2ef 100644 --- a/dali/internal/window-system/common/event-handler.h +++ b/dali/internal/window-system/common/event-handler.h @@ -26,7 +26,6 @@ #include // INTERNAL INCLUDES -#include #include #include #include @@ -204,11 +203,6 @@ private: */ void OnStyleChanged( StyleChange::Type styleChange ); - /** - * Called when Ecore ElDBus accessibility event is received. - */ - void OnAccessibilityNotification( const WindowBase::AccessibilityInfo& info ); - private: // Undefined @@ -222,7 +216,6 @@ private: Dali::StyleMonitor mStyleMonitor; ///< Handle to the style monitor, set on construction, to send font size and font change events to. DamageObserver& mDamageObserver; ///< Reference to the DamageObserver, set on construction, to sent damage events to. - Dali::AccessibilityAdaptor mAccessibilityAdaptor; ///< Pointer to the accessibility adaptor Dali::ClipboardEventNotifier mClipboardEventNotifier; ///< Pointer to the clipboard event notifier Dali::Clipboard mClipboard;///< Pointer to the clipboard diff --git a/dali/internal/window-system/common/gl-window-impl.cpp b/dali/internal/window-system/common/gl-window-impl.cpp index 33952ea..f09517e 100644 --- a/dali/internal/window-system/common/gl-window-impl.cpp +++ b/dali/internal/window-system/common/gl-window-impl.cpp @@ -93,9 +93,9 @@ GlWindow::GlWindow() mFocusChangeSignal(), mResizeSignal(), mVisibilityChangedSignal(), - mGLInitCallback( 0 ), - mGLRenderFrameCallback( 0 ), - mGLTerminateCallback( 0 ), + mGLInitCallback(), + mGLRenderFrameCallback(), + mGLTerminateCallback(), mGLRenderCallback( nullptr ), mEGLSurface( nullptr ), mEGLContext( nullptr ), @@ -117,7 +117,7 @@ GlWindow::~GlWindow() if( mGLTerminateCallback ) { - mGLTerminateCallback(); + CallbackBase::Execute(*mGLTerminateCallback); } if( mIsEGLInitialize ) @@ -586,10 +586,10 @@ void GlWindow::SetAvailableAnlges( const std::vector< int >& angles ) mWindowBase->SetAvailableAnlges( angles ); } -bool GlWindow::IsOrientationAvailable( Dali::GlWindow::GlWindowOrientation orientation ) const +bool GlWindow::IsOrientationAvailable( WindowOrientation orientation ) const { - if( orientation <= Dali::GlWindow::GlWindowOrientation::NO_ORIENTATION_PREFERENCE - || orientation > Dali::GlWindow::GlWindowOrientation::LANDSCAPE_INVERSE ) + if( orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE + || orientation > WindowOrientation::LANDSCAPE_INVERSE ) { DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation ); return false; @@ -597,38 +597,38 @@ bool GlWindow::IsOrientationAvailable( Dali::GlWindow::GlWindowOrientation orien return true; } -int GlWindow::ConvertToAngle( Dali::GlWindow::GlWindowOrientation orientation ) +int GlWindow::ConvertToAngle( WindowOrientation orientation ) { int convertAngle = 0; if ( mOrientationMode == 0 ) { - convertAngle = ( static_cast< int >( orientation ) ) * 90; + convertAngle = static_cast< int >( orientation ); } else if( mOrientationMode == 1) { switch( orientation ) { - case Dali::GlWindow::GlWindowOrientation::LANDSCAPE: + case WindowOrientation::LANDSCAPE: { convertAngle = 0; break; } - case Dali::GlWindow::GlWindowOrientation::PORTRAIT: + case WindowOrientation::PORTRAIT: { convertAngle = 90; break; } - case Dali::GlWindow::GlWindowOrientation::LANDSCAPE_INVERSE: + case WindowOrientation::LANDSCAPE_INVERSE: { convertAngle = 180; break; } - case Dali::GlWindow::GlWindowOrientation::PORTRAIT_INVERSE: + case WindowOrientation::PORTRAIT_INVERSE: { convertAngle = 270; break; } - case Dali::GlWindow::GlWindowOrientation::NO_ORIENTATION_PREFERENCE: + case WindowOrientation::NO_ORIENTATION_PREFERENCE: { convertAngle = -1; break; @@ -638,12 +638,12 @@ int GlWindow::ConvertToAngle( Dali::GlWindow::GlWindowOrientation orientation return convertAngle; } -Dali::GlWindow::GlWindowOrientation GlWindow::ConvertToOrientation( int angle ) const +WindowOrientation GlWindow::ConvertToOrientation( int angle ) const { - Dali::GlWindow::GlWindowOrientation orientation = Dali::GlWindow::GlWindowOrientation::NO_ORIENTATION_PREFERENCE; + WindowOrientation orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE; if ( mOrientationMode == 0 ) // Portrate mode { - orientation = static_cast< Dali::GlWindow::GlWindowOrientation >( angle / 90 ); + orientation = static_cast< WindowOrientation >( angle ); } else if( mOrientationMode == 1 ) // Landscape mode { @@ -651,27 +651,27 @@ Dali::GlWindow::GlWindowOrientation GlWindow::ConvertToOrientation( int angle ) { case 0: { - orientation = Dali::GlWindow::GlWindowOrientation::LANDSCAPE; + orientation = WindowOrientation::LANDSCAPE; break; } case 90: { - orientation = Dali::GlWindow::GlWindowOrientation::PORTRAIT; + orientation = WindowOrientation::PORTRAIT; break; } case 180: { - orientation = Dali::GlWindow::GlWindowOrientation::LANDSCAPE_INVERSE; + orientation = WindowOrientation::LANDSCAPE_INVERSE; break; } case 270: { - orientation = Dali::GlWindow::GlWindowOrientation::PORTRAIT_INVERSE; + orientation = WindowOrientation::PORTRAIT_INVERSE; break; } case -1: { - orientation = Dali::GlWindow::GlWindowOrientation::NO_ORIENTATION_PREFERENCE; + orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE; break; } } @@ -679,13 +679,13 @@ Dali::GlWindow::GlWindowOrientation GlWindow::ConvertToOrientation( int angle ) return orientation; } -Dali::GlWindow::GlWindowOrientation GlWindow::GetCurrentOrientation() const +WindowOrientation GlWindow::GetCurrentOrientation() const { DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mTotalRotationAngle ); return ConvertToOrientation( mTotalRotationAngle ); } -void GlWindow::SetAvailableOrientations( const Dali::Vector< Dali::GlWindow::GlWindowOrientation >& orientations ) +void GlWindow::SetAvailableOrientations( const Dali::Vector< WindowOrientation >& orientations ) { Dali::Vector::SizeType count = orientations.Count(); for( Dali::Vector::SizeType index = 0; index < count; ++index ) @@ -717,7 +717,7 @@ void GlWindow::SetAvailableOrientations( const Dali::Vector< Dali::GlWindow::GlW SetAvailableAnlges( mAvailableAngles ); } -void GlWindow::SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation ) +void GlWindow::SetPreferredOrientation( WindowOrientation orientation ) { if( IsOrientationAvailable( orientation ) == false ) { @@ -747,15 +747,15 @@ void GlWindow::SetChild( Dali::Window& child ) } } -void GlWindow::RegisterGlCallback( GlInitialize glInit, GlRenderFrame glRenderFrame, GlTerminate glTerminate ) +void GlWindow::RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback ) { if( mIsEGLInitialize == false ) { InitializeGraphics(); } - mGLInitCallback = glInit; - mGLRenderFrameCallback = glRenderFrame; - mGLTerminateCallback = glTerminate; + mGLInitCallback = std::unique_ptr< CallbackBase >(initCallback); + mGLRenderFrameCallback = std::unique_ptr< CallbackBase >( renderFrameCallback ); + mGLTerminateCallback = std::unique_ptr< CallbackBase >( terminateCallback ); mInitCallback = false; @@ -783,6 +783,8 @@ bool GlWindow::RunCallback() eglImpl.MakeContextCurrent( mEGLSurface, mEGLContext ); + int renderFrameResult = 0; + if( mIsRotated ) { mWindowBase->SetEglWindowBufferTransform( mTotalRotationAngle ); @@ -797,14 +799,14 @@ bool GlWindow::RunCallback() { if( mGLInitCallback ) { - mGLInitCallback(); + CallbackBase::Execute(*mGLInitCallback); } mInitCallback = true; } if( mGLRenderFrameCallback ) { - mGLRenderFrameCallback(); + renderFrameResult = CallbackBase::ExecuteReturn(*mGLRenderFrameCallback); } if( mIsWindowRotated ) @@ -813,7 +815,10 @@ bool GlWindow::RunCallback() mIsWindowRotated = false; } - eglImpl.SwapBuffers( mEGLSurface ); + if(renderFrameResult) + { + eglImpl.SwapBuffers( mEGLSurface ); + } return true; } diff --git a/dali/internal/window-system/common/gl-window-impl.h b/dali/internal/window-system/common/gl-window-impl.h index fbecfc5..684a8b1 100644 --- a/dali/internal/window-system/common/gl-window-impl.h +++ b/dali/internal/window-system/common/gl-window-impl.h @@ -161,22 +161,22 @@ public: /** * @copydoc Dali::GlWindow::GetCurrentOrientation() const */ - Dali::GlWindow::GlWindowOrientation GetCurrentOrientation() const; + WindowOrientation GetCurrentOrientation() const; /** * @copydoc Dali::GlWindow::SetAvailableOrientations() */ - void SetAvailableOrientations( const Dali::Vector< Dali::GlWindow::GlWindowOrientation >& orientations ); + void SetAvailableOrientations( const Dali::Vector< WindowOrientation >& orientations ); /** * @copydoc Dali::GlWindow::SetPreferredOrientation() */ - void SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation ); + void SetPreferredOrientation( WindowOrientation orientation ); /** * @copydoc Dali::GlWindow::RegisterGlCallback() */ - void RegisterGlCallback( GlInitialize glInit, GlRenderFrame glRenderFrame, GlTerminate glTerminate ); + void RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback ); /** * @copydoc Dali::GlWindow::RenderOnce() @@ -254,7 +254,7 @@ private: * * @return true is available window orientation. false is not available. */ - bool IsOrientationAvailable( Dali::GlWindow::GlWindowOrientation orientation ) const; + bool IsOrientationAvailable( WindowOrientation orientation ) const; /** * @brief Convert from window orientation to angle using orientation mode value. @@ -263,7 +263,7 @@ private: * * @return The coverted angle value is returned. */ - int ConvertToAngle( Dali::GlWindow::GlWindowOrientation orientation ); + int ConvertToAngle( WindowOrientation orientation ); /** * @brief Convert from angle to window orientation using orientation mode value. @@ -272,7 +272,7 @@ private: * * @return The converted window orientation value is returned. */ - Dali::GlWindow::GlWindowOrientation ConvertToOrientation( int angle ) const; + WindowOrientation ConvertToOrientation( int angle ) const; /** * @brief Run Ui GL callback function. @@ -399,9 +399,9 @@ private: VisibilityChangedSignalType mVisibilityChangedSignal; // EGL, GL Resource - GlInitialize mGLInitCallback; - GlRenderFrame mGLRenderFrameCallback; - GlTerminate mGLTerminateCallback; + std::unique_ptr< CallbackBase > mGLInitCallback; + std::unique_ptr< CallbackBase > mGLRenderFrameCallback; + std::unique_ptr< CallbackBase > mGLTerminateCallback; CallbackBase* mGLRenderCallback; EGLSurface mEGLSurface; EGLContext mEGLContext; diff --git a/dali/internal/window-system/common/window-base.h b/dali/internal/window-system/common/window-base.h index ea33d05..01d3650 100644 --- a/dali/internal/window-system/common/window-base.h +++ b/dali/internal/window-system/common/window-base.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -70,7 +71,7 @@ public: typedef Signal< void ( ) > DeleteSignalType; typedef Signal< void ( const DamageArea& ) > DamageSignalType; typedef Signal< void ( const RotationEvent& ) > RotationSignalType; - typedef Signal< void ( DevelWindow::EffectState, DevelWindow::EffectType ) > TransitionEffectEventSignalType; + typedef Signal< void ( WindowEffectState, WindowEffectType ) > TransitionEffectEventSignalType; typedef Signal< void ( ) > KeyboardRepeatSettingsChangedSignalType; typedef Signal< void ( ) > WindowRedrawRequestSignalType; @@ -248,17 +249,17 @@ public: /** * @copydoc Dali::Window::SetType() */ - virtual void SetType( Dali::Window::Type type ) = 0; + virtual void SetType( Dali::WindowType type ) = 0; /** * @copydoc Dali::Window::SetNotificationLevel() */ - virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0; + virtual bool SetNotificationLevel( Dali::WindowNotificationLevel level ) = 0; /** * @copydoc Dali::Window::GetNotificationLevel() */ - virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0; + virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0; /** * @copydoc Dali::Window::SetOpaqueState() @@ -268,12 +269,12 @@ public: /** * @copydoc Dali::Window::SetScreenOffMode() */ - virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0; + virtual bool SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0; /** * @copydoc Dali::Window::GetScreenOffMode() */ - virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0; + virtual WindowScreenOffMode GetScreenOffMode() const = 0; /** * @copydoc Dali::Window::SetBrightness() diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index fe1dacc..ab97cb4 100755 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -41,6 +42,7 @@ #include #include #include +#include namespace Dali { @@ -80,9 +82,9 @@ Window::Window() mIconified( false ), mOpaqueState( false ), mResizeEnabled( false ), - mType( Dali::Window::NORMAL ), + mType( WindowType::NORMAL ), mParentWindow( NULL ), - mPreferredAngle( Dali::Window::NO_ORIENTATION_PREFERENCE ), + mPreferredAngle( static_cast< int >( WindowOrientation::NO_ORIENTATION_PREFERENCE ) ), mRotationAngle( -1 ), mWindowWidth( 0 ), mWindowHeight( 0 ), @@ -99,6 +101,16 @@ Window::Window() Window::~Window() { + if ( mAdaptor ) + { + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto accessible2 = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get( accessible2 ); + bridge->RemoveTopLevelWindow( accessible ); + + mAdaptor->RemoveWindow( this ); + } + if ( mEventHandler ) { mEventHandler->RemoveObserver( *this ); @@ -156,6 +168,14 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor) { mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface->GetWindowBase(), *mAdaptor ) ); mEventHandler->AddObserver( *this ); + + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto v = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get( v, true ); + bridge->AddTopLevelWindow( accessible ); + + //FIXME: line below is temporary solution for missing "activate" signal and should be removed + Show(); } void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface ) @@ -217,7 +237,7 @@ Dali::RenderTaskList Window::GetRenderTaskList() const return mScene.GetRenderTaskList(); } -void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation ) +void Window::AddAvailableOrientation( WindowOrientation orientation ) { if( IsOrientationAvailable( orientation ) == false ) { @@ -243,7 +263,7 @@ void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientatio } } -void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation ) +void Window::RemoveAvailableOrientation( WindowOrientation orientation ) { if( IsOrientationAvailable( orientation ) == false ) { @@ -265,9 +285,9 @@ void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orienta SetAvailableAnlges( mAvailableAngles ); } -void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) +void Window::SetPreferredOrientation( WindowOrientation orientation ) { - if( orientation < Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE ) + if( orientation < WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE ) { DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation ); return; @@ -277,10 +297,10 @@ void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientatio mWindowBase->SetPreferredAngle( mPreferredAngle ); } -Dali::Window::WindowOrientation Window::GetPreferredOrientation() +WindowOrientation Window::GetPreferredOrientation() { DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle ); - Dali::Window::WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle ); + WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle ); return preferredOrientation; } @@ -295,34 +315,34 @@ void Window::SetAvailableAnlges( const std::vector< int >& angles ) mWindowBase->SetAvailableAnlges( angles ); } -int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation ) +int Window::ConvertToAngle( WindowOrientation orientation ) { int convertAngle = static_cast< int >( orientation ); if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE ) { switch( orientation ) { - case Dali::Window::LANDSCAPE: + case WindowOrientation::LANDSCAPE: { convertAngle = 0; break; } - case Dali::Window::PORTRAIT: + case WindowOrientation::PORTRAIT: { convertAngle = 90; break; } - case Dali::Window::LANDSCAPE_INVERSE: + case WindowOrientation::LANDSCAPE_INVERSE: { convertAngle = 180; break; } - case Dali::Window::PORTRAIT_INVERSE: + case WindowOrientation::PORTRAIT_INVERSE: { convertAngle = 270; break; } - case Dali::Window::NO_ORIENTATION_PREFERENCE: + case WindowOrientation::NO_ORIENTATION_PREFERENCE: { convertAngle = -1; break; @@ -332,36 +352,36 @@ int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation ) return convertAngle; } -Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle ) const +WindowOrientation Window::ConvertToOrientation( int angle ) const { - Dali::Window::WindowOrientation orientation = static_cast< Dali::Window::WindowOrientation >( angle ); + WindowOrientation orientation = static_cast< WindowOrientation >( angle ); if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE ) { switch( angle ) { case 0: { - orientation = Dali::Window::LANDSCAPE; + orientation = WindowOrientation::LANDSCAPE; break; } case 90: { - orientation = Dali::Window::PORTRAIT; + orientation = WindowOrientation::PORTRAIT; break; } case 180: { - orientation = Dali::Window::LANDSCAPE_INVERSE; + orientation = WindowOrientation::LANDSCAPE_INVERSE; break; } case 270: { - orientation = Dali::Window::PORTRAIT_INVERSE; + orientation = WindowOrientation::PORTRAIT_INVERSE; break; } case -1: { - orientation = Dali::Window::NO_ORIENTATION_PREFERENCE; + orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE; break; } } @@ -369,9 +389,9 @@ Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle ) const return orientation; } -bool Window::IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const +bool Window::IsOrientationAvailable( WindowOrientation orientation ) const { - if( orientation <= Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE ) + if( orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE ) { DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation ); return false; @@ -482,7 +502,7 @@ void Window::SetInputRegion( const Rect< int >& inputRegion ) DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height ); } -void Window::SetType( Dali::Window::Type type ) +void Window::SetType( WindowType type ) { if( type != mType ) { @@ -492,14 +512,14 @@ void Window::SetType( Dali::Window::Type type ) } } -Dali::Window::Type Window::GetType() const +WindowType Window::GetType() const { return mType; } -bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) +bool Window::SetNotificationLevel( WindowNotificationLevel level ) { - if( mType != Dali::Window::NOTIFICATION ) + if( mType != WindowType::NOTIFICATION ) { DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType ); return false; @@ -508,12 +528,12 @@ bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) return mWindowBase->SetNotificationLevel( level ); } -Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const +WindowNotificationLevel Window::GetNotificationLevel() const { - if( mType != Dali::Window::NOTIFICATION ) + if( mType != WindowType::NOTIFICATION ) { DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType ); - return Dali::Window::NotificationLevel::NONE; + return WindowNotificationLevel::NONE; } return mWindowBase->GetNotificationLevel(); @@ -533,12 +553,12 @@ bool Window::IsOpaqueState() const return mOpaqueState; } -bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) +bool Window::SetScreenOffMode(WindowScreenOffMode screenOffMode) { return mWindowBase->SetScreenOffMode( screenOffMode ); } -Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const +WindowScreenOffMode Window::GetScreenOffMode() const { return mWindowBase->GetScreenOffMode(); } @@ -726,6 +746,18 @@ void Window::OnFocusChanged( bool focusIn ) mFocusChangeSignal.Emit( handle, focusIn ); mSurface->SetFullSwapNextFrame(); + + if (auto b = Dali::Accessibility::Bridge::GetCurrentBridge()) + { + if (focusIn) + { + b->ApplicationShown(); + } + else + { + b->ApplicationHidden(); + } + } } void Window::OnOutputTransformed() @@ -741,7 +773,7 @@ void Window::OnDeleteRequest() mDeleteRequestSignal.Emit(); } -void Window::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type ) +void Window::OnTransitionEffectEvent( WindowEffectState state, WindowEffectType type ) { Dali::Window handle( this ); mTransitionEffectEventSignal.Emit( handle, state, type ); @@ -892,13 +924,13 @@ Dali::Window Window::GetParent() return mParentWindow; } -Dali::Window::WindowOrientation Window::GetCurrentOrientation() const +WindowOrientation Window::GetCurrentOrientation() const { DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle ); return ConvertToOrientation( mRotationAngle ); } -void Window::SetAvailableOrientations( const Dali::Vector& orientations ) +void Window::SetAvailableOrientations( const Dali::Vector& orientations ) { Dali::Vector::SizeType count = orientations.Count(); for( Dali::Vector::SizeType index = 0; index < count; ++index ) diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 2270a4b..e9f8063 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -24,6 +24,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -130,22 +131,22 @@ public: /** * @copydoc Dali::Window::AddAvailableOrientation() */ - void AddAvailableOrientation(Dali::Window::WindowOrientation orientation); + void AddAvailableOrientation(WindowOrientation orientation); /** * @copydoc Dali::Window::RemoveAvailableOrientation() */ - void RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation); + void RemoveAvailableOrientation(WindowOrientation orientation); /** * @copydoc Dali::Window::SetPreferredOrientation() */ - void SetPreferredOrientation(Dali::Window::WindowOrientation orientation); + void SetPreferredOrientation(WindowOrientation orientation); /** * @copydoc Dali::Window::GetPreferredOrientation() */ - Dali::Window::WindowOrientation GetPreferredOrientation(); + WindowOrientation GetPreferredOrientation(); /** * @copydoc Dali::Window::SetAcceptFocus() @@ -210,22 +211,22 @@ public: /** * @copydoc Dali::Window::SetType() */ - void SetType( Dali::Window::Type type ); + void SetType( WindowType type ); /** * @copydoc Dali::Window::GetType() const */ - Dali::Window::Type GetType() const; + WindowType GetType() const; /** * @copydoc Dali::Window::SetNotificationLevel() */ - bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ); + bool SetNotificationLevel( WindowNotificationLevel level ); /** * @copydoc Dali::Window::GetNotificationLevel() */ - Dali::Window::NotificationLevel::Type GetNotificationLevel() const; + WindowNotificationLevel GetNotificationLevel() const; /** * @copydoc Dali::Window::SetOpaqueState() @@ -240,12 +241,12 @@ public: /** * @copydoc Dali::Window::SetScreenOffMode() */ - bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode); + bool SetScreenOffMode(WindowScreenOffMode screenOffMode); /** * @copydoc Dali::Window::GetScreenOffMode() */ - Dali::Window::ScreenOffMode::Type GetScreenOffMode() const; + WindowScreenOffMode GetScreenOffMode() const; /** * @copydoc Dali::Window::SetBrightness() @@ -335,12 +336,12 @@ public: /** * @copydoc Dali::DevelWindow::GetCurrentOrientation() */ - Dali::Window::WindowOrientation GetCurrentOrientation() const; + WindowOrientation GetCurrentOrientation() const; /** * @copydoc Dali::DevelWindow::SetAvailableOrientations() */ - void SetAvailableOrientations( const Dali::Vector& orientations ); + void SetAvailableOrientations( const Dali::Vector& orientations ); public: // Dali::Internal::Adaptor::SceneHolder @@ -412,7 +413,7 @@ private: /** * Called when the window receives a Transition effect-start/end event. */ - void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type ); + void OnTransitionEffectEvent( WindowEffectState state, WindowEffectType type ); /** * @brief Called when window receives a keyboard repeat event. @@ -432,17 +433,17 @@ private: /** * @brief Convert from window orientation to angle using OrientationMode. */ - int ConvertToAngle( Dali::Window::WindowOrientation orientation ); + int ConvertToAngle( WindowOrientation orientation ); /** * @brief Convert from angle to window orientation using OrientationMode. */ - Dali::Window::WindowOrientation ConvertToOrientation( int angle ) const; + WindowOrientation ConvertToOrientation( int angle ) const; /** * @brief Check available window orientation for Available orientation. */ - bool IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const; + bool IsOrientationAvailable( WindowOrientation orientation ) const; private: // Dali::Internal::Adaptor::SceneHolder @@ -541,7 +542,7 @@ private: bool mIconified:1; bool mOpaqueState:1; bool mResizeEnabled:1; - Dali::Window::Type mType; + WindowType mType; Dali::Window mParentWindow; OrientationPtr mOrientation; diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp index 9157080..17027c7 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp @@ -1531,28 +1531,28 @@ void WindowBaseEcoreWl::SetInputRegion( const Rect< int >& inputRegion ) ecore_wl_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height ); } -void WindowBaseEcoreWl::SetType( Dali::Window::Type type ) +void WindowBaseEcoreWl::SetType( Dali::WindowType type ) { Ecore_Wl_Window_Type windowType; switch( type ) { - case Dali::Window::NORMAL: + case Dali::WindowType::NORMAL: { windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL; break; } - case Dali::Window::NOTIFICATION: + case Dali::WindowType::NOTIFICATION: { windowType = ECORE_WL_WINDOW_TYPE_NOTIFICATION; break; } - case Dali::Window::UTILITY: + case Dali::WindowType::UTILITY: { windowType = ECORE_WL_WINDOW_TYPE_UTILITY; break; } - case Dali::Window::DIALOG: + case Dali::WindowType::DIALOG: { windowType = ECORE_WL_WINDOW_TYPE_DIALOG; break; @@ -1567,7 +1567,7 @@ void WindowBaseEcoreWl::SetType( Dali::Window::Type type ) ecore_wl_window_type_set( mEcoreWindow, windowType ); } -bool WindowBaseEcoreWl::SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) +bool WindowBaseEcoreWl::SetNotificationLevel( Dali::WindowNotificationLevel level ) { while( !mTizenPolicy ) { @@ -1578,27 +1578,27 @@ bool WindowBaseEcoreWl::SetNotificationLevel( Dali::Window::NotificationLevel::T switch( level ) { - case Dali::Window::NotificationLevel::NONE: + case Dali::WindowNotificationLevel::NONE: { notificationLevel = TIZEN_POLICY_LEVEL_NONE; break; } - case Dali::Window::NotificationLevel::BASE: + case Dali::WindowNotificationLevel::BASE: { notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT; break; } - case Dali::Window::NotificationLevel::MEDIUM: + case Dali::WindowNotificationLevel::MEDIUM: { notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM; break; } - case Dali::Window::NotificationLevel::HIGH: + case Dali::WindowNotificationLevel::HIGH: { notificationLevel = TIZEN_POLICY_LEVEL_HIGH; break; } - case Dali::Window::NotificationLevel::TOP: + case Dali::WindowNotificationLevel::TOP: { notificationLevel = TIZEN_POLICY_LEVEL_TOP; break; @@ -1641,7 +1641,7 @@ bool WindowBaseEcoreWl::SetNotificationLevel( Dali::Window::NotificationLevel::T return true; } -Dali::Window::NotificationLevel::Type WindowBaseEcoreWl::GetNotificationLevel() const +Dali::WindowNotificationLevel WindowBaseEcoreWl::GetNotificationLevel() const { while( !mTizenPolicy ) { @@ -1663,39 +1663,39 @@ Dali::Window::NotificationLevel::Type WindowBaseEcoreWl::GetNotificationLevel() return Dali::Window::NotificationLevel::NONE; } - Dali::Window::NotificationLevel::Type level; + Dali::WindowNotificationLevel level; switch( mNotificationLevel ) { case TIZEN_POLICY_LEVEL_NONE: { - level = Dali::Window::NotificationLevel::NONE; + level = Dali::WindowNotificationLevel::NONE; break; } case TIZEN_POLICY_LEVEL_DEFAULT: { - level = Dali::Window::NotificationLevel::BASE; + level = Dali::WindowNotificationLevel::BASE; break; } case TIZEN_POLICY_LEVEL_MEDIUM: { - level = Dali::Window::NotificationLevel::MEDIUM; + level = Dali::WindowNotificationLevel::MEDIUM; break; } case TIZEN_POLICY_LEVEL_HIGH: { - level = Dali::Window::NotificationLevel::HIGH; + level = Dali::WindowNotificationLevel::HIGH; break; } case TIZEN_POLICY_LEVEL_TOP: { - level = Dali::Window::NotificationLevel::TOP; + level = Dali::WindowNotificationLevel::TOP; break; } default: { DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel ); - level = Dali::Window::NotificationLevel::NONE; + level = Dali::WindowNotificationLevel::NONE; break; } } @@ -1715,7 +1715,7 @@ void WindowBaseEcoreWl::SetOpaqueState( bool opaque ) tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) ); } -bool WindowBaseEcoreWl::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) +bool WindowBaseEcoreWl::SetScreenOffMode(WindowScreenOffMode screenOffMode) { while( !mTizenPolicy ) { @@ -1729,12 +1729,12 @@ bool WindowBaseEcoreWl::SetScreenOffMode(Dali::Window::ScreenOffMode::Type scree switch( screenOffMode ) { - case Dali::Window::ScreenOffMode::TIMEOUT: + case WindowScreenOffMode::TIMEOUT: { mode = 0; break; } - case Dali::Window::ScreenOffMode::NEVER: + case WindowScreenOffMode::NEVER: { mode = 1; break; @@ -1768,7 +1768,7 @@ bool WindowBaseEcoreWl::SetScreenOffMode(Dali::Window::ScreenOffMode::Type scree return true; } -Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl::GetScreenOffMode() const +WindowScreenOffMode WindowBaseEcoreWl::GetScreenOffMode() const { while( !mTizenPolicy ) { @@ -1787,21 +1787,21 @@ Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl::GetScreenOffMode() const if( !mScreenOffModeChangeDone ) { DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState ); - return Dali::Window::ScreenOffMode::TIMEOUT; + return WindowScreenOffMode::TIMEOUT; } - Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT; + WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT; switch( mScreenOffMode ) { case 0: { - screenMode = Dali::Window::ScreenOffMode::TIMEOUT; + screenMode = WindowScreenOffMode::TIMEOUT; break; } case 1: { - screenMode = Dali::Window::ScreenOffMode::NEVER; + screenMode = WindowScreenOffMode::NEVER; break; } } diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h index 33f9d3d..6b673ef 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h @@ -332,17 +332,17 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetType() */ - void SetType( Dali::Window::Type type ) override; + void SetType( Dali::WindowType type ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel() */ - bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override; + bool SetNotificationLevel( Dali::WindowNotificationLevel level ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel() */ - Dali::Window::NotificationLevel::Type GetNotificationLevel() const override; + Dali::WindowNotificationLevel GetNotificationLevel() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState() @@ -352,12 +352,12 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode() */ - bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override; + bool SetScreenOffMode(WindowScreenOffMode screenOffMode) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode() */ - Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override; + WindowScreenOffMode GetScreenOffMode() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness() diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index 2ac9da8..0879f0f 100755 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -31,6 +31,7 @@ // EXTERNAL_HEADERS #include #include +#include #include #include #include @@ -480,7 +481,7 @@ static Eina_Bool EcoreEventEffectStart(void *data, int type, void *event) { if( effectStart->type < 3 ) // only under restack { - windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::START, static_cast( effectStart->type ) ); + windowBase->OnTransitionEffectEvent( WindowEffectState::START, static_cast( effectStart->type ) ); } } return ECORE_CALLBACK_PASS_ON; @@ -498,7 +499,7 @@ static Eina_Bool EcoreEventEffectEnd(void *data, int type, void *event) { if( effectEnd->type < 3 ) // only under restack { - windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::END, static_cast( effectEnd->type ) ); + windowBase->OnTransitionEffectEvent( WindowEffectState::END, static_cast( effectEnd->type ) ); } } return ECORE_CALLBACK_PASS_ON; @@ -1316,7 +1317,7 @@ void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, #endif } -void WindowBaseEcoreWl2::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type ) +void WindowBaseEcoreWl2::OnTransitionEffectEvent( WindowEffectState state, WindowEffectType type ) { mTransitionEffectEventSignal.Emit( state, type ); } @@ -1791,28 +1792,28 @@ void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion ) ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height ); } -void WindowBaseEcoreWl2::SetType( Dali::Window::Type type ) +void WindowBaseEcoreWl2::SetType( Dali::WindowType type ) { Ecore_Wl2_Window_Type windowType; switch( type ) { - case Dali::Window::NORMAL: + case Dali::WindowType::NORMAL: { windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL; break; } - case Dali::Window::NOTIFICATION: + case Dali::WindowType::NOTIFICATION: { windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION; break; } - case Dali::Window::UTILITY: + case Dali::WindowType::UTILITY: { windowType = ECORE_WL2_WINDOW_TYPE_UTILITY; break; } - case Dali::Window::DIALOG: + case Dali::WindowType::DIALOG: { windowType = ECORE_WL2_WINDOW_TYPE_DIALOG; break; @@ -1827,7 +1828,7 @@ void WindowBaseEcoreWl2::SetType( Dali::Window::Type type ) ecore_wl2_window_type_set( mEcoreWindow, windowType ); } -bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) +bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::WindowNotificationLevel level ) { while( !mTizenPolicy ) { @@ -1838,27 +1839,27 @@ bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel:: switch( level ) { - case Dali::Window::NotificationLevel::NONE: + case Dali::WindowNotificationLevel::NONE: { notificationLevel = TIZEN_POLICY_LEVEL_NONE; break; } - case Dali::Window::NotificationLevel::BASE: + case Dali::WindowNotificationLevel::BASE: { notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT; break; } - case Dali::Window::NotificationLevel::MEDIUM: + case Dali::WindowNotificationLevel::MEDIUM: { notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM; break; } - case Dali::Window::NotificationLevel::HIGH: + case Dali::WindowNotificationLevel::HIGH: { notificationLevel = TIZEN_POLICY_LEVEL_HIGH; break; } - case Dali::Window::NotificationLevel::TOP: + case Dali::WindowNotificationLevel::TOP: { notificationLevel = TIZEN_POLICY_LEVEL_TOP; break; @@ -1901,7 +1902,7 @@ bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel:: return true; } -Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const +Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const { while( !mTizenPolicy ) { @@ -1920,42 +1921,42 @@ Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() if( !mNotificationLevelChangeDone ) { DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState ); - return Dali::Window::NotificationLevel::NONE; + return Dali::WindowNotificationLevel::NONE; } - Dali::Window::NotificationLevel::Type level; + Dali::WindowNotificationLevel level; switch( mNotificationLevel ) { case TIZEN_POLICY_LEVEL_NONE: { - level = Dali::Window::NotificationLevel::NONE; + level = Dali::WindowNotificationLevel::NONE; break; } case TIZEN_POLICY_LEVEL_DEFAULT: { - level = Dali::Window::NotificationLevel::BASE; + level = Dali::WindowNotificationLevel::BASE; break; } case TIZEN_POLICY_LEVEL_MEDIUM: { - level = Dali::Window::NotificationLevel::MEDIUM; + level = Dali::WindowNotificationLevel::MEDIUM; break; } case TIZEN_POLICY_LEVEL_HIGH: { - level = Dali::Window::NotificationLevel::HIGH; + level = Dali::WindowNotificationLevel::HIGH; break; } case TIZEN_POLICY_LEVEL_TOP: { - level = Dali::Window::NotificationLevel::TOP; + level = Dali::WindowNotificationLevel::TOP; break; } default: { DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel ); - level = Dali::Window::NotificationLevel::NONE; + level = Dali::WindowNotificationLevel::NONE; break; } } @@ -1975,7 +1976,7 @@ void WindowBaseEcoreWl2::SetOpaqueState( bool opaque ) tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) ); } -bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) +bool WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode) { while( !mTizenPolicy ) { @@ -1989,12 +1990,12 @@ bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type scre switch( screenOffMode ) { - case Dali::Window::ScreenOffMode::TIMEOUT: + case WindowScreenOffMode::TIMEOUT: { mode = 0; break; } - case Dali::Window::ScreenOffMode::NEVER: + case WindowScreenOffMode::NEVER: { mode = 1; break; @@ -2028,7 +2029,7 @@ bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type scre return true; } -Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const +WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const { while( !mTizenPolicy ) { @@ -2047,21 +2048,21 @@ Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const if( !mScreenOffModeChangeDone ) { DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState ); - return Dali::Window::ScreenOffMode::TIMEOUT; + return WindowScreenOffMode::TIMEOUT; } - Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT; + WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT; switch( mScreenOffMode ) { case 0: { - screenMode = Dali::Window::ScreenOffMode::TIMEOUT; + screenMode = WindowScreenOffMode::TIMEOUT; break; } case 1: { - screenMode = Dali::Window::ScreenOffMode::NEVER; + screenMode = WindowScreenOffMode::NEVER; break; } } diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h index cceeabe..9ca8a30 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h @@ -159,7 +159,7 @@ public: /** * @brief Called when a transition effect-start/end event is received. */ - void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type ); + void OnTransitionEffectEvent( WindowEffectState state, WindowEffectType type ); /** * @brief Called when a keyboard repeat event is changed. @@ -364,17 +364,17 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetType() */ - void SetType( Dali::Window::Type type ) override; + void SetType( Dali::WindowType type ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel() */ - bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override; + bool SetNotificationLevel( Dali::WindowNotificationLevel level ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel() */ - Dali::Window::NotificationLevel::Type GetNotificationLevel() const override; + Dali::WindowNotificationLevel GetNotificationLevel() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState() @@ -384,12 +384,12 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode() */ - bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override; + bool SetScreenOffMode(WindowScreenOffMode screenOffMode) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode() */ - Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override; + WindowScreenOffMode GetScreenOffMode() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness() diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp index 69a3d1b..e6d4fa0 100755 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp @@ -767,32 +767,32 @@ void WindowBaseEcoreX::SetInputRegion( const Rect< int >& inputRegion ) { } -void WindowBaseEcoreX::SetType( Dali::Window::Type type ) +void WindowBaseEcoreX::SetType( Dali::WindowType type ) { } -bool WindowBaseEcoreX::SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) +bool WindowBaseEcoreX::SetNotificationLevel( Dali::WindowNotificationLevel level ) { return false; } -Dali::Window::NotificationLevel::Type WindowBaseEcoreX::GetNotificationLevel() const +Dali::WindowNotificationLevel WindowBaseEcoreX::GetNotificationLevel() const { - return Dali::Window::NotificationLevel::NONE; + return Dali::WindowNotificationLevel::NONE; } void WindowBaseEcoreX::SetOpaqueState( bool opaque ) { } -bool WindowBaseEcoreX::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) +bool WindowBaseEcoreX::SetScreenOffMode(WindowScreenOffMode screenOffMode) { return false; } -Dali::Window::ScreenOffMode::Type WindowBaseEcoreX::GetScreenOffMode() const +WindowScreenOffMode WindowBaseEcoreX::GetScreenOffMode() const { - return Dali::Window::ScreenOffMode::TIMEOUT; + return WindowScreenOffMode::TIMEOUT; } bool WindowBaseEcoreX::SetBrightness( int brightness ) diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h index 601738b..948740f 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h @@ -266,17 +266,17 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetType() */ - void SetType( Dali::Window::Type type ) override; + void SetType( Dali::WindowType type ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel() */ - bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override; + bool SetNotificationLevel( Dali::WindowNotificationLevel level ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel() */ - Dali::Window::NotificationLevel::Type GetNotificationLevel() const override; + Dali::WindowNotificationLevel GetNotificationLevel() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState() @@ -286,12 +286,12 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode() */ - bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override; + bool SetScreenOffMode(WindowScreenOffMode screenOffMode) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode() */ - Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override; + WindowScreenOffMode GetScreenOffMode() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness() diff --git a/dali/internal/window-system/windows/window-base-win.cpp b/dali/internal/window-system/windows/window-base-win.cpp index 706c262..00d671a 100755 --- a/dali/internal/window-system/windows/window-base-win.cpp +++ b/dali/internal/window-system/windows/window-base-win.cpp @@ -372,32 +372,32 @@ void WindowBaseWin::SetInputRegion( const Rect< int >& inputRegion ) { } -void WindowBaseWin::SetType( Dali::Window::Type type ) +void WindowBaseWin::SetType( Dali::WindowType type ) { } -bool WindowBaseWin::SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) +bool WindowBaseWin::SetNotificationLevel( Dali::WindowNotificationLevel level ) { return false; } -Dali::Window::NotificationLevel::Type WindowBaseWin::GetNotificationLevel() const +Dali::WindowNotificationLevel WindowBaseWin::GetNotificationLevel() const { - return Dali::Window::NotificationLevel::NONE; + return Dali::WindowNotificationLevel::NONE; } void WindowBaseWin::SetOpaqueState( bool opaque ) { } -bool WindowBaseWin::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) +bool WindowBaseWin::SetScreenOffMode(WindowScreenOffMode screenOffMode) { return false; } -Dali::Window::ScreenOffMode::Type WindowBaseWin::GetScreenOffMode() const +WindowScreenOffMode WindowBaseWin::GetScreenOffMode() const { - return Dali::Window::ScreenOffMode::TIMEOUT; + return WindowScreenOffMode::TIMEOUT; } bool WindowBaseWin::SetBrightness( int brightness ) diff --git a/dali/internal/window-system/windows/window-base-win.h b/dali/internal/window-system/windows/window-base-win.h index d93153b..2c60cb3 100755 --- a/dali/internal/window-system/windows/window-base-win.h +++ b/dali/internal/window-system/windows/window-base-win.h @@ -254,17 +254,17 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetType() */ - void SetType( Dali::Window::Type type ) override; + void SetType( Dali::WindowType type ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel() */ - bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override; + bool SetNotificationLevel( Dali::WindowNotificationLevel level ) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel() */ - Dali::Window::NotificationLevel::Type GetNotificationLevel() const override; + Dali::WindowNotificationLevel GetNotificationLevel() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState() @@ -274,12 +274,12 @@ public: /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode() */ - bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override; + bool SetScreenOffMode(WindowScreenOffMode screenOffMode) override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode() */ - Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override; + WindowScreenOffMode GetScreenOffMode() const override; /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness() diff --git a/dali/public-api/adaptor-framework/window-enumerations.h b/dali/public-api/adaptor-framework/window-enumerations.h new file mode 100644 index 0000000..0abae45 --- /dev/null +++ b/dali/public-api/adaptor-framework/window-enumerations.h @@ -0,0 +1,98 @@ +#ifndef DALI_WINDOW_ENUMERATIONS_H +#define DALI_WINDOW_ENUMERATIONS_H + +/* + * Copyright (c) 2020 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. + * + */ + +namespace Dali +{ +/** + * @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. + * + * This Enumeration is used the available orientation APIs and the preferred orientation. + * + * @SINCE_2_0.0 + */ +enum class WindowOrientation +{ + PORTRAIT = 0, ///< Portrait orientation. The height of the display area is greater than the width. @SINCE_2_0.0 + LANDSCAPE = 90, ///< Landscape orientation. A wide view area is needed. @SINCE_2_0.0 + PORTRAIT_INVERSE = 180, ///< Portrait inverse orientation. @SINCE_2_0.0 + LANDSCAPE_INVERSE = 270, ///< Landscape inverse orientation. @SINCE_2_0.0 + NO_ORIENTATION_PREFERENCE = -1 ///< No orientation. It is used to initialize or unset the preferred orientation. @SINCE_2_0.0 +}; + +/** + * @brief An enum of Window types. + * @SINCE_2_0.0 + */ +enum class WindowType +{ + NORMAL, ///< A default window type. Indicates a normal, top-level window. Almost every window will be created with this type. @SINCE_2_0.0 + NOTIFICATION, ///< A notification window, like a warning about battery life or a new E-Mail received. @SINCE_2_0.0 + UTILITY, ///< A persistent utility window, like a toolbox or palette. @SINCE_2_0.0 + DIALOG ///< Used for simple dialog windows. @SINCE_2_0.0 +}; + +/** + * @brief An enum of notification level. + * @SINCE_2_0.0 + */ +enum class WindowNotificationLevel +{ + NONE = -1, ///< No notification level. Default level. This value makes the notification window place in the layer of the normal window. @SINCE_2_0.0 + BASE = 10, ///< Base notification level. @SINCE_2_0.0 + MEDIUM = 20, ///< Higher notification level than base. @SINCE_2_0.0 + HIGH = 30, ///< Higher notification level than medium. @SINCE_2_0.0 + TOP = 40 ///< The highest notification level. @SINCE_2_0.0 +}; + +/** + * @brief An enum of screen mode. + * @SINCE_2_0.0 + */ +enum class WindowScreenOffMode +{ + TIMEOUT, ///< The mode which turns the screen off after a timeout. @SINCE_2_0.0 + NEVER, ///< The mode which keeps the screen turned on. @SINCE_2_0.0 +}; + +/** + * @brief Enumeration for transition effect's state. + * @SINCE_2_0.0 + */ +enum class WindowEffectState +{ + NONE = 0, ///< None state. @SINCE_2_0.0 + START, ///< Transition effect is started. @SINCE_2_0.0 + END ///< Transition effect is ended. @SINCE_2_0.0 +}; + +/** + * @brief Enumeration for transition effect's type. + * @SINCE_2_0.0 + */ +enum class WindowEffectType +{ + NONE = 0, ///< None type. @SINCE_2_0.0 + SHOW, ///< Window show effect. @SINCE_2_0.0 + HIDE, ///< Window hide effect. @SINCE_2_0.0 +}; + +} + +#endif // DALI_WINDOW_ENUMERATIONS_H diff --git a/dali/public-api/adaptor-framework/window.cpp b/dali/public-api/adaptor-framework/window.cpp index 6895bae..f1b67fe 100644 --- a/dali/public-api/adaptor-framework/window.cpp +++ b/dali/public-api/adaptor-framework/window.cpp @@ -158,7 +158,7 @@ void Window::SetPreferredOrientation(WindowOrientation orientation) GetImplementation(*this).SetPreferredOrientation(orientation); } -Dali::Window::WindowOrientation Window::GetPreferredOrientation() +WindowOrientation Window::GetPreferredOrientation() { return GetImplementation(*this).GetPreferredOrientation(); } @@ -238,22 +238,22 @@ void Window::SetInputRegion(const Rect& inputRegion) return GetImplementation(*this).SetInputRegion(inputRegion); } -void Window::SetType(Window::Type type) +void Window::SetType(WindowType type) { GetImplementation(*this).SetType(type); } -Window::Type Window::GetType() const +WindowType Window::GetType() const { return GetImplementation(*this).GetType(); } -bool Window::SetNotificationLevel(Window::NotificationLevel::Type level) +bool Window::SetNotificationLevel(WindowNotificationLevel level) { return GetImplementation(*this).SetNotificationLevel(level); } -Window::NotificationLevel::Type Window::GetNotificationLevel() const +WindowNotificationLevel Window::GetNotificationLevel() const { return GetImplementation(*this).GetNotificationLevel(); } @@ -268,12 +268,12 @@ bool Window::IsOpaqueState() const return GetImplementation(*this).IsOpaqueState(); } -bool Window::SetScreenOffMode(Window::ScreenOffMode::Type screenMode) +bool Window::SetScreenOffMode(WindowScreenOffMode screenMode) { return GetImplementation(*this).SetScreenOffMode(screenMode); } -Window::ScreenOffMode::Type Window::GetScreenOffMode() const +WindowScreenOffMode Window::GetScreenOffMode() const { return GetImplementation(*this).GetScreenOffMode(); } diff --git a/dali/public-api/adaptor-framework/window.h b/dali/public-api/adaptor-framework/window.h index ba38eda..527da6b 100644 --- a/dali/public-api/adaptor-framework/window.h +++ b/dali/public-api/adaptor-framework/window.h @@ -26,6 +26,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -78,74 +79,6 @@ public: using TouchEventSignalType = Signal; ///< Touch signal type @SINCE_1_9.28 public: - // Enumerations - - /** - * @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. - * - * This Enumeration is used the available orientation APIs and the preferred orientation. - * - * @SINCE_1_0.0 - */ - enum WindowOrientation - { - PORTRAIT = 0, ///< Portrait orientation. The height of the display area is greater than the width. @SINCE_1_0.0 - LANDSCAPE = 90, ///< Landscape orientation. A wide view area is needed. @SINCE_1_0.0 - PORTRAIT_INVERSE = 180, ///< Portrait inverse orientation @SINCE_1_0.0 - LANDSCAPE_INVERSE = 270, ///< Landscape inverse orientation @SINCE_1_0.0 - NO_ORIENTATION_PREFERENCE = -1 ///< No orientation. It is used to initialize or unset the preferred orientation. @SINCE_1_4.51 - }; - - /** - * @brief An enum of Window types. - * @SINCE_1_2.60 - */ - enum Type - { - NORMAL, ///< A default window type. Indicates a normal, top-level window. Almost every window will be created with this type. @SINCE_1_2.60 - NOTIFICATION, ///< A notification window, like a warning about battery life or a new E-Mail received. @SINCE_1_2.60 - UTILITY, ///< A persistent utility window, like a toolbox or palette. @SINCE_1_2.60 - DIALOG ///< Used for simple dialog windows. @SINCE_1_2.60 - }; - - /** - * @brief An enum of screen mode. - * @SINCE_1_2.60 - */ - struct NotificationLevel - { - /** - * @brief An enum of screen mode. - * @SINCE_1_2.60 - */ - enum Type - { - NONE = -1, ///< No notification level. Default level. This value makes the notification window place in the layer of the normal window. @SINCE_1_2.60 - BASE = 10, ///< Base notification level. @SINCE_1_2.60 - MEDIUM = 20, ///< Higher notification level than base. @SINCE_1_2.60 - HIGH = 30, ///< Higher notification level than medium. @SINCE_1_2.60 - TOP = 40 ///< The highest notification level. @SINCE_1_2.60 - }; - }; - - /** - * @brief An enum of screen mode. - * @SINCE_1_2.60 - */ - struct ScreenOffMode - { - /** - * @brief An enum of screen mode. - * @SINCE_1_2.60 - */ - enum Type - { - TIMEOUT, ///< The mode which turns the screen off after a timeout. @SINCE_1_2.60 - NEVER, ///< The mode which keeps the screen turned on. @SINCE_1_2.60 - }; - - static constexpr Type DEFAULT{TIMEOUT}; ///< The default mode. @SINCE_1_2.60 - }; // Methods @@ -471,37 +404,37 @@ public: /** * @brief Sets a window type. - * @SINCE_1_2.60 + * @@SINCE_2_0.0 * @param[in] type The window type. * @remarks The default window type is NORMAL. */ - void SetType(Type type); + void SetType(WindowType type); /** * @brief Gets a window type. - * @SINCE_1_2.60 + * @@SINCE_2_0.0 * @return A window type. */ - Type GetType() const; + WindowType GetType() const; /** * @brief Sets a priority level for the specified notification window. - * @SINCE_1_2.60 + * @@SINCE_2_0.0 * @param[in] level The notification window level. * @return True if no error occurred, false otherwise. * @PRIVLEVEL_PUBLIC * @PRIVILEGE_WINDOW_PRIORITY * @remarks This can be used for a notification type window only. The default level is NotificationLevel::NONE. */ - bool SetNotificationLevel(NotificationLevel::Type level); + bool SetNotificationLevel(WindowNotificationLevel level); /** * @brief Gets a priority level for the specified notification window. - * @SINCE_1_2.60 + * @@SINCE_2_0.0 * @return The notification window level. * @remarks This can be used for a notification type window only. */ - NotificationLevel::Type GetNotificationLevel() const; + WindowNotificationLevel GetNotificationLevel() const; /** * @brief Sets a transparent window's visual state to opaque. @@ -525,23 +458,23 @@ public: /** * @brief Sets a window's screen off mode. * @details This API is useful when the application needs to keep the display turned on. - * If the application sets the screen mode to #::Dali::Window::ScreenOffMode::NEVER to its window and the window is shown, + * If the application sets the screen mode to #::Dali::WindowScreenOffMode::NEVER to its window and the window is shown, * the window manager requests the display system to keep the display on as long as the window is shown. * If the window is no longer shown, then the window manager requests the display system to go back to normal operation. - * @SINCE_1_2.60 + * @@SINCE_2_0.0 * @param[in] screenOffMode The screen mode. * @return True if no error occurred, false otherwise. * @PRIVLEVEL_PUBLIC * @PRIVILEGE_DISPLAY */ - bool SetScreenOffMode(ScreenOffMode::Type screenOffMode); + bool SetScreenOffMode(WindowScreenOffMode screenOffMode); /** * @brief Gets a screen off mode of the window. - * @SINCE_1_2.60 + * @@SINCE_2_0.0 * @return The screen off mode. */ - ScreenOffMode::Type GetScreenOffMode() const; + WindowScreenOffMode GetScreenOffMode() const; /** * @brief Sets preferred brightness of the window. diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index ea39b21..3c446ed 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -25,9 +25,9 @@ namespace Dali { -const unsigned int ADAPTOR_MAJOR_VERSION = 1; -const unsigned int ADAPTOR_MINOR_VERSION = 9; -const unsigned int ADAPTOR_MICRO_VERSION = 35; +const unsigned int ADAPTOR_MAJOR_VERSION = 2; +const unsigned int ADAPTOR_MINOR_VERSION = 0; +const unsigned int ADAPTOR_MICRO_VERSION = 0; const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/dali/public-api/file.list b/dali/public-api/file.list index 1cfdafd..4453a21 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -35,6 +35,7 @@ SET( public_api_adaptor_framework_header_files ${adaptor_public_api_dir}/adaptor-framework/widget.h ${adaptor_public_api_dir}/adaptor-framework/widget-application.h ${adaptor_public_api_dir}/adaptor-framework/widget-impl.h + ${adaptor_public_api_dir}/adaptor-framework/window-enumerations.h ) diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index d435c1b..e829bcf 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -17,7 +17,7 @@ Name: dali2-adaptor Summary: The DALi Tizen Adaptor -Version: 1.9.35 +Version: 2.0.0 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT @@ -102,6 +102,9 @@ BuildRequires: pkgconfig(ecore-imf) BuildRequires: pkgconfig(capi-system-system-settings) +# for ATSPI (Accessibility) support +BuildRequires: pkgconfig(eldbus) + # for feedback plugin BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(feedback) @@ -260,7 +263,7 @@ CXXFLAGS+=" -D_ARCH_ARM_ -lgcc" CFLAGS+=" -DWAYLAND" CXXFLAGS+=" -DWAYLAND" -cmake_flags=" -DENABLE_WAYLAND=ON" +cmake_flags=" -DENABLE_WAYLAND=ON -DENABLE_ATSPI=OFF" # Use this conditional when Tizen version is 5.x or greater %if 0%{?tizen_version_major} >= 5