summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>2020-03-17 08:59:31 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-20 16:16:16 +0100
commite9493fbafc64c567c65a1e6bd98013889027b8ba (patch)
tree3a0e9de0fbd2ffad844d1859de08c33f21968035
parent8e7a01b16f64227143101a517daec7333ed430e8 (diff)
ATSPI bridge refactoring
Add support for Text Interactive interface. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11486
-rw-r--r--src/lib/elementary/elm_atspi_bridge.c609
1 files changed, 526 insertions, 83 deletions
diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c
index b3e8f9a245..2c34f99635 100644
--- a/src/lib/elementary/elm_atspi_bridge.c
+++ b/src/lib/elementary/elm_atspi_bridge.c
@@ -57,6 +57,10 @@
57 if (!(obj) || !efl_isa(obj, class)) \ 57 if (!(obj) || !efl_isa(obj, class)) \
58 return _dbus_invalid_ref_error_new(msg); 58 return _dbus_invalid_ref_error_new(msg);
59 59
60#define ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg) \
61 if (!obj) \
62 return _dbus_invalid_ref_error_new(msg);
63
60typedef struct Key_Event_Info { 64typedef struct Key_Event_Info {
61 Ecore_Event_Key event; 65 Ecore_Event_Key event;
62 int type; 66 int type;
@@ -1304,17 +1308,65 @@ _text_string_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbus_M
1304 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); 1308 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1305 Eo *obj = _bridge_object_from_path(bridge, obj_path); 1309 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1306 1310
1307 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1311 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1308 1312
1309 if (!eldbus_message_arguments_get(msg, "iu", &start, &gran)) 1313 if (!eldbus_message_arguments_get(msg, "iu", &start, &gran))
1310 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); 1314 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected.");
1311 1315
1312 ret = eldbus_message_method_return_new(msg); 1316 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1313 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1317 {
1318 Efl_Text_Cursor *sel1 = efl_ui_textbox_cursor_create(obj);
1319 Efl_Text_Cursor *sel2 = efl_ui_textbox_cursor_create(obj);
1320 efl_text_cursor_position_set(sel1, start);
1321 efl_text_cursor_position_set(sel2, start);
1322
1323 switch(gran)
1324 {
1325 case EFL_ACCESS_TEXT_GRANULARITY_CHAR:
1326 efl_text_cursor_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT);
1327 break;
1328
1329 case EFL_ACCESS_TEXT_GRANULARITY_WORD:
1330 efl_text_cursor_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START);
1331 efl_text_cursor_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END);
1332 break;
1333
1334 case EFL_ACCESS_TEXT_GRANULARITY_LINE:
1335 efl_text_cursor_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START);
1336 efl_text_cursor_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END);
1337 break;
1338
1339 case EFL_ACCESS_TEXT_GRANULARITY_PARAGRAPH:
1340 efl_text_cursor_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_START);
1341 efl_text_cursor_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_END);
1342 break;
1343
1344 case EFL_ACCESS_TEXT_GRANULARITY_SENTENCE: /* this one is not supported by efl */
1345 default:
1346 efl_del(sel1);
1347 efl_del(sel2);
1348 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Granularity not suported.");
1349 }
1350
1351 str = efl_text_cursor_range_text_get(sel1, sel2);
1352
1353 efl_del(sel1);
1354 efl_del(sel2);
1355 }
1356 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1357 {
1358 str = efl_access_text_string_get(obj, gran, &start, &end);
1359 }
1360 else
1361 {
1362 return _dbus_invalid_ref_error_new(msg);
1363 }
1314 1364
1315 str = efl_access_text_string_get(obj, gran, &start, &end);
1316 str = str ? str : strdup(""); 1365 str = str ? str : strdup("");
1317 1366
1367 ret = eldbus_message_method_return_new(msg);
1368 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1369
1318 eldbus_message_arguments_append(ret, "sii", str, start, end); 1370 eldbus_message_arguments_append(ret, "sii", str, start, end);
1319 free(str); 1371 free(str);
1320 1372
@@ -1330,18 +1382,36 @@ _text_text_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1330 Eo *obj = _bridge_object_from_path(bridge, obj_path); 1382 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1331 int start, end; 1383 int start, end;
1332 1384
1333 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1385 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1334 1386
1335 if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) 1387 if (!eldbus_message_arguments_get(msg, "ii", &start, &end))
1336 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); 1388 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end offset expected.");
1337 1389
1338 Eldbus_Message *ret = eldbus_message_method_return_new(msg); 1390 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1339 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1391 {
1392 Efl_Text_Cursor *sel1 = efl_ui_textbox_cursor_create(obj);
1393 Efl_Text_Cursor *sel2 = efl_ui_textbox_cursor_create(obj);
1394 efl_text_cursor_position_set(sel1, start);
1395 efl_text_cursor_position_set(sel2, end);
1396 str = efl_text_cursor_range_text_get(sel1, sel2);
1397 efl_del(sel1);
1398 efl_del(sel2);
1399 }
1400 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1401 {
1402 str = efl_access_text_get(obj, start, end);
1403 }
1404 else
1405 {
1406 return _dbus_invalid_ref_error_new(msg);
1407 }
1340 1408
1341 str = efl_access_text_get(obj, start, end);
1342 str = str ? str : strdup(""); 1409 str = str ? str : strdup("");
1343 1410
1411 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
1412 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1344 eldbus_message_arguments_append(ret, "s", str); 1413 eldbus_message_arguments_append(ret, "s", str);
1414
1345 free(str); 1415 free(str);
1346 1416
1347 return ret; 1417 return ret;
@@ -1357,16 +1427,29 @@ _text_caret_offset_set(const Eldbus_Service_Interface *iface, const Eldbus_Messa
1357 Eldbus_Message *ret; 1427 Eldbus_Message *ret;
1358 Eina_Bool res; 1428 Eina_Bool res;
1359 1429
1360 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1430 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1361 1431
1362 if (!eldbus_message_arguments_get(msg, "i", &offset)) 1432 if (!eldbus_message_arguments_get(msg, "i", &offset))
1363 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1433 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1364 1434
1435 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1436 {
1437 Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj);
1438 efl_text_cursor_position_set(cur, offset);
1439 res = EINA_TRUE;
1440 }
1441 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1442 {
1443 res = efl_access_text_caret_offset_set(obj, offset);
1444 }
1445 else
1446 {
1447 return _dbus_invalid_ref_error_new(msg);
1448 }
1449
1365 ret = eldbus_message_method_return_new(msg); 1450 ret = eldbus_message_method_return_new(msg);
1366 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1451 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1367 1452
1368 res = efl_access_text_caret_offset_set(obj, offset);
1369
1370 eldbus_message_arguments_append(ret, "b", res); 1453 eldbus_message_arguments_append(ret, "b", res);
1371 1454
1372 return ret; 1455 return ret;
@@ -1382,17 +1465,49 @@ _text_character_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbu
1382 Eldbus_Message *ret; 1465 Eldbus_Message *ret;
1383 Eina_Unicode res; 1466 Eina_Unicode res;
1384 1467
1385 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1468 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1386 1469
1387 if (!eldbus_message_arguments_get(msg, "i", &offset)) 1470 if (!eldbus_message_arguments_get(msg, "i", &offset))
1388 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1471 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1389 1472
1473 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1474 {
1475 Efl_Text_Cursor *cur = efl_ui_textbox_cursor_create(obj);
1476 efl_text_cursor_position_set(cur, offset);
1477 res = efl_text_cursor_content_get(cur);
1478 efl_del(cur);
1479 }
1480 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1481 {
1482 res = efl_access_text_character_get(obj, offset);
1483 }
1484 else
1485 {
1486 return _dbus_invalid_ref_error_new(msg);
1487 }
1488
1390 ret = eldbus_message_method_return_new(msg); 1489 ret = eldbus_message_method_return_new(msg);
1391 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1490 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1491 eldbus_message_arguments_append(ret, "i", res);
1492
1493 return ret;
1494}
1392 1495
1393 res = efl_access_text_character_get(obj, offset); 1496static Efl_Access_Text_Attribute*
1497_text_attribute_value_get_text_attribute(Efl_Text_Attribute_Handle *annotation)
1498{
1499 Efl_Access_Text_Attribute *ret;
1500 const char *txt;
1394 1501
1395 eldbus_message_arguments_append(ret, "i", res); 1502 txt = efl_text_formatter_attribute_get(annotation);
1503 if (!txt) return NULL;
1504
1505 ret = calloc(1, sizeof(Efl_Access_Text_Attribute));
1506 if (!ret) return NULL;
1507
1508 ret->value = eina_stringshare_add(txt);
1509 int size = strlen(txt);
1510 ret->name = eina_stringshare_add_length(txt, size);
1396 1511
1397 return ret; 1512 return ret;
1398} 1513}
@@ -1406,20 +1521,59 @@ _text_attribute_value_get(const Eldbus_Service_Interface *iface, const Eldbus_Me
1406 Eo *obj = _bridge_object_from_path(bridge, obj_path); 1521 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1407 int start, end; 1522 int start, end;
1408 Eldbus_Message *ret; 1523 Eldbus_Message *ret;
1409 Eina_Bool res; 1524 Eina_Bool res = EINA_FALSE;
1525 Eina_Iterator *annotations;
1526 Efl_Access_Text_Attribute *attr;
1527 Efl_Text_Attribute_Handle *an;
1410 1528
1411 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1529 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1412 1530
1413 if (!eldbus_message_arguments_get(msg, "is", &start, &name)) 1531 if (!eldbus_message_arguments_get(msg, "is", &start, &name))
1414 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and attribute name expected."); 1532 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and attribute name expected.");
1415 1533
1534 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1535 {
1536 Efl_Text_Cursor *sel1 = efl_ui_textbox_cursor_create(obj);
1537 Efl_Text_Cursor *sel2 = efl_ui_textbox_cursor_create(obj);
1538 efl_text_cursor_position_set(sel1, start);
1539 efl_text_cursor_position_set(sel2, start+1);
1540 annotations = efl_text_formatter_range_attributes_get(sel1, sel2);
1541
1542 if (annotations)
1543 {
1544 EINA_ITERATOR_FOREACH(annotations, an)
1545 {
1546 attr = _text_attribute_value_get_text_attribute(an);
1547 if (!attr) continue;
1548 if (!strcmp(attr->name, name))
1549 {
1550 value = attr->value ? eina_strdup(attr->value) : NULL;
1551 res = EINA_TRUE;
1552 }
1553 elm_atspi_text_text_attribute_free(attr);
1554 if (res)
1555 break;
1556 }
1557 eina_iterator_free(annotations);
1558 }
1559
1560 efl_del(sel1);
1561 efl_del(sel2);
1562 }
1563 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1564 {
1565 res = efl_access_text_attribute_get(obj, name, &start, &end, &value);
1566 }
1567 else
1568 {
1569 return _dbus_invalid_ref_error_new(msg);
1570 }
1571
1416 ret = eldbus_message_method_return_new(msg); 1572 ret = eldbus_message_method_return_new(msg);
1417 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1573 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1418
1419 res = efl_access_text_attribute_get(obj, name, &start, &end, &value);
1420 eldbus_message_arguments_append(ret, "siib", value ? value : "", start, end, res); 1574 eldbus_message_arguments_append(ret, "siib", value ? value : "", start, end, res);
1421 1575
1422 if (value) free(value); 1576 free(value);
1423 return ret; 1577 return ret;
1424} 1578}
1425 1579
@@ -1432,10 +1586,9 @@ _text_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message
1432 int start, end; 1586 int start, end;
1433 Eldbus_Message *ret; 1587 Eldbus_Message *ret;
1434 Eldbus_Message_Iter *iter, *iter_array; 1588 Eldbus_Message_Iter *iter, *iter_array;
1435 Eina_List *attrs;
1436 Efl_Access_Text_Attribute *attr; 1589 Efl_Access_Text_Attribute *attr;
1437 1590
1438 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1591 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1439 1592
1440 if (!eldbus_message_arguments_get(msg, "i", &start)) 1593 if (!eldbus_message_arguments_get(msg, "i", &start))
1441 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1594 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
@@ -1447,13 +1600,45 @@ _text_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message
1447 iter_array = eldbus_message_iter_container_new(iter, 'a', "{ss}"); 1600 iter_array = eldbus_message_iter_container_new(iter, 'a', "{ss}");
1448 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); 1601 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail);
1449 1602
1450 attrs = efl_access_text_attributes_get(obj, &start, &end); 1603 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1604 {
1605 Eina_Iterator *annotations;
1606 Efl_Text_Attribute_Handle *an;
1607 Efl_Text_Cursor *sel1 = efl_ui_textbox_cursor_create(obj);
1608 Efl_Text_Cursor *sel2 = efl_ui_textbox_cursor_create(obj);
1451 1609
1452 EINA_LIST_FREE(attrs, attr) 1610 efl_text_cursor_position_set(sel1, start);
1453 { 1611 efl_text_cursor_position_set(sel2, start+1);
1454 eldbus_message_iter_arguments_append(iter_array, "ss", attr->name, attr->value); 1612 annotations = efl_text_formatter_range_attributes_get(sel1, sel2);
1455 elm_atspi_text_text_attribute_free(attr); 1613
1456 } 1614 efl_del(sel1);
1615 efl_del(sel2);
1616
1617 if (annotations)
1618 {
1619 EINA_ITERATOR_FOREACH(annotations, an)
1620 {
1621 attr = _text_attribute_value_get_text_attribute(an);
1622 if (!attr) continue;
1623 eldbus_message_iter_arguments_append(iter_array, "ss", attr->name, attr->value);
1624 elm_atspi_text_text_attribute_free(attr);
1625 }
1626 eina_iterator_free(annotations);
1627 }
1628 }
1629 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1630 {
1631 Eina_List *attrs = efl_access_text_attributes_get(obj, &start, &end);
1632 EINA_LIST_FREE(attrs, attr)
1633 {
1634 eldbus_message_iter_arguments_append(iter_array, "ss", attr->name, attr->value);
1635 elm_atspi_text_text_attribute_free(attr);
1636 }
1637 }
1638 else
1639 {
1640 goto fail;
1641 }
1457 1642
1458 eldbus_message_iter_container_close(iter, iter_array); 1643 eldbus_message_iter_container_close(iter, iter_array);
1459 eldbus_message_iter_arguments_append(iter, "ii", start, end); 1644 eldbus_message_iter_arguments_append(iter, "ii", start, end);
@@ -1473,10 +1658,10 @@ _text_default_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus
1473 Eo *obj = _bridge_object_from_path(bridge, obj_path); 1658 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1474 Eldbus_Message *ret; 1659 Eldbus_Message *ret;
1475 Eldbus_Message_Iter *iter, *iter_array; 1660 Eldbus_Message_Iter *iter, *iter_array;
1476 Eina_List *attrs; 1661 Eina_List *attrs = NULL;
1477 Efl_Access_Text_Attribute *attr; 1662 Efl_Access_Text_Attribute *attr;
1478 1663
1479 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1664 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1480 1665
1481 ret = eldbus_message_method_return_new(msg); 1666 ret = eldbus_message_method_return_new(msg);
1482 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1667 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
@@ -1485,7 +1670,37 @@ _text_default_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus
1485 iter_array = eldbus_message_iter_container_new(iter, 'a', "{ss}"); 1670 iter_array = eldbus_message_iter_container_new(iter, 'a', "{ss}");
1486 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); 1671 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail);
1487 1672
1488 attrs = efl_access_text_default_attributes_get(obj); 1673 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1674 {
1675 Eina_Iterator *annotations;
1676 Efl_Text_Attribute_Handle *an;
1677 Efl_Text_Cursor *sel1 = efl_ui_textbox_cursor_create(obj);
1678 Efl_Text_Cursor *sel2 = efl_ui_textbox_cursor_create(obj);
1679
1680 efl_text_cursor_move(sel1, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
1681 efl_text_cursor_move(sel2, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
1682 annotations = efl_text_formatter_range_attributes_get(sel1, sel2);
1683
1684 EINA_ITERATOR_FOREACH(annotations, an)
1685 {
1686 Efl_Access_Text_Attribute *attr = _text_attribute_value_get_text_attribute(an);
1687 if (!attr) continue;
1688 attrs = eina_list_append(attrs, attr);
1689 }
1690 eina_iterator_free(annotations);
1691
1692 efl_del(sel1);
1693 efl_del(sel2);
1694 }
1695 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1696 {
1697 attrs = efl_access_text_default_attributes_get(obj);
1698 }
1699 else
1700 {
1701 eldbus_message_unref(ret);
1702 return _dbus_invalid_ref_error_new(msg);
1703 }
1489 1704
1490 EINA_LIST_FREE(attrs, attr) 1705 EINA_LIST_FREE(attrs, attr)
1491 { 1706 {
@@ -1502,6 +1717,59 @@ fail:
1502 return NULL; 1717 return NULL;
1503} 1718}
1504 1719
1720static Eina_Rect
1721_text_interactive_get_pos(Eo *obj, Eina_Rect rect, Eina_Bool screen_coords)
1722{
1723 Eina_Position2D scroller_shift = efl_ui_scrollable_content_pos_get(obj);
1724 Eina_Rect viewport = efl_ui_scrollable_viewport_geometry_get(obj);
1725 Eina_Rect r_obj = efl_access_component_extents_get(obj, EINA_TRUE);
1726
1727 /* In widget coords */
1728 rect.x -= scroller_shift.x;
1729 rect.y -= scroller_shift.y;
1730 rect.x += viewport.x;
1731 rect.y += viewport.y;
1732
1733
1734 /* Is it still visible? */
1735 if (rect.x < viewport.x)
1736 {
1737 rect.w += rect.x - viewport.x;
1738 rect.x = viewport.x;
1739 }
1740
1741 if (rect.y < viewport.y)
1742 {
1743 rect.h += rect.y - viewport.y;
1744 rect.y = viewport.y;
1745 }
1746
1747 rect.w = viewport.w < (rect.x + rect.w) ? viewport.w - rect.x : rect.w;
1748 rect.h = viewport.h < (rect.y + rect.h) ? viewport.h - rect.y : rect.h;
1749
1750 /* If not visible set to 0 both sides */
1751 if (rect.w <= 0 || rect.h <= 0)
1752 {
1753 rect.w = 0;
1754 rect.h = 0;
1755 }
1756
1757 /* Transform to screen coords */
1758 rect.x += r_obj.x;
1759 rect.y += r_obj.y;
1760
1761 /* Transform to window coords */
1762 if (!screen_coords)
1763 {
1764 Eo *win = elm_object_top_widget_get(obj);
1765 Eina_Rect r_win = efl_access_component_extents_get(win, EINA_TRUE);
1766 rect.x -= r_win.x;
1767 rect.y -= r_win.y;
1768 }
1769
1770 return rect;
1771}
1772
1505static Eldbus_Message * 1773static Eldbus_Message *
1506_text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1774_text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1507{ 1775{
@@ -1514,23 +1782,36 @@ _text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_
1514 Eina_Bool screen_coords, res; 1782 Eina_Bool screen_coords, res;
1515 Eldbus_Message *ret; 1783 Eldbus_Message *ret;
1516 1784
1517 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1785 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1518 1786
1519 if (!eldbus_message_arguments_get(msg, "iu", &offset, &type)) 1787 if (!eldbus_message_arguments_get(msg, "iu", &offset, &type))
1520 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); 1788 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected.");
1521 1789
1522 ret = eldbus_message_method_return_new(msg);
1523 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1524
1525 screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; 1790 screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE;
1526 1791
1527 res = efl_access_text_character_extents_get(obj, offset, screen_coords, &rect); 1792 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1528
1529 if (!res)
1530 { 1793 {
1531 eldbus_message_unref(ret); 1794 Efl_Text_Cursor *cur = efl_ui_textbox_cursor_create(obj);
1532 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Unable to get character extents."); 1795 efl_text_cursor_position_set(cur, offset);
1796 rect = efl_text_cursor_geometry_get(cur, EFL_TEXT_CURSOR_TYPE_UNDER);
1797 efl_del(cur);
1798 rect = _text_interactive_get_pos(obj, rect, screen_coords);
1799 res = rect.w != 0 ? EINA_TRUE : EINA_FALSE;
1800 }
1801 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1802 {
1803 res = efl_access_text_character_extents_get(obj, offset, screen_coords, &rect);
1533 } 1804 }
1805 else
1806 {
1807 return _dbus_invalid_ref_error_new(msg);
1808 }
1809
1810 if (!res)
1811 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Unable to get character extents.");
1812
1813 ret = eldbus_message_method_return_new(msg);
1814 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1534 eldbus_message_arguments_append(ret, "iiii", rect.x, rect.y, rect.w, rect.h); 1815 eldbus_message_arguments_append(ret, "iiii", rect.x, rect.y, rect.w, rect.h);
1535 1816
1536 return ret; 1817 return ret;
@@ -1547,19 +1828,45 @@ _text_offset_at_point_get(const Eldbus_Service_Interface *iface, const Eldbus_Me
1547 Eina_Bool screen_coords; 1828 Eina_Bool screen_coords;
1548 Eldbus_Message *ret; 1829 Eldbus_Message *ret;
1549 1830
1550 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1831 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1551 1832
1552 if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &type)) 1833 if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &type))
1553 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); 1834 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected.");
1554 1835
1555 ret = eldbus_message_method_return_new(msg);
1556 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1557
1558 x = y = -1;
1559 screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; 1836 screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE;
1560 1837
1561 offset = efl_access_text_offset_at_point_get(obj, screen_coords, x, y); 1838 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1839 {
1840 if (screen_coords)
1841 {
1842 Eina_Rect rect = efl_access_component_extents_get(obj, screen_coords);
1843 x -= rect.x;
1844 y -= rect.y;
1845 }
1846 else
1847 {
1848 Eo *win = elm_object_top_widget_get(obj);
1849 Eina_Rect r_win = efl_access_component_extents_get(win, EINA_TRUE);
1850 Eina_Rect r_obj = efl_access_component_extents_get(obj, EINA_TRUE);
1851 x -= r_obj.x - r_win.x;
1852 y -= r_obj.y - r_win.y;
1853 }
1854 Efl_Text_Cursor *cur = efl_ui_textbox_cursor_create(obj);
1855 efl_text_cursor_char_coord_set(cur, EINA_POSITION2D(x,y));
1856 offset = efl_text_cursor_position_get(cur);
1857 efl_del(cur);
1858 }
1859 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1860 {
1861 offset = efl_access_text_offset_at_point_get(obj, screen_coords, x, y);
1862 }
1863 else
1864 {
1865 return _dbus_invalid_ref_error_new(msg);
1866 }
1562 1867
1868 ret = eldbus_message_method_return_new(msg);
1869 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1563 eldbus_message_arguments_append(ret, "i", offset); 1870 eldbus_message_arguments_append(ret, "i", offset);
1564 1871
1565 return ret; 1872 return ret;
@@ -1592,19 +1899,35 @@ _text_selection_get(const Eldbus_Service_Interface *iface, const Eldbus_Message
1592 const char *obj_path = eldbus_message_path_get(msg); 1899 const char *obj_path = eldbus_message_path_get(msg);
1593 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); 1900 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1594 Eo *obj = _bridge_object_from_path(bridge, obj_path); 1901 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1595 int sel_num, start, end; 1902 int sel_num, start = 0, end = 0;
1596 Eldbus_Message *ret; 1903 Eldbus_Message *ret;
1597 1904
1598 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1905 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1599 1906
1600 if (!eldbus_message_arguments_get(msg, "i", &sel_num)) 1907 if (!eldbus_message_arguments_get(msg, "i", &sel_num))
1601 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 1908 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1602 1909
1910 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1911 {
1912 if (sel_num == 0)
1913 {
1914 Efl_Text_Cursor *sel1, *sel2;
1915 efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2);
1916 start = efl_text_cursor_position_get(sel1);
1917 end = efl_text_cursor_position_get(sel2);
1918 }
1919 }
1920 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1921 {
1922 efl_access_text_access_selection_get(obj, sel_num, &start, &end);
1923 }
1924 else
1925 {
1926 return _dbus_invalid_ref_error_new(msg);
1927 }
1928
1603 ret = eldbus_message_method_return_new(msg); 1929 ret = eldbus_message_method_return_new(msg);
1604 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1930 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1605
1606 efl_access_text_access_selection_get(obj, sel_num, &start, &end);
1607
1608 eldbus_message_arguments_append(ret, "ii", start, end); 1931 eldbus_message_arguments_append(ret, "ii", start, end);
1609 1932
1610 return ret; 1933 return ret;
@@ -1620,16 +1943,30 @@ _text_selection_add(const Eldbus_Service_Interface *iface, const Eldbus_Message
1620 Eina_Bool res; 1943 Eina_Bool res;
1621 Eldbus_Message *ret; 1944 Eldbus_Message *ret;
1622 1945
1623 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1946 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1624 1947
1625 if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) 1948 if (!eldbus_message_arguments_get(msg, "ii", &start, &end))
1626 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end text offset expected."); 1949 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end text offset expected.");
1627 1950
1951 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1952 {
1953 Efl_Text_Cursor *sel1, *sel2;
1954 efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2);
1955 efl_text_cursor_position_set(sel1, start);
1956 efl_text_cursor_position_set(sel2, end);
1957 res = EINA_TRUE;
1958 }
1959 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
1960 {
1961 res = efl_access_text_selection_add(obj, start, end);
1962 }
1963 else
1964 {
1965 return _dbus_invalid_ref_error_new(msg);
1966 }
1967
1628 ret = eldbus_message_method_return_new(msg); 1968 ret = eldbus_message_method_return_new(msg);
1629 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1969 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1630
1631 res = efl_access_text_selection_add(obj, start, end);
1632
1633 eldbus_message_arguments_append(ret, "b", res); 1970 eldbus_message_arguments_append(ret, "b", res);
1634 1971
1635 return ret; 1972 return ret;
@@ -1642,19 +1979,35 @@ _text_selection_remove(const Eldbus_Service_Interface *iface, const Eldbus_Messa
1642 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); 1979 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1643 Eo *obj = _bridge_object_from_path(bridge, obj_path); 1980 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1644 int sel_num; 1981 int sel_num;
1645 Eina_Bool res; 1982 Eina_Bool res = EINA_FALSE;
1646 Eldbus_Message *ret; 1983 Eldbus_Message *ret;
1647 1984
1648 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 1985 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1649 1986
1650 if (!eldbus_message_arguments_get(msg, "i", &sel_num)) 1987 if (!eldbus_message_arguments_get(msg, "i", &sel_num))
1651 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 1988 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1652 1989
1990 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
1991 {
1992 if (sel_num == 0)
1993 {
1994 Efl_Text_Cursor *sel1, *sel2;
1995 efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2);
1996 efl_text_cursor_range_delete(sel1, sel2);
1997 res = EINA_TRUE;
1998 }
1999 }
2000 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
2001 {
2002 res = efl_access_text_selection_remove(obj, sel_num);
2003 }
2004 else
2005 {
2006 return _dbus_invalid_ref_error_new(msg);
2007 }
2008
1653 ret = eldbus_message_method_return_new(msg); 2009 ret = eldbus_message_method_return_new(msg);
1654 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 2010 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1655
1656 res = efl_access_text_selection_remove(obj, sel_num);
1657
1658 eldbus_message_arguments_append(ret, "b", res); 2011 eldbus_message_arguments_append(ret, "b", res);
1659 2012
1660 return ret; 2013 return ret;
@@ -1667,19 +2020,36 @@ _text_selection_set(const Eldbus_Service_Interface *iface, const Eldbus_Message
1667 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); 2020 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1668 Eo *obj = _bridge_object_from_path(bridge, obj_path); 2021 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1669 int sel_num, start, end; 2022 int sel_num, start, end;
1670 Eina_Bool res; 2023 Eina_Bool res = EINA_FALSE;
1671 Eldbus_Message *ret; 2024 Eldbus_Message *ret;
1672 2025
1673 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 2026 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1674 2027
1675 if (!eldbus_message_arguments_get(msg, "iii", &sel_num, &start, &end)) 2028 if (!eldbus_message_arguments_get(msg, "iii", &sel_num, &start, &end))
1676 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 2029 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1677 2030
2031 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
2032 {
2033 if (sel_num == 0)
2034 {
2035 Efl_Text_Cursor *sel1, *sel2;
2036 efl_text_interactive_selection_cursors_get(obj, &sel1, &sel2);
2037 efl_text_cursor_position_set(sel1, start);
2038 efl_text_cursor_position_set(sel2, end);
2039 res = EINA_TRUE;
2040 }
2041 }
2042 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
2043 {
2044 res = efl_access_text_access_selection_set(obj, sel_num, start, end);
2045 }
2046 else
2047 {
2048 return _dbus_invalid_ref_error_new(msg);
2049 }
2050
1678 ret = eldbus_message_method_return_new(msg); 2051 ret = eldbus_message_method_return_new(msg);
1679 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 2052 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1680
1681 res = efl_access_text_access_selection_set(obj, sel_num, start, end);
1682
1683 eldbus_message_arguments_append(ret, "b", res); 2053 eldbus_message_arguments_append(ret, "b", res);
1684 2054
1685 return ret; 2055 return ret;
@@ -1697,22 +2067,63 @@ _text_range_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Mess
1697 AtspiCoordType type; 2067 AtspiCoordType type;
1698 Eldbus_Message *ret; 2068 Eldbus_Message *ret;
1699 2069
1700 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, msg); 2070 ELM_ATSPI_ON_NULL_RETURN_DBUS_ERROR(obj, msg);
1701 2071
1702 if (!eldbus_message_arguments_get(msg, "iiu", &start, &end, &type)) 2072 if (!eldbus_message_arguments_get(msg, "iiu", &start, &end, &type))
1703 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 2073 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1704 2074
1705 ret = eldbus_message_method_return_new(msg);
1706 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1707
1708 screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; 2075 screen_coords = type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE;
1709 res = efl_access_text_range_extents_get(obj, screen_coords, start, end, &rect); 2076
2077 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
2078 {
2079 Eina_Rectangle *r;
2080 Efl_Text_Cursor *sel1 = efl_ui_textbox_cursor_create(obj);
2081 Efl_Text_Cursor *sel2 = efl_ui_textbox_cursor_create(obj);
2082 efl_text_cursor_position_set(sel1, start);
2083 efl_text_cursor_position_set(sel2, end);
2084 Eina_Iterator *range = efl_text_cursor_range_precise_geometry_get(sel1, sel2);
2085
2086 /* This rect represent coordinates x1, y1, x2, y2 (not x,y,w,h).
2087 * In this way we bypass corner cases
2088 * (like range is empty or first rectangle is empty). */
2089 rect = EINA_RECT(1000000, 1000000, 0, 0);
2090
2091 EINA_ITERATOR_FOREACH(range, r)
2092 {
2093 rect.x = r->x < rect.x ? r->x : rect.x;
2094 rect.y = r->y < rect.y ? r->y : rect.y;
2095 rect.w = r->x+r->w > rect.w ? r->x+r->w : rect.w;
2096 rect.h = r->y+r->h > rect.h ? r->y+r->h : rect.h;
2097 }
2098 eina_iterator_free(range);
2099
2100 efl_del(sel1);
2101 efl_del(sel2);
2102
2103 /* Let's change coordinates to x,y,w,h */
2104 rect.w -= rect.x;
2105 rect.h -= rect.y;
2106
2107 rect = _text_interactive_get_pos(obj, rect, screen_coords);
2108
2109 res = rect.w != 0 ? EINA_TRUE : EINA_FALSE;
2110 }
2111 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
2112 {
2113 res = efl_access_text_range_extents_get(obj, screen_coords, start, end, &rect);
2114 }
2115 else
2116 {
2117 return _dbus_invalid_ref_error_new(msg);
2118 }
2119
1710 if (!res) 2120 if (!res)
1711 { 2121 {
1712 eldbus_message_unref(ret);
1713 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Can't get range extents."); 2122 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Can't get range extents.");
1714 } 2123 }
1715 2124
2125 ret = eldbus_message_method_return_new(msg);
2126 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1716 eldbus_message_arguments_append(ret, "iiii", rect.x, rect.y, rect.w, rect.h); 2127 eldbus_message_arguments_append(ret, "iiii", rect.x, rect.y, rect.w, rect.h);
1717 2128
1718 return ret; 2129 return ret;
@@ -2272,23 +2683,55 @@ _text_properties_get(const Eldbus_Service_Interface *interface, const char *prop
2272 const char *obj_path = eldbus_message_path_get(request_msg); 2683 const char *obj_path = eldbus_message_path_get(request_msg);
2273 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME); 2684 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2274 Eo *obj = _bridge_object_from_path(bridge, obj_path); 2685 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2275 int val; 2686 int result;
2687 Eina_Bool checkCarretOffset = EINA_FALSE;
2688 Eina_Bool checkCharacterCount = EINA_FALSE;
2276 2689
2277 ELM_ATSPI_PROPERTY_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_TEXT_INTERFACE, request_msg, error); 2690 if (!obj)
2691 {
2692 *(error) = _dbus_invalid_ref_error_new(request_msg);
2693 return EINA_FALSE;
2694 }
2278 2695
2279 if (!strcmp(property, "CharacterCount")) 2696 if (!strcmp(property, "CharacterCount"))
2697 checkCharacterCount = EINA_TRUE;
2698 else if (!strcmp(property, "CaretOffset"))
2699 checkCarretOffset = EINA_TRUE;
2700 else
2701 return EINA_FALSE;
2702
2703 if (efl_isa(obj, EFL_TEXT_INTERACTIVE_INTERFACE))
2280 { 2704 {
2281 val = efl_access_text_character_count_get(obj); 2705 if (checkCharacterCount)
2282 eldbus_message_iter_basic_append(iter, 'i', val); 2706 {
2283 return EINA_TRUE; 2707 Efl_Text_Cursor *cur = efl_ui_textbox_cursor_create(obj);
2708 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
2709 result = efl_text_cursor_position_get(cur);
2710 efl_del(cur);
2711 }
2712
2713 if (checkCarretOffset)
2714 {
2715 Efl_Text_Cursor *main_cur = efl_text_interactive_main_cursor_get(obj);
2716 result = efl_text_cursor_position_get(main_cur);
2717 }
2284 } 2718 }
2285 if (!strcmp(property, "CaretOffset")) 2719 else if (efl_isa(obj, EFL_ACCESS_TEXT_INTERFACE))
2286 { 2720 {
2287 val = efl_access_text_caret_offset_get(obj); 2721 if (checkCharacterCount)
2288 eldbus_message_iter_basic_append(iter, 'i', val); 2722 result = efl_access_text_character_count_get(obj);
2289 return EINA_TRUE; 2723
2724 if (checkCarretOffset)
2725 result = efl_access_text_caret_offset_get(obj);
2290 } 2726 }
2291 return EINA_FALSE; 2727 else
2728 {
2729 *(error) = _dbus_invalid_ref_error_new(request_msg);
2730 return EINA_FALSE;
2731 }
2732
2733 eldbus_message_iter_basic_append(iter, 'i', result);
2734 return EINA_TRUE;
2292} 2735}
2293 2736
2294static Eldbus_Message* 2737static Eldbus_Message*
@@ -2526,7 +2969,7 @@ _collection_iter_match_rule_get(Eldbus_Message_Iter *iter, struct collection_mat
2526 else if (!strcmp(ifc_name, "value")) 2969 else if (!strcmp(ifc_name, "value"))
2527 { 2970 {
2528 class = EFL_ACCESS_VALUE_INTERFACE; 2971 class = EFL_ACCESS_VALUE_INTERFACE;
2529 rule->ifaces = eina_list_append(rule->ifaces, EFL_UI_RANGE_DISPLAY_INTERFACE); //alternative interface 2972 rule->ifaces = eina_list_append(rule->ifaces, EFL_UI_RANGE_DISPLAY_INTERFACE); //alternative interface
2530 } 2973 }
2531 2974
2532 if (class) 2975 if (class)
@@ -3973,7 +4416,7 @@ _property_changed_signal_send(void *data, const Efl_Event *event)
3973 { 4416 {
3974 prop = ATSPI_OBJECT_PROPERTY_VALUE; 4417 prop = ATSPI_OBJECT_PROPERTY_VALUE;
3975 atspi_desc = "accessible-value"; 4418 atspi_desc = "accessible-value";
3976 } 4419 }
3977 if (prop == ATSPI_OBJECT_PROPERTY_LAST) 4420 if (prop == ATSPI_OBJECT_PROPERTY_LAST)
3978 { 4421 {
3979 ERR("Unrecognized property name!"); 4422 ERR("Unrecognized property name!");