summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 17:32:35 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 18:20:45 +0900
commit58c2c50dcc13bebca71e949ffe20d5f55507da8a (patch)
treecd253bdee9bf026a59b487dfe4643a8793495e37 /src
parent89733b22f6287f0c9126acc93a2b1dae590ae4dd (diff)
efl_access: Use Eina.Rectangle (EO)
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_access_component.c73
-rw-r--r--src/lib/elementary/efl_access_component.eo7
-rw-r--r--src/lib/elementary/efl_ui_win.c21
-rw-r--r--src/lib/elementary/elm_atspi_bridge.c18
-rw-r--r--src/lib/elementary/elm_widget.c29
5 files changed, 78 insertions, 70 deletions
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 @@
13EOLIAN static void 13EOLIAN static void
14_efl_access_component_position_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int *x, int *y) 14_efl_access_component_position_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int *x, int *y)
15{ 15{
16 efl_access_component_extents_get(obj, type, x, y, NULL, NULL); 16 Eina_Rectangle r;
17
18 r = efl_access_component_extents_get(obj, type);
19 if (x) *x = r.x;
20 if (y) *y = r.y;
17} 21}
18 22
19EOLIAN static Eina_Bool 23EOLIAN static Eina_Bool
20_efl_access_component_position_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y) 24_efl_access_component_position_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y)
21{ 25{
22 Eina_Bool ret = EINA_FALSE; 26 Eina_Rectangle r;
23 int c_w, c_h;
24
25 efl_access_component_extents_get(obj, type, NULL, NULL, &c_w, &c_h);
26 ret = efl_access_component_extents_set(obj, type, x, y, c_w, c_h);
27 27
28 return ret; 28 r = efl_access_component_extents_get(obj, type);
29 r.x = x;
30 r.y = y;
31 return efl_access_component_extents_set(obj, type, r);
29} 32}
30 33
31EOLIAN static Eina_Bool 34EOLIAN static Eina_Bool
32_efl_access_component_size_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int w, int h) 35_efl_access_component_size_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int w, int h)
33{ 36{
34 Eina_Bool ret; 37 Eina_Rectangle r;
35 int c_x = 0, c_y = 0;
36 38
37 efl_access_component_extents_get(obj, EINA_FALSE, &c_x, &c_y, NULL, NULL); 39 r = efl_access_component_extents_get(obj, EINA_FALSE);
38 ret = efl_access_component_extents_set(obj, EINA_FALSE, c_x, c_y, w, h); 40 r.w = w;
39 return ret; 41 r.h = h;
42 return efl_access_component_extents_set(obj, EINA_FALSE, r);
40} 43}
41 44
42EOLIAN static void 45EOLIAN static void
43_efl_access_component_size_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int *w, int *h) 46_efl_access_component_size_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int *w, int *h)
44{ 47{
45 efl_access_component_extents_get(obj, EINA_FALSE, NULL, NULL, w, h); 48 Eina_Rectangle r;
49
50 r = efl_access_component_extents_get(obj, EINA_FALSE);
51 if (w) *w = r.w;
52 if (h) *h = r.h;
46} 53}
47 54
48EOLIAN static Eina_Bool 55EOLIAN static Eina_Bool
49_efl_access_component_contains(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y) 56_efl_access_component_contains(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y)
50{ 57{
51 int w_x = 0, w_y = 0, w_w = 0, w_h = 0; 58 Eina_Rectangle r;
52 59
53 efl_access_component_extents_get(obj, type, &w_x, &w_y, &w_w, &w_h); 60 r = efl_access_component_extents_get(obj, type);
54 61 return eina_rectangle_coords_inside(&r, x, y);
55 if ((x >= w_x) && (x <= w_x + w_w) && (y >= w_y) && (y <= w_y + w_h))
56 return EINA_TRUE;
57 return EINA_FALSE;
58} 62}
59 63
60EOLIAN static double 64EOLIAN static double
@@ -92,40 +96,45 @@ _efl_access_component_accessible_at_point_get(Eo *obj, void *_pd EINA_UNUSED, Ei
92 return ret; 96 return ret;
93} 97}
94 98
95EOLIAN static void 99EOLIAN static Eina_Rectangle
96_efl_access_component_extents_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, int *x, int *y, int *w, int *h) 100_efl_access_component_extents_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords)
97{ 101{
98 int ee_x, ee_y; 102 Eina_Rectangle r;
99 103
100 evas_object_geometry_get(obj, x, y, w, h); 104 r = efl_gfx_geometry_get(obj);
101 if (screen_coords) 105 if (screen_coords)
102 { 106 {
103 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); 107 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
104 if (!ee) return; 108 if (!ee)
105 ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); 109 {
106 if (x) *x += ee_x; 110 int ee_x = 0, ee_y = 0;
107 if (y) *y += ee_y; 111 ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
112 r.x += ee_x;
113 r.y += ee_y;
114 }
108 } 115 }
116 return r;
109} 117}
110 118
111EOLIAN static Eina_Bool 119EOLIAN static Eina_Bool
112_efl_access_component_extents_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, int x, int y, int w, int h) 120_efl_access_component_extents_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, Eina_Rectangle r)
113{ 121{
114 int wx, wy; 122 int wx, wy;
115 123
116 if ((x < 0) || (y < 0) || (w < 0) || (h < 0)) return EINA_FALSE; 124 //if (!eina_rectangle_is_valid(&r)) return EINA_FALSE;
125 if ((r.x < 0) || (r.y < 0) || (r.w < 0) || (r.h < 0)) return EINA_FALSE;
117 126
118 if (screen_coords) 127 if (screen_coords)
119 { 128 {
120 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); 129 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
121 if (!ee) return EINA_FALSE; 130 if (!ee) return EINA_FALSE;
122 evas_object_geometry_get(obj, &wx, &wy, NULL, NULL); 131 evas_object_geometry_get(obj, &wx, &wy, NULL, NULL);
123 ecore_evas_move(ee, x - wx, y - wy); 132 ecore_evas_move(ee, r.x - wx, r.y - wy);
124 } 133 }
125 else 134 else
126 evas_object_move(obj, x, y); 135 evas_object_move(obj, r.x, r.y);
127 136
128 evas_object_resize(obj, w, h); 137 evas_object_resize(obj, r.w, r.h);
129 return EINA_TRUE; 138 return EINA_TRUE;
130} 139}
131 140
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 @@
1import eina_types;
2
1mixin Efl.Access.Component () 3mixin Efl.Access.Component ()
2{ 4{
3 [[AT-SPI component mixin]] 5 [[AT-SPI component mixin]]
@@ -52,10 +54,7 @@ mixin Efl.Access.Component ()
52 screen origin, otherwise relative to canvas]] 54 screen origin, otherwise relative to canvas]]
53 } 55 }
54 values { 56 values {
55 x: int; [[X coordinate]] 57 rect: Eina.Rectangle; [[The geometry.]]
56 y: int; [[Y coordinate]]
57 w: int; [[Width]]
58 h: int; [[Height]]
59 } 58 }
60 } 59 }
61 @property position @protected { 60 @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
6713 return name; 6713 return name;
6714} 6714}
6715 6715
6716EOLIAN static void 6716EOLIAN static Eina_Rectangle
6717_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) 6717_efl_ui_win_efl_access_component_extents_get(Eo *obj, Efl_Ui_Win_Data *_pd EINA_UNUSED, Eina_Bool screen_coords)
6718{ 6718{
6719 Eina_Rectangle r;
6719 int ee_x, ee_y; 6720 int ee_x, ee_y;
6720 6721
6721 if (x) *x = 0; 6722 r = efl_gfx_geometry_get(obj);
6722 if (y) *y = 0; 6723 r.x = r.y = 0;
6723 evas_object_geometry_get(obj, NULL, NULL, w, h);
6724 if (screen_coords) 6724 if (screen_coords)
6725 { 6725 {
6726 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj)); 6726 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
6727 if (!ee) return; 6727 if (ee)
6728 ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); 6728 {
6729 if (x) *x += ee_x; 6729 ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
6730 if (y) *y += ee_y; 6730 r.x += ee_x;
6731 r.y += ee_y;
6732 }
6731 } 6733 }
6734 return r;
6732} 6735}
6733 6736
6734EOLIAN static Eina_Bool 6737EOLIAN 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
3348 const char *obj_path = eldbus_message_path_get(msg); 3348 const char *obj_path = eldbus_message_path_get(msg);
3349 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); 3349 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
3350 Eo *obj = _bridge_object_from_path(bridge, obj_path); 3350 Eo *obj = _bridge_object_from_path(bridge, obj_path);
3351 int x, y, w, h;
3352 AtspiCoordType coord_type; 3351 AtspiCoordType coord_type;
3353 Eldbus_Message *ret; 3352 Eldbus_Message *ret;
3354 Eldbus_Message_Iter *iter, *iter_struct; 3353 Eldbus_Message_Iter *iter, *iter_struct;
3354 Eina_Rectangle r;
3355 3355
3356 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg); 3356 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg);
3357 3357
@@ -3363,15 +3363,14 @@ _component_get_extents(const Eldbus_Service_Interface *iface EINA_UNUSED, const
3363 3363
3364 iter = eldbus_message_iter_get(ret); 3364 iter = eldbus_message_iter_get(ret);
3365 3365
3366 Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; 3366 r = efl_access_component_extents_get(obj, (coord_type == ATSPI_COORD_TYPE_SCREEN));
3367 efl_access_component_extents_get(obj, type, &x, &y, &w, &h);
3368 iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL); 3367 iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL);
3369 EINA_SAFETY_ON_NULL_GOTO(iter_struct, fail); 3368 EINA_SAFETY_ON_NULL_GOTO(iter_struct, fail);
3370 3369
3371 eldbus_message_iter_basic_append(iter_struct, 'i', x); 3370 eldbus_message_iter_basic_append(iter_struct, 'i', r.x);
3372 eldbus_message_iter_basic_append(iter_struct, 'i', y); 3371 eldbus_message_iter_basic_append(iter_struct, 'i', r.y);
3373 eldbus_message_iter_basic_append(iter_struct, 'i', w); 3372 eldbus_message_iter_basic_append(iter_struct, 'i', r.w);
3374 eldbus_message_iter_basic_append(iter_struct, 'i', h); 3373 eldbus_message_iter_basic_append(iter_struct, 'i', r.h);
3375 3374
3376 eldbus_message_iter_container_close(iter, iter_struct); 3375 eldbus_message_iter_container_close(iter, iter_struct);
3377 3376
@@ -3513,9 +3512,9 @@ _component_set_extends(const Eldbus_Service_Interface *iface EINA_UNUSED, const
3513 const char *obj_path = eldbus_message_path_get(msg); 3512 const char *obj_path = eldbus_message_path_get(msg);
3514 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME); 3513 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
3515 Eo *obj = _bridge_object_from_path(bridge, obj_path); 3514 Eo *obj = _bridge_object_from_path(bridge, obj_path);
3516 int x, y, w, h;
3517 AtspiCoordType coord_type; 3515 AtspiCoordType coord_type;
3518 Eldbus_Message *ret; 3516 Eldbus_Message *ret;
3517 int x, y, w, h;
3519 Eina_Bool result = EINA_FALSE; 3518 Eina_Bool result = EINA_FALSE;
3520 3519
3521 ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg); 3520 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
3524 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 3523 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
3525 3524
3526 Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; 3525 Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE;
3527 result = efl_access_component_extents_set(obj, type, x, y, w, h); 3526 Eina_Rectangle r = (Eina_Rectangle) { x, y, w, h };
3527 result = efl_access_component_extents_set(obj, type, r);
3528 3528
3529 ret = eldbus_message_method_return_new(msg); 3529 ret = eldbus_message_method_return_new(msg);
3530 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 3530 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
6425 return ret; 6425 return ret;
6426} 6426}
6427 6427
6428EOLIAN static void 6428EOLIAN static Eina_Rectangle
6429_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) 6429_elm_widget_item_efl_access_component_extents_get(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED, Eina_Bool screen_coords)
6430{ 6430{
6431 Eina_Rectangle r = { -1, -1, -1, -1 };
6431 int ee_x, ee_y; 6432 int ee_x, ee_y;
6432 6433
6433 if (!sd->view) 6434 if (!sd->view) return r;
6434 {
6435 if (x) *x = -1;
6436 if (y) *y = -1;
6437 if (w) *w = -1;
6438 if (h) *h = -1;
6439 return;
6440 }
6441 6435
6442 evas_object_geometry_get(sd->view, x, y, w, h); 6436 r = efl_gfx_geometry_get(sd->view);
6443 if (screen_coords) 6437 if (screen_coords)
6444 { 6438 {
6445 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(sd->view)); 6439 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(sd->view));
6446 if (!ee) return; 6440 if (ee)
6447 ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL); 6441 {
6448 if (x) *x += ee_x; 6442 ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
6449 if (y) *y += ee_y; 6443 r.x += ee_x;
6444 r.y += ee_y;
6445 }
6450 } 6446 }
6447 return r;
6451} 6448}
6452 6449
6453EOLIAN static Eina_Bool 6450EOLIAN static Eina_Bool
6454_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) 6451_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)
6455{ 6452{
6456 return EINA_FALSE; 6453 return EINA_FALSE;
6457} 6454}