DALi Version 1.2.31
[platform/core/uifw/dali-adaptor.git] / adaptors / mobile / accessibility-adaptor-impl-mobile.cpp
index 77c0f01..01656e1 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <vconf.h>
+
+#ifndef WAYLAND
 #include <Ecore_X.h>
 #include <Elementary.h>
+#endif
+
 #include <vconf.h>
 
 #include <dali/public-api/object/type-registry.h>
@@ -33,7 +37,9 @@
 #include <singleton-service-impl.h>
 #include "system-settings.h"
 
+#ifndef WAYLAND
 #define MSG_DOMAIN_CONTROL_ACCESS (int)ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL
+#endif
 
 namespace Dali
 {
@@ -85,16 +91,25 @@ void AccessibilityOnOffNotification(keynode_t* node, void* data)
   }
 }
 
-BaseHandle Create()
+} // unnamed namespace
+
+Dali::AccessibilityAdaptor AccessibilityAdaptor::Get()
 {
-  BaseHandle handle( AccessibilityAdaptor::Get() );
+  Dali::AccessibilityAdaptor adaptor;
 
-  if ( !handle )
+  Dali::SingletonService service( SingletonService::Get() );
+  if ( service )
   {
-    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
     {
-      Dali::AccessibilityAdaptor adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() );
+      adaptor = Dali::AccessibilityAdaptor( new AccessibilityAdaptorMobile() );
       AccessibilityAdaptorMobile& adaptorImpl = AccessibilityAdaptorMobile::GetImplementation( adaptor );
 
       bool isEnabled = GetEnabledVConf();
@@ -109,30 +124,6 @@ BaseHandle Create()
       vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, &adaptorImpl );
 
       service.Register( typeid( adaptor ), adaptor );
-      handle = adaptor;
-    }
-  }
-
-  return handle;
-}
-
-TypeRegistration ACCESSIBILITY_ADAPTOR_TYPE( typeid(Dali::AccessibilityAdaptor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
-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() ) );
     }
   }
 
@@ -153,6 +144,7 @@ bool AccessibilityAdaptorMobile::HandleActionNextEvent(bool allowEndFeedback)
 {
   bool ret = false;
 
+#ifndef WAYLAND
   if( mIndicator && mIndicatorFocused )
   {
     Elm_Access_Action_Info actionInfo;
@@ -161,6 +153,9 @@ bool AccessibilityAdaptorMobile::HandleActionNextEvent(bool allowEndFeedback)
     ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
   }
   else if( mActionHandler )
+#else
+  if( mActionHandler )
+#endif
   {
     ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
   }
@@ -174,6 +169,7 @@ bool AccessibilityAdaptorMobile::HandleActionPreviousEvent(bool allowEndFeedback
 {
   bool ret = false;
 
+#ifndef WAYLAND
   if( mIndicator && mIndicatorFocused )
   {
     Elm_Access_Action_Info actionInfo;
@@ -182,6 +178,9 @@ bool AccessibilityAdaptorMobile::HandleActionPreviousEvent(bool allowEndFeedback
     ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
   }
   else if( mActionHandler )
+#else
+  if( mActionHandler )
+#endif
   {
     ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback);
   }
@@ -195,6 +194,7 @@ bool AccessibilityAdaptorMobile::HandleActionActivateEvent()
 {
   bool ret = false;
 
+#ifndef WAYLAND
   if( mIndicator && mIndicatorFocused )
   {
     Elm_Access_Action_Info actionInfo;
@@ -203,6 +203,9 @@ bool AccessibilityAdaptorMobile::HandleActionActivateEvent()
     ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
   }
   else if( mActionHandler )
+#else
+  if( mActionHandler )
+#endif
   {
     ret = mActionHandler->AccessibilityActionActivate();
   }
@@ -255,12 +258,14 @@ bool AccessibilityAdaptorMobile::HandleActionReadEvent(unsigned int x, unsigned
     }
     else if( mIndicatorFocused && !indicatorFocused )
     {
+#ifndef WAYLAND
       Elm_Access_Action_Info actionInfo;
       actionInfo.action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
 
       // Indicator should be unhighlighted
       ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
       DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send unhighlight message to indicator!!!!\n", __FUNCTION__, __LINE__);
+#endif
     }
 
     mIndicatorFocused = indicatorFocused;
@@ -268,6 +273,7 @@ bool AccessibilityAdaptorMobile::HandleActionReadEvent(unsigned int x, unsigned
     // Send accessibility READ action information to Indicator
     if( mIndicatorFocused )
     {
+#ifndef WAYLAND
       Elm_Access_Action_Info actionInfo;
       actionInfo.x = mReadPosition.x;
       actionInfo.y = mReadPosition.y;
@@ -284,6 +290,7 @@ bool AccessibilityAdaptorMobile::HandleActionReadEvent(unsigned int x, unsigned
       ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
 
       DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__);
+#endif
     }
   }
 
@@ -302,6 +309,7 @@ bool AccessibilityAdaptorMobile::HandleActionReadNextEvent(bool allowEndFeedback
 {
   bool ret = false;
 
+#ifndef WAYLAND
   if( mIndicator && mIndicatorFocused )
   {
     Elm_Access_Action_Info actionInfo;
@@ -310,6 +318,9 @@ bool AccessibilityAdaptorMobile::HandleActionReadNextEvent(bool allowEndFeedback
     ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
   }
   else if( mActionHandler )
+#else
+  if( mActionHandler )
+#endif
   {
     ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback);
   }
@@ -323,6 +334,7 @@ bool AccessibilityAdaptorMobile::HandleActionReadPreviousEvent(bool allowEndFeed
 {
   bool ret = false;
 
+#ifndef WAYLAND
   if( mIndicator && mIndicatorFocused )
   {
     Elm_Access_Action_Info actionInfo;
@@ -331,6 +343,9 @@ bool AccessibilityAdaptorMobile::HandleActionReadPreviousEvent(bool allowEndFeed
     ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
   }
   else if( mActionHandler )
+#else
+  if( mActionHandler )
+#endif
   {
     ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback);
   }
@@ -344,6 +359,7 @@ bool AccessibilityAdaptorMobile::HandleActionUpEvent()
 {
   bool ret = false;
 
+#ifndef WAYLAND
   if( mIndicator && mIndicatorFocused )
   {
     Elm_Access_Action_Info actionInfo;
@@ -352,6 +368,9 @@ bool AccessibilityAdaptorMobile::HandleActionUpEvent()
     ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
   }
   else if( mActionHandler )
+#else
+  if( mActionHandler )
+#endif
   {
     ret = mActionHandler->AccessibilityActionUp();
   }
@@ -365,6 +384,7 @@ bool AccessibilityAdaptorMobile::HandleActionDownEvent()
 {
   bool ret = false;
 
+#ifndef WAYLAND
   if( mIndicator && mIndicatorFocused )
   {
     Elm_Access_Action_Info actionInfo;
@@ -373,6 +393,9 @@ bool AccessibilityAdaptorMobile::HandleActionDownEvent()
     ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
   }
   else if( mActionHandler )
+#else
+  if( mActionHandler )
+#endif
   {
     ret = mActionHandler->AccessibilityActionDown();
   }