[Tizen][AT-SPI] Unify widget bus names 09/314509/7 accepted/tizen/7.0/unified/20240802.162019
authorArtur Świgoń <a.swigon@samsung.com>
Fri, 12 Jul 2024 10:09:37 +0000 (12:09 +0200)
committerMaria Białota <m.bialota@samsung.com>
Wed, 24 Jul 2024 10:25:27 +0000 (10:25 +0000)
This enables cross-toolkit embedding (e.g. an EFL widget inside NUI app).

Change-Id: If0efe85d37a6da9805819e287d6a8a73e0b76119

dali/devel-api/adaptor-framework/accessibility-bridge.h
dali/internal/accessibility/bridge/bridge-impl.cpp
dali/internal/accessibility/bridge/dummy/dummy-atspi.cpp
dali/internal/accessibility/bridge/dummy/dummy-atspi.h
dali/internal/system/tizen-wayland/widget-controller-tizen.cpp

index 2ad9d38274a1ebdf195b962291a7162c4ba873ed..31d73b332337c90f71850b444df4221770b6d074 100644 (file)
@@ -398,17 +398,6 @@ struct DALI_ADAPTOR_API Bridge
    */
   virtual Address EmbedSocket(const Address& plug, const Address& socket) = 0;
 
-  /**
-   * @brief Calls socket.Embedded(plug) via D-Bus.
-   *
-   * The "Embedded" D-Bus method is an ATK extension.
-   * See 'impl_Embedded' in AT_SPI2_ATK/atk-adaptor/adaptors/socket-adaptor.c for more information.
-   *
-   * @param[in] plug The plug
-   * @param[in] socket The socket
-   */
-  virtual void EmbedAtkSocket(const Address& plug, const Address& socket) = 0;
-
   /**
    * @brief Calls socket.Unmbed(plug) via D-Bus.
    *
@@ -501,11 +490,12 @@ struct DALI_ADAPTOR_API Bridge
    * @brief Encodes a widget ID as a usable bus name.
    *
    * @param widgetInstanceId The instance ID of a widget
+   * @param widgetProcessId The process ID (PID) of the widget
    * @return std::string Encoded bus name
    *
    * @see SetPreferredBusName
    */
-  static std::string MakeBusNameForWidget(std::string_view widgetInstanceId);
+  static std::string MakeBusNameForWidget(std::string_view widgetInstanceId, int widgetProcessId);
 
   static Signal<void()>& EnabledSignal()
   {
index ff92445197079262b5c8275ea2cdbf9139bf1fc1..0ab4f99313e839112678fd04c828d169f391bfd5 100644 (file)
@@ -750,13 +750,6 @@ public:
     return std::get<0>(reply.getValues());
   }
 
-  void EmbedAtkSocket(const Address& plug, const Address& socket) override
-  {
-    auto client = CreateSocketClient(socket);
-
-    client.method<void(std::string)>("Embedded").asyncCall([](DBus::ValueOrError<void>) {}, ATSPI_PREFIX_PATH + plug.GetPath());
-  }
-
   void UnembedSocket(const Address& plug, const Address& socket) override
   {
     auto client = CreateSocketClient(socket);
@@ -930,12 +923,12 @@ void Bridge::EnableAutoInit()
   }
 }
 
-std::string Bridge::MakeBusNameForWidget(std::string_view widgetInstanceId)
+std::string Bridge::MakeBusNameForWidget(std::string_view widgetInstanceId, int widgetProcessId)
 {
   // The bus name should consist of dot-separated alphanumeric elements, e.g. "com.example.BusName123".
-  // Allowed characters in each element: "[A-Z][a-z][0-9]_", but no element may start with a digit.
+  // Allowed characters in each element: "[A-Z][a-z][0-9]_-", but no element may start with a digit.
 
-  static const char prefix[]   = "com.samsung.dali.widget_";
+  static const char prefix[]   = "elm.atspi.proxy.socket-";
   static const char underscore = '_';
 
   std::stringstream tmp;
@@ -944,8 +937,10 @@ std::string Bridge::MakeBusNameForWidget(std::string_view widgetInstanceId)
 
   for(char ch : widgetInstanceId)
   {
-    tmp << (std::isalnum(ch) ? ch : underscore);
+    tmp << (!std::isalnum(ch) && ch != '_' && ch != '-' && ch != '.' ? underscore : ch);
   }
 
+  tmp << '-' << widgetProcessId;
+
   return tmp.str();
 }
index c13506f7c7db8df5524bdb84fda10d27d92d0a46..5c73bf7a99736d1c0a60695b2d809af122f56045 100644 (file)
@@ -88,7 +88,7 @@ void Accessibility::Bridge::EnableAutoInit()
 {
 }
 
-std::string MakeBusNameForWidget(std::string_view widgetInstanceId)
+std::string MakeBusNameForWidget(std::string_view widgetInstanceId, int widgetProcessId)
 {
   return std::string{widgetInstanceId};
 }
index c56e29ac13de20f7689e6a43e366bb83169bbd1b..d383887da3bc492a3d8fc5ae19a95cecd3b75710 100644 (file)
@@ -198,10 +198,6 @@ struct DummyBridge : Dali::Accessibility::Bridge
     return {};
   }
 
-  void EmbedAtkSocket(const Address& plug, const Address& socket) override
-  {
-  }
-
   void UnembedSocket(const Address& plug, const Address& socket) override
   {
   }
index 311df34e61ca5a6812bc440fcd047d40cefc528e..40d5891f7a41ce4495877e36d7360b3728bd8e34 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/layer.h>
 #include <bundle.h>
+#include <unistd.h>
 #include <widget_base.h>
 
 // INTERNAL INCLUDES
@@ -74,7 +75,7 @@ void WidgetImplTizen::SetInformation(Dali::Window window, const std::string& wid
   mWidgetId = widgetId;
 
   auto bridge           = Accessibility::Bridge::GetCurrentBridge();
-  auto preferredBusName = Accessibility::Bridge::MakeBusNameForWidget(widgetId);
+  auto preferredBusName = Accessibility::Bridge::MakeBusNameForWidget(widgetId, getpid());
 
   // Ensure the bridge is at least in an unlocked state. Normal application callbacks that would
   // call Bridge::ApplicationPaused/Resumed() elsewhere are not operational in widget scenarios.