[AT-SPI] Add Bridge::{Enabled,Disabled}Signal() 49/266049/2
authorArtur Świgoń <a.swigon@samsung.com>
Thu, 4 Nov 2021 19:11:39 +0000 (20:11 +0100)
committerArtur Świgoń <a.swigon@samsung.com>
Tue, 9 Nov 2021 10:46:29 +0000 (11:46 +0100)
These signals are emitted whenever the AT-SPI bridge is turned on or
off. Note that `EnabledSignal` is only emitted for the first `ForceUp`
call, i.e. the one that returns `ForceUpResult::JUST_STARTED` (and
a similar story for `DisabledSignal`).

These signals are necessarily static members of `Bridge`, to guarantee
that they are delivered to consumers even in those use cases in which
the object returned by `GetCurrentBridge()` changes during the lifetime
of the application.

Change-Id: Id266b7ed064b8b2690e093804c3f7d23ac4347ce

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

index dfe1f6b..34cc946 100644 (file)
@@ -364,6 +364,16 @@ struct DALI_ADAPTOR_API Bridge
    */
   static void EnableAutoInit();
 
+  static Signal<void()>& EnabledSignal()
+  {
+    return mEnabledSignal;
+  }
+
+  static Signal<void()>& DisabledSignal()
+  {
+    return mDisabledSignal;
+  }
+
 protected:
   struct Data
   {
@@ -384,6 +394,9 @@ protected:
 
   inline static AutoInitState mAutoInitState = AutoInitState::ENABLED;
 
+  inline static Signal<void()> mEnabledSignal;
+  inline static Signal<void()> mDisabledSignal;
+
   /**
    * @brief Registers accessible object to be known in bridge object.
    *
index a4144ab..181b440 100644 (file)
@@ -208,6 +208,8 @@ public:
       }
       mData->mCurrentlyHighlightedActor = {};
       mData->mHighlightActor            = {};
+
+      mDisabledSignal.Emit();
     }
     mHighlightedActor     = {};
     mHighlightClearAction = {};
@@ -289,6 +291,9 @@ public:
     {
       EmitActivate();
     }
+
+    mEnabledSignal.Emit();
+
     return ForceUpResult::JUST_STARTED;
   }