[AT-SPI] Add ScreenReaderEnabled, Disabled 48/272348/2
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 15 Mar 2022 06:40:58 +0000 (15:40 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 16 Mar 2022 10:04:24 +0000 (19:04 +0900)
ScreenReaderEnabled should be distinguished from IsEnabled.
This is because there are things to do only when the screen reader is enabled.

Change-Id: Ibd9fd26380ef09b8c795696d9f320e0056c2bc41

dali/devel-api/adaptor-framework/accessibility-bridge.h
dali/devel-api/adaptor-framework/atspi-accessibility.cpp
dali/devel-api/adaptor-framework/atspi-accessibility.h
dali/internal/accessibility/bridge/bridge-impl.cpp

index a35fe31..21296d3 100644 (file)
@@ -401,6 +401,16 @@ struct DALI_ADAPTOR_API Bridge
     return mDisabledSignal;
   }
 
+  static Signal<void()>& ScreenReaderEnabledSignal()
+  {
+    return mScreenReaderEnabledSignal;
+  }
+
+  static Signal<void()>& ScreenReaderDisabledSignal()
+  {
+    return mScreenReaderDisabledSignal;
+  }
+
 protected:
   struct Data
   {
@@ -423,6 +433,8 @@ protected:
 
   inline static Signal<void()> mEnabledSignal;
   inline static Signal<void()> mDisabledSignal;
+  inline static Signal<void()> mScreenReaderEnabledSignal;
+  inline static Signal<void()> mScreenReaderDisabledSignal;
 
   /**
    * @brief Registers accessible object to be known in bridge object.
index 53a230d..1adebe7 100644 (file)
@@ -118,3 +118,8 @@ bool Dali::AtspiAccessibility::IsEnabled()
 {
   return Dali::Accessibility::IsUp();
 }
+
+bool Dali::AtspiAccessibility::IsScreenReaderEnabled()
+{
+  return Dali::Accessibility::Bridge::GetCurrentBridge()->GetScreenReaderEnabled();
+}
\ No newline at end of file
index 16f1e37..3ee0674 100644 (file)
@@ -87,6 +87,13 @@ DALI_ADAPTOR_API int GetStatus();
  */
 DALI_ADAPTOR_API bool IsEnabled();
 
+/**
+ * @brief Returns whether the state of Screen Reader is enabled or not.
+ *
+ * @return True if Screen Reader is enabled, false otherwise.
+ */
+DALI_ADAPTOR_API bool IsScreenReaderEnabled();
+
 } //namespace AtspiAccessibility
 } //namespace Dali
 
index a5bde9c..817b445 100644 (file)
@@ -585,10 +585,23 @@ public:
     });
   }
 
+  void EmitScreenReaderEnabledSignal()
+  {
+    if (mIsScreenReaderEnabled)
+    {
+      mScreenReaderEnabledSignal.Emit();
+    }
+    else
+    {
+      mScreenReaderDisabledSignal.Emit();
+    }
+  }
+
   void ListenScreenReaderEnabledProperty()
   {
     mAccessibilityStatusClient.addPropertyChangedEvent<bool>("ScreenReaderEnabled", [this](bool res) {
       mIsScreenReaderEnabled = res;
+      EmitScreenReaderEnabledSignal();
       SwitchBridge();
     });
   }