Use deputy object sent by "GetNavigableAtPoint" 34/136234/1
authorShinwoo Kim <cinoo.kim@samsung.com>
Wed, 14 Jun 2017 04:56:52 +0000 (13:56 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 28 Jun 2017 23:59:36 +0000 (08:59 +0900)
The deputy means embedding side object works for embedded object.
If there is no object at point on embedded side, then the deputy object should
have highlight.

So far the deputy object is elm_access, and the elm_access takes highlight.
So there is no chance to have highlight on embedded side.

This patch set reuires:
elementary: b82beff73c41f52542d71fd6f4d9ad4ddcb4bacc

Change-Id: I2136242b73883757bd50331b10f3e1f8a6bff986

atspi/atspi-accessible.c
atspi/atspi-misc-private.h
atspi/atspi-misc.c

index 02a526c..bafe114 100644 (file)
@@ -340,13 +340,39 @@ atspi_accessible_get_navigable_at_point (AtspiAccessible *root,
   DBusMessage *reply;
   AtspiAccessible *return_value = NULL;
   unsigned char recurse = 0;
+  DBusMessageIter iter;
+  AtspiAccessible *deputy = NULL;
 
   g_return_val_if_fail (root != NULL, NULL);
   do {
     reply = _atspi_dbus_call_partial (root, atspi_interface_accessible, "GetNavigableAtPoint", error, "iiu", d_x, d_y, d_ctype);
 
-    AtspiAccessible *tmp = _atspi_dbus_return_accessible_and_recurse_info_from_message (reply, &recurse);
-    if (!tmp) break;
+    _ATSPI_DBUS_CHECK_SIG (reply, "(so)y(so)", NULL, NULL);
+
+    dbus_message_iter_init (reply, &iter);
+    AtspiAccessible *tmp = _atspi_dbus_return_accessible_from_iter (&iter);
+
+    unsigned char value = 0;
+    dbus_message_iter_get_basic (&iter, &value);
+    dbus_message_iter_next (&iter);
+    recurse = (value != 0);
+
+    /* keep deputy if tmp has deputy */
+    if (!deputy)
+      deputy = _atspi_dbus_return_accessible_from_iter (&iter);
+
+    dbus_message_unref(reply);
+
+    if (!tmp) {
+      if (deputy) {
+        /* TODO: need to check deputy works for return value */
+        if (return_value)
+          g_object_unref(return_value);
+        return deputy;
+      }
+      break;
+    }
+
     if (return_value)
       g_object_unref(return_value);
     return_value = root = tmp;
@@ -584,11 +610,22 @@ atspi_accessible_get_neighbor (AtspiAccessible *root,
   unsigned char recurse;
   GetNeighborSearchMode search_mode = NEIGHBOR_SEARCH_MODE_NORMAL;
   GQueue *children_root_stack = g_queue_new();
+  DBusMessageIter iter;
 
   while(1) {
     const char *path = are_objects_on_the_same_bus(root, start) ? root_path : "";
     DBusMessage *reply = _atspi_dbus_call_partial (start, atspi_interface_accessible, "GetNeighbor", error, "sii", path, (int)direction, (int)search_mode);
-    AtspiAccessible *ret = _atspi_dbus_return_accessible_and_recurse_info_from_message (reply, &recurse);
+
+    dbus_message_iter_init (reply, &iter);
+    AtspiAccessible *ret = _atspi_dbus_return_accessible_from_iter (&iter);
+
+    unsigned char value = 0;
+    dbus_message_iter_get_basic (&iter, &value);
+    dbus_message_iter_next (&iter);
+    recurse = (value != 0);
+
+    dbus_message_unref(reply);
+
     // got return value and request for recursive search, it means ret is on another bridge, than start
     // thus we're recursing. should the recurse failed to find anything it will end with
     if (ret && recurse) {
@@ -611,6 +648,7 @@ atspi_accessible_get_neighbor (AtspiAccessible *root,
     if (!g_queue_is_empty(children_root_stack)) {
       g_object_unref(G_OBJECT(start));
       start = g_queue_pop_tail(children_root_stack);
+
       search_mode = NEIGHBOR_SEARCH_MODE_CONTINUE_AFTER_FAILED_RECURSING;
       continue;
     }
@@ -624,6 +662,7 @@ atspi_accessible_get_neighbor (AtspiAccessible *root,
         g_object_unref(G_OBJECT(start));
         start = parent;
       }
+
       // going up thru parents put us in weird place (we didnt meet root on the way)
       // so we bail out
       if (!start)
index 53133a7..27b3717 100644 (file)
@@ -81,9 +81,6 @@ AtspiAccessible *
 _atspi_dbus_return_accessible_from_message (DBusMessage *message);
 
 AtspiAccessible *
-_atspi_dbus_return_accessible_and_recurse_info_from_message (DBusMessage *message, unsigned char *recurse);
-
-AtspiAccessible *
 _atspi_dbus_return_accessible_from_iter (DBusMessageIter *iter);
 
 AtspiHyperlink *
index c6b4581..193257b 100644 (file)
@@ -598,54 +598,31 @@ _atspi_ref_accessible (const char *app, const char *path)
   return ref_accessible (app, path);
 }
 
-static AtspiAccessible *
-_atspi_dbus_return_accessible_and_recurse_info_from_message_impl (DBusMessage *message, unsigned char *recurse)
+AtspiAccessible *
+_atspi_dbus_return_accessible_from_message (DBusMessage *message)
 {
   DBusMessageIter iter;
   AtspiAccessible *retval = NULL;
   const char *signature;
-  const char *expected_signature = recurse ? "(so)y" : "(so)";
 
-  if (!message) return NULL;
+  if (!message)
+    return NULL;
 
   signature = dbus_message_get_signature (message);
-  if (!strcmp (signature, expected_signature))
+  if (!strcmp (signature, "(so)"))
   {
     dbus_message_iter_init (message, &iter);
     retval =  _atspi_dbus_return_accessible_from_iter (&iter);
-    if (recurse) {
-      unsigned char value = 0;
-      dbus_message_iter_get_basic (&iter, &value);
-      dbus_message_iter_next (&iter);
-      *recurse = (value != 0);
-    }
   }
   else
   {
-    g_warning ("AT-SPI: Called _atspi_dbus_return_accessible_from_message with unexpected signature %s", signature);
+    g_warning ("AT-SPI: Called _atspi_dbus_return_accessible_from_message with strange signature %s", signature);
   }
   dbus_message_unref (message);
   return retval;
 }
 
 AtspiAccessible *
-_atspi_dbus_return_accessible_from_message (DBusMessage *message)
-{
-  return _atspi_dbus_return_accessible_and_recurse_info_from_message_impl(message, NULL);
-}
-
-AtspiAccessible *
-_atspi_dbus_return_accessible_and_recurse_info_from_message(DBusMessage *message, unsigned char *recurse)
-{
-  if (recurse == NULL) {
-    g_error("AT-SPI: Called _atspi_dbus_return_accessible_and_recurse_info_from_message with NULL argument recurse");
-    dbus_message_unref (message);
-    return NULL;
-  }
-  return _atspi_dbus_return_accessible_and_recurse_info_from_message_impl(message, recurse);
-}
-
-AtspiAccessible *
 _atspi_dbus_return_accessible_from_iter (DBusMessageIter *iter)
 {
   const char *app_name, *path;