[at-spi2-atk] Modify the paths scheme.



commit 0a9e49531331b8efdc727e07f4340fea1573465e
Author: Mark Doffman <mark doffman codethink co uk>
Date:   Thu Jan 21 06:13:27 2010 -0800

    Modify the paths scheme.
    
    The null path now signifies no object. A new root path has been
    added representing the root accessible for a given connection.

 atk-adaptor/accessible-register.c |   28 ++++++++++++++++------------
 atk-adaptor/accessible-register.h |    2 +-
 atk-adaptor/bridge.c              |   18 ++++++------------
 atk-adaptor/object.c              |    2 +-
 common/spi-dbus.h                 |    8 ++++----
 5 files changed, 28 insertions(+), 30 deletions(-)
---
diff --git a/atk-adaptor/accessible-register.c b/atk-adaptor/accessible-register.c
index 97ada1d..63942d4 100644
--- a/atk-adaptor/accessible-register.c
+++ b/atk-adaptor/accessible-register.c
@@ -47,16 +47,18 @@
  *
  */
 
-#define SPI_ATK_PATH_PREFIX_LENGTH 22
-#define SPI_ATK_OBJECT_PATH_PREFIX  "/org/at_spi/accessible"
-#define SPI_ATK_OBJECT_PATH_DESKTOP SPI_ATK_OBJECT_PATH_PREFIX "/desktop"
+#define SPI_ATK_PATH_PREFIX_LENGTH 34
+#define SPI_ATK_OBJECT_PATH_PREFIX  "/org/freedesktop/atspi/accessible/"
+#define SPI_ATK_OBJECT_PATH_ROOT "root"
 
-#define SPI_ATK_OBJECT_REFERENCE_TEMPLATE SPI_ATK_OBJECT_PATH_PREFIX "/%d"
+#define SPI_ATK_OBJECT_REFERENCE_TEMPLATE SPI_ATK_OBJECT_PATH_PREFIX "%d"
 
 #define SPI_DBUS_ID "spi-dbus-id"
 
 SpiRegister *spi_global_register = NULL;
 
+static const gchar * spi_register_root_path = SPI_ATK_OBJECT_PATH_PREFIX SPI_ATK_OBJECT_PATH_ROOT;
+
 enum
 {
   OBJECT_REGISTERED,
@@ -243,14 +245,12 @@ spi_register_path_to_object (SpiRegister * reg, const char *path)
       != 0)
     return NULL;
 
-  path += SPI_ATK_PATH_PREFIX_LENGTH;   /* Skip over the prefix */
+  path += SPI_ATK_PATH_PREFIX_LENGTH; /* Skip over the prefix */
 
-  if (!g_strcmp0 (SPI_ATK_OBJECT_PATH_DESKTOP, path))
-    return G_OBJECT (atk_get_root ());
-  if (path[0] != '/')
-    return NULL;
+  /* Map the root path to the root object. */
+  if (!g_strcmp0 (SPI_ATK_OBJECT_PATH_ROOT, path))
+    return G_OBJECT (spi_global_app_data->root);
 
-  path++;
   index = atoi (path);
   data = g_hash_table_lookup (reg->ref2ptr, GINT_TO_POINTER (index));
   if (data)
@@ -279,6 +279,10 @@ spi_register_object_to_path (SpiRegister * reg, GObject * gobj)
   if (gobj == NULL)
     return NULL;
 
+  /* Map the root object to the root path. */
+  if (gobj == spi_global_app_data->root)
+    return g_strdup (spi_register_root_path);
+
   ref = object_to_ref (gobj);
   if (!ref)
     {
@@ -304,9 +308,9 @@ spi_register_object_to_ref (GObject * gobj)
  * within any particular application.
  */
 gchar *
-spi_register_desktop_object_path ()
+spi_register_root_object_path ()
 {
-  return g_strdup (SPI_ATK_OBJECT_PATH_PREFIX SPI_ATK_OBJECT_PATH_DESKTOP);
+  return g_strdup (SPI_ATK_OBJECT_PATH_PREFIX SPI_ATK_OBJECT_PATH_ROOT);
 }
 
 /*END------------------------------------------------------------------------*/
diff --git a/atk-adaptor/accessible-register.h b/atk-adaptor/accessible-register.h
index dda103b..9a65f2a 100644
--- a/atk-adaptor/accessible-register.h
+++ b/atk-adaptor/accessible-register.h
@@ -70,7 +70,7 @@ guint
 spi_register_object_to_ref (GObject * gobj);
   
 gchar *
-spi_register_desktop_object_path ();
+spi_register_root_object_path ();
 
 /*---------------------------------------------------------------------------*/
 
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index aaf2bcc..dfa537c 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -39,6 +39,7 @@
 #include "bridge.h"
 #include "event.h"
 #include "adaptors.h"
+#include "object.h"
 
 #include "accessible-register.h"
 #include "accessible-leasing.h"
@@ -170,24 +171,17 @@ register_application (SpiBridge * app)
   DBusMessage *message;
   DBusMessageIter iter;
   DBusError error;
-  const char *uname = NULL;
 
   dbus_error_init (&error);
 
   message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
-                                          SPI_DBUS_PATH_REGISTRY,
-                                          SPI_DBUS_INTERFACE_REGISTRY,
-                                          "RegisterApplication");
+                                          SPI_DBUS_PATH_ROOT,
+                                          SPI_DBUS_INTERFACE_SOCKET,
+                                          "Embed");
   dbus_message_set_no_reply (message, TRUE);
 
-  uname = dbus_bus_get_unique_name (app->bus);
-  if (!uname)
-    {
-      g_error ("AT-SPI: Couldn't get unique name for this connection");
-    }
-
   dbus_message_iter_init_append (message, &iter);
-  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &uname);
+  spi_object_append_reference (&iter, app->root);
   dbus_connection_send (app->bus, message, NULL);
   if (message)
     dbus_message_unref (message);
@@ -409,7 +403,7 @@ adaptor_init (gint * argc, gchar ** argv[])
                              "/org/at_spi/cache", spi_global_cache);
 
   accpath = droute_add_many (spi_global_app_data->droute,
-                             "/org/at_spi/accessible",
+                             "/org/freedesktop/atspi/accessible",
                              NULL,
                              (DRouteGetDatumFunction)
                              spi_global_register_path_to_object);
diff --git a/atk-adaptor/object.c b/atk-adaptor/object.c
index 856e991..1b7fc43 100644
--- a/atk-adaptor/object.c
+++ b/atk-adaptor/object.c
@@ -113,7 +113,7 @@ spi_object_append_desktop_reference (DBusMessageIter * iter)
 {
   DBusMessageIter iter_struct;
   const char *name = SPI_DBUS_NAME_REGISTRY;
-  const char *path = SPI_DBUS_PATH_DESKTOP;
+  const char *path = SPI_DBUS_PATH_ROOT;
 
   dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, NULL,
                                     &iter_struct);
diff --git a/common/spi-dbus.h b/common/spi-dbus.h
index f82e24c..8b26a7d 100644
--- a/common/spi-dbus.h
+++ b/common/spi-dbus.h
@@ -35,12 +35,10 @@ extern int _dbg;
 #define SPI_DBUS_PATH_REGISTRY "/org/freedesktop/atspi/registry"
 #define SPI_DBUS_INTERFACE_REGISTRY "org.freedesktop.atspi.Registry"
 
-#define SPI_DBUS_PATH_DESKTOP "/org/freedesktop/atspi/accessible/desktop"
-#define SPI_DBUS_INTERFACE_DESKTOP "org.freedesktop.atspi.Desktop"
+#define SPI_DBUS_PATH_NULL "/org/freedesktop/atspi/null"
+#define SPI_DBUS_PATH_ROOT "/org/freedesktop/atspi/root"
 
 #define SPI_DBUS_PATH_DEC "/org/freedesktop/atspi/registry/deviceeventcontroller"
-#define SPI_DBUS_PATH_NULL "/org/freedesktop/atspi/accessible/null"
-
 #define SPI_DBUS_INTERFACE_DEC "org.freedesktop.atspi.DeviceEventController"
 #define SPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.freedesktop.atspi.DeviceEventListener"
 
@@ -50,6 +48,7 @@ extern int _dbg;
 #define SPI_DBUS_INTERFACE_APPLICATION "org.freedesktop.atspi.Application"
 #define SPI_DBUS_INTERFACE_COLLECTION "org.freedesktop.atspi.Collection"
 #define SPI_DBUS_INTERFACE_COMPONENT "org.freedesktop.atspi.Component"
+#define SPI_DBUS_INTERFACE_DESKTOP "org.freedesktop.atspi.Desktop"
 #define SPI_DBUS_INTERFACE_DOCUMENT "org.freedesktop.atspi.Document"
 #define SPI_DBUS_INTERFACE_EDITABLE_TEXT "org.freedesktop.atspi.EditableText"
 #define SPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.freedesktop.atspi.Event.Keyboard"
@@ -61,6 +60,7 @@ extern int _dbg;
 #define SPI_DBUS_INTERFACE_TABLE "org.freedesktop.atspi.Table"
 #define SPI_DBUS_INTERFACE_TEXT "org.freedesktop.atspi.Text"
 #define SPI_DBUS_INTERFACE_VALUE "org.freedesktop.atspi.Value"
+#define SPI_DBUS_INTERFACE_SOCKET "org.freedesktop.atspi.Socket"
 
 DBusMessage *spi_dbus_general_error(DBusMessage *message);
 DBusMessage *spi_dbus_return_rect(DBusMessage *message, gint ix, gint iy, gint iwidth, gint iheight);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]