diff --git a/src/lib/elementary/efl_access_component.c b/src/lib/elementary/efl_access_component.c index 6a4e1566ab..9bf2bfccfe 100644 --- a/src/lib/elementary/efl_access_component.c +++ b/src/lib/elementary/efl_access_component.c @@ -13,48 +13,52 @@ EOLIAN static void _efl_access_component_position_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int *x, int *y) { - efl_access_component_extents_get(obj, type, x, y, NULL, NULL); + Eina_Rectangle r; + + r = efl_access_component_extents_get(obj, type); + if (x) *x = r.x; + if (y) *y = r.y; } EOLIAN static Eina_Bool _efl_access_component_position_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y) { - Eina_Bool ret = EINA_FALSE; - int c_w, c_h; + Eina_Rectangle r; - efl_access_component_extents_get(obj, type, NULL, NULL, &c_w, &c_h); - ret = efl_access_component_extents_set(obj, type, x, y, c_w, c_h); - - return ret; + r = efl_access_component_extents_get(obj, type); + r.x = x; + r.y = y; + return efl_access_component_extents_set(obj, type, r); } EOLIAN static Eina_Bool _efl_access_component_size_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int w, int h) { - Eina_Bool ret; - int c_x = 0, c_y = 0; + Eina_Rectangle r; - efl_access_component_extents_get(obj, EINA_FALSE, &c_x, &c_y, NULL, NULL); - ret = efl_access_component_extents_set(obj, EINA_FALSE, c_x, c_y, w, h); - return ret; + r = efl_access_component_extents_get(obj, EINA_FALSE); + r.w = w; + r.h = h; + return efl_access_component_extents_set(obj, EINA_FALSE, r); } EOLIAN static void _efl_access_component_size_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int *w, int *h) { - efl_access_component_extents_get(obj, EINA_FALSE, NULL, NULL, w, h); + Eina_Rectangle r; + + r = efl_access_component_extents_get(obj, EINA_FALSE); + if (w) *w = r.w; + if (h) *h = r.h; } EOLIAN static Eina_Bool _efl_access_component_contains(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y) { - int w_x = 0, w_y = 0, w_w = 0, w_h = 0; + Eina_Rectangle r; - efl_access_component_extents_get(obj, type, &w_x, &w_y, &w_w, &w_h); - - if ((x >= w_x) && (x <= w_x + w_w) && (y >= w_y) && (y <= w_y + w_h)) - return EINA_TRUE; - return EINA_FALSE; + r = efl_access_component_extents_get(obj, type); + return eina_rectangle_coords_inside(&r, x, y); } EOLIAN static double @@ -92,40 +96,45 @@ _efl_access_component_accessible_at_point_get(Eo *obj, void *_pd EINA_UNUSED, Ei return ret; } -EOLIAN static void -_efl_access_component_extents_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, int *x, int *y, int *w, int *h) +EOLIAN static Eina_Rectangle +_efl_access_component_extents_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords) { - int ee_x, ee_y; + Eina_Rectangle r; - evas_object_geometry_get(obj, x, y, w, h); + r = efl_gfx_geometry_get(obj); if (screen_coords) { Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - if (!ee) return; - ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); - if (x) *x += ee_x; - if (y) *y += ee_y; + if (!ee) + { + int ee_x = 0, ee_y = 0; + ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); + r.x += ee_x; + r.y += ee_y; + } } + return r; } EOLIAN static Eina_Bool -_efl_access_component_extents_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, int x, int y, int w, int h) +_efl_access_component_extents_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, Eina_Rectangle r) { int wx, wy; - if ((x < 0) || (y < 0) || (w < 0) || (h < 0)) return EINA_FALSE; + //if (!eina_rectangle_is_valid(&r)) return EINA_FALSE; + if ((r.x < 0) || (r.y < 0) || (r.w < 0) || (r.h < 0)) return EINA_FALSE; if (screen_coords) { Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); if (!ee) return EINA_FALSE; evas_object_geometry_get(obj, &wx, &wy, NULL, NULL); - ecore_evas_move(ee, x - wx, y - wy); + ecore_evas_move(ee, r.x - wx, r.y - wy); } else - evas_object_move(obj, x, y); + evas_object_move(obj, r.x, r.y); - evas_object_resize(obj, w, h); + evas_object_resize(obj, r.w, r.h); return EINA_TRUE; } diff --git a/src/lib/elementary/efl_access_component.eo b/src/lib/elementary/efl_access_component.eo index cb294b0ea7..f69c7b491d 100644 --- a/src/lib/elementary/efl_access_component.eo +++ b/src/lib/elementary/efl_access_component.eo @@ -1,3 +1,5 @@ +import eina_types; + mixin Efl.Access.Component () { [[AT-SPI component mixin]] @@ -52,10 +54,7 @@ mixin Efl.Access.Component () screen origin, otherwise relative to canvas]] } values { - x: int; [[X coordinate]] - y: int; [[Y coordinate]] - w: int; [[Width]] - h: int; [[Height]] + rect: Eina.Rectangle; [[The geometry.]] } } @property position @protected { diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 69401220f4..e1e6b6c7cb 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -6713,22 +6713,25 @@ _efl_ui_win_elm_interface_atspi_accessible_name_get(Eo *obj, Efl_Ui_Win_Data *sd return name; } -EOLIAN static void -_efl_ui_win_efl_access_component_extents_get(Eo *obj, Efl_Ui_Win_Data *_pd EINA_UNUSED, Eina_Bool screen_coords, int *x, int *y, int *w, int *h) +EOLIAN static Eina_Rectangle +_efl_ui_win_efl_access_component_extents_get(Eo *obj, Efl_Ui_Win_Data *_pd EINA_UNUSED, Eina_Bool screen_coords) { + Eina_Rectangle r; int ee_x, ee_y; - if (x) *x = 0; - if (y) *y = 0; - evas_object_geometry_get(obj, NULL, NULL, w, h); + r = efl_gfx_geometry_get(obj); + r.x = r.y = 0; if (screen_coords) { Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); - if (!ee) return; - ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); - if (x) *x += ee_x; - if (y) *y += ee_y; + if (ee) + { + ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); + r.x += ee_x; + r.y += ee_y; + } } + return r; } EOLIAN static Eina_Bool diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c index ed8a813951..70fa9164f3 100644 --- a/src/lib/elementary/elm_atspi_bridge.c +++ b/src/lib/elementary/elm_atspi_bridge.c @@ -3348,10 +3348,10 @@ _component_get_extents(const Eldbus_Service_Interface *iface EINA_UNUSED, const const char *obj_path = eldbus_message_path_get(msg); Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - int x, y, w, h; AtspiCoordType coord_type; Eldbus_Message *ret; Eldbus_Message_Iter *iter, *iter_struct; + Eina_Rectangle r; ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg); @@ -3363,15 +3363,14 @@ _component_get_extents(const Eldbus_Service_Interface *iface EINA_UNUSED, const iter = eldbus_message_iter_get(ret); - Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; - efl_access_component_extents_get(obj, type, &x, &y, &w, &h); + r = efl_access_component_extents_get(obj, (coord_type == ATSPI_COORD_TYPE_SCREEN)); iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL); EINA_SAFETY_ON_NULL_GOTO(iter_struct, fail); - eldbus_message_iter_basic_append(iter_struct, 'i', x); - eldbus_message_iter_basic_append(iter_struct, 'i', y); - eldbus_message_iter_basic_append(iter_struct, 'i', w); - eldbus_message_iter_basic_append(iter_struct, 'i', h); + eldbus_message_iter_basic_append(iter_struct, 'i', r.x); + eldbus_message_iter_basic_append(iter_struct, 'i', r.y); + eldbus_message_iter_basic_append(iter_struct, 'i', r.w); + eldbus_message_iter_basic_append(iter_struct, 'i', r.h); eldbus_message_iter_container_close(iter, iter_struct); @@ -3513,9 +3512,9 @@ _component_set_extends(const Eldbus_Service_Interface *iface EINA_UNUSED, const const char *obj_path = eldbus_message_path_get(msg); Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); Eo *obj = _bridge_object_from_path(bridge, obj_path); - int x, y, w, h; AtspiCoordType coord_type; Eldbus_Message *ret; + int x, y, w, h; Eina_Bool result = EINA_FALSE; ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg); @@ -3524,7 +3523,8 @@ _component_set_extends(const Eldbus_Service_Interface *iface EINA_UNUSED, const return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; - result = efl_access_component_extents_set(obj, type, x, y, w, h); + Eina_Rectangle r = (Eina_Rectangle) { x, y, w, h }; + result = efl_access_component_extents_set(obj, type, r); ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index 477ce26c6b..1494350285 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -6425,33 +6425,30 @@ _elm_widget_elm_interface_atspi_accessible_attributes_get(Eo *obj, Elm_Widget_Sm return ret; } -EOLIAN static void -_elm_widget_item_efl_access_component_extents_get(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED, Eina_Bool screen_coords, int *x, int *y, int *w, int *h) +EOLIAN static Eina_Rectangle +_elm_widget_item_efl_access_component_extents_get(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED, Eina_Bool screen_coords) { + Eina_Rectangle r = { -1, -1, -1, -1 }; int ee_x, ee_y; - if (!sd->view) - { - if (x) *x = -1; - if (y) *y = -1; - if (w) *w = -1; - if (h) *h = -1; - return; - } + if (!sd->view) return r; - evas_object_geometry_get(sd->view, x, y, w, h); + r = efl_gfx_geometry_get(sd->view); if (screen_coords) { Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(sd->view)); - if (!ee) return; - ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); - if (x) *x += ee_x; - if (y) *y += ee_y; + if (ee) + { + ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); + r.x += ee_x; + r.y += ee_y; + } } + return r; } EOLIAN static Eina_Bool -_elm_widget_item_efl_access_component_extents_set(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED, Eina_Bool screen_coords EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED) +_elm_widget_item_efl_access_component_extents_set(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED, Eina_Bool screen_coords EINA_UNUSED, Eina_Rectangle r EINA_UNUSED) { return EINA_FALSE; }