[AT-SPI] Remove Bridge::EnableAutoInit() arguments 12/258012/2
authorArtur Świgoń <a.swigon@samsung.com>
Fri, 7 May 2021 10:59:37 +0000 (12:59 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 14 May 2021 07:59:12 +0000 (07:59 +0000)
The values `topLevelWindow` and `applicationName` can be retrieved using
(internal) dali-adaptor API. This will simplify upcoming C# bindings and
make this API easier to use in NUI applications.

This patch also fixes a possible bug where WindowEvent::ACTIVATE is not
sent over DBus.

Change-Id: I3305e400d85876e6f50d5e7b3a5453dcc6d885b2

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

index 31226a6..c2741d2 100644 (file)
@@ -294,9 +294,6 @@ struct DALI_ADAPTOR_API Bridge
   /**
    * @brief Re-enables auto-initialization of AT-SPI bridge
    *
-   * @param topLevelWindow Accessible object for Scene::GetRootLayer()
-   * @param applicationName Application name
-   *
    * Normal applications do not have to call this function. GetCurrentBridge() tries to
    * initialize the AT-SPI bridge when it is called for the first time.
    *
@@ -304,7 +301,7 @@ struct DALI_ADAPTOR_API Bridge
    * @see Dali::Accessibility::Bridge::AddTopLevelWindow
    * @see Dali::Accessibility::Bridge::SetApplicationName
    */
-  static void EnableAutoInit(Accessible* topLevelWindow, const std::string& applicationName);
+  static void EnableAutoInit();
 
 protected:
   struct Data
index ea95081..216b89b 100644 (file)
@@ -18,6 +18,8 @@
 // CLASS HEADER
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/actors/layer.h>
+#include <dali/devel-api/common/stage.h>
 #include <dali/integration-api/debug.h>
 #include <iostream>
 #include <unordered_map>
 #include <dali/internal/accessibility/bridge/bridge-text.h>
 #include <dali/internal/accessibility/bridge/bridge-value.h>
 #include <dali/internal/accessibility/bridge/dummy-atspi.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/system/common/environment-variables.h>
 #include <dali/devel-api/adaptor-framework/environment-variable.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
 
 using namespace Dali::Accessibility;
 
@@ -394,7 +398,7 @@ void Bridge::DisableAutoInit()
   autoInitState = AutoInitState::DISABLED;
 }
 
-void Bridge::EnableAutoInit(Accessible* topLevelWindow, const std::string& applicationName)
+void Bridge::EnableAutoInit()
 {
   autoInitState = AutoInitState::ENABLED;
 
@@ -403,8 +407,17 @@ void Bridge::EnableAutoInit(Accessible* topLevelWindow, const std::string& appli
     return;
   }
 
+  auto rootLayer = Dali::Stage::GetCurrent().GetRootLayer();
+  auto window = Dali::DevelWindow::Get(rootLayer);
+  auto applicationName = Dali::Internal::Adaptor::Adaptor::GetApplicationPackageName();
+
   auto* bridge = Bridge::GetCurrentBridge();
-  bridge->AddTopLevelWindow(topLevelWindow);
+  bridge->AddTopLevelWindow(Dali::Accessibility::Accessible::Get(rootLayer, true));
   bridge->SetApplicationName(applicationName);
   bridge->Initialize();
+
+  if(window && window.IsVisible())
+  {
+    bridge->ApplicationShown();
+  }
 }
index cd7dbec..d63b02a 100644 (file)
@@ -79,7 +79,7 @@ void Accessibility::Bridge::DisableAutoInit()
 {
 }
 
-void Accessibility::Bridge::EnableAutoInit(Accessible*, const std::string&)
+void Accessibility::Bridge::EnableAutoInit()
 {
 }