forked from enlightenment/efl
efl_access_component: resolve property name conflicts
this class is a giant FIXME for anyone looking to do refactoring work. the only reason it seems to exist is to provide wrappers around efl.gfx functions and provide screen position adjustments--something which isn't even viable under wayland note that a test was removed here due to the corresponding method being removed
This commit is contained in:
parent
f8e93775c0
commit
804fc1667a
|
@ -12,45 +12,24 @@
|
|||
|
||||
|
||||
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_screen_position_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int *x, int *y)
|
||||
{
|
||||
Eina_Rect r;
|
||||
|
||||
r = efl_access_component_extents_get(obj, type);
|
||||
r = efl_access_component_extents_get(obj, EINA_TRUE);
|
||||
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)
|
||||
_efl_access_component_screen_position_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int x, int y)
|
||||
{
|
||||
Eina_Rect r;
|
||||
|
||||
r = efl_access_component_extents_get(obj, type);
|
||||
r = efl_access_component_extents_get(obj, EINA_TRUE);
|
||||
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_Rect r;
|
||||
|
||||
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)
|
||||
{
|
||||
Eina_Rect r;
|
||||
|
||||
r = efl_access_component_extents_get(obj, EINA_FALSE);
|
||||
if (w) *w = r.w;
|
||||
if (h) *h = r.h;
|
||||
return efl_access_component_extents_set(obj, EINA_TRUE, r);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
|
@ -62,15 +41,6 @@ _efl_access_component_contains(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_
|
|||
return eina_rectangle_coords_inside(&r.rect, x, y);
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_access_component_alpha_get(Eo *obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
int alpha;
|
||||
|
||||
evas_object_color_get(obj, NULL, NULL, NULL, &alpha);
|
||||
return (double)alpha / 255.0;
|
||||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_access_component_accessible_at_point_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, int x, int y)
|
||||
{
|
||||
|
@ -139,11 +109,6 @@ _efl_access_component_extents_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool scre
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static int
|
||||
_efl_access_component_layer_get(Eo *obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
return evas_object_layer_get(obj);
|
||||
}
|
||||
|
||||
EOLIAN static int
|
||||
_efl_access_component_z_order_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
|
||||
|
|
|
@ -1,38 +1,10 @@
|
|||
import eina_types;
|
||||
|
||||
mixin Efl.Access.Component ()
|
||||
mixin Efl.Access.Component (Efl.Gfx, Efl.Gfx.Stack)
|
||||
{
|
||||
[[AT-SPI component mixin]]
|
||||
data: null;
|
||||
methods {
|
||||
@property size @protected @beta {
|
||||
[[Size of accessible widget.]]
|
||||
set {
|
||||
return: bool; [[$true if size was set, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
w: int; [[Width of the widget]]
|
||||
h: int; [[Height of the widget]]
|
||||
}
|
||||
}
|
||||
@property layer @protected @beta {
|
||||
[[Evas layer of accessible widget.]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
layer: int; [[Evas layer of the widget]]
|
||||
}
|
||||
}
|
||||
@property alpha @protected @beta {
|
||||
[[Gets alpha of accessible widget.]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
alpha: double; [[Alpha value in [0, 1] range.]]
|
||||
}
|
||||
}
|
||||
@property z_order @protected @beta {
|
||||
[[Gets the depth at which the component is shown in relation to other
|
||||
components in the same container.]]
|
||||
|
@ -57,17 +29,13 @@ mixin Efl.Access.Component ()
|
|||
rect: Eina.Rect; [[The geometry.]]
|
||||
}
|
||||
}
|
||||
@property position @protected @beta {
|
||||
@property screen_position @protected @beta {
|
||||
[[Position of accessible widget.]]
|
||||
set {
|
||||
return: bool; [[$true if position was set, $false otherwise]]
|
||||
}
|
||||
get {
|
||||
}
|
||||
keys {
|
||||
screen_coords: bool; [[If $true x and y values will be relative to
|
||||
screen origin, otherwise relative to canvas]]
|
||||
}
|
||||
values {
|
||||
x: int; [[X coordinate]]
|
||||
y: int; [[Y coordinate]]
|
||||
|
|
|
@ -5525,14 +5525,6 @@ _elm_widget_item_efl_access_component_extents_set(Eo *obj EINA_UNUSED, Elm_Widge
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static int
|
||||
_elm_widget_item_efl_access_component_layer_get(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED)
|
||||
{
|
||||
if (!sd->view)
|
||||
return -1;
|
||||
return evas_object_layer_get(sd->view);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_widget_item_efl_access_component_focus_grab(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
|
@ -5540,16 +5532,6 @@ _elm_widget_item_efl_access_component_focus_grab(Eo *obj EINA_UNUSED, Elm_Widget
|
|||
return elm_object_item_focus_get(obj);
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_elm_widget_item_efl_access_component_alpha_get(Eo *obj EINA_UNUSED, Elm_Widget_Item_Data *sd EINA_UNUSED)
|
||||
{
|
||||
int alpha;
|
||||
|
||||
if (!sd->view) return -1.0;
|
||||
evas_object_color_get(sd->view, NULL, NULL, NULL, &alpha);
|
||||
return (double)alpha / 255.0;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_ui_widget_efl_object_provider_find(const Eo *obj, Elm_Widget_Smart_Data *pd, const Efl_Object *klass)
|
||||
{
|
||||
|
|
|
@ -3440,7 +3440,7 @@ _component_get_position(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;
|
||||
int x = 1, y = 1;
|
||||
AtspiCoordType coord_type;
|
||||
Eldbus_Message *ret;
|
||||
|
||||
|
@ -3450,7 +3450,13 @@ _component_get_position(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;
|
||||
efl_access_component_position_get(obj, type, &x, &y);
|
||||
if (efl_gfx_visible_get(obj))
|
||||
{
|
||||
if (type)
|
||||
efl_access_component_screen_position_get(obj, &x, &y);
|
||||
else
|
||||
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
||||
}
|
||||
|
||||
ret = eldbus_message_method_return_new(msg);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||
|
@ -3467,12 +3473,13 @@ _component_get_size(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eld
|
|||
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;
|
||||
int x = -1, y = -1;
|
||||
Eldbus_Message *ret;
|
||||
|
||||
ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg);
|
||||
|
||||
efl_access_component_size_get(obj, &x, &y);
|
||||
if (efl_gfx_visible_get(obj))
|
||||
evas_object_geometry_get(obj, NULL, NULL, &x, &y);
|
||||
|
||||
ret = eldbus_message_method_return_new(msg);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||
|
@ -3499,13 +3506,14 @@ _component_get_layer(const Eldbus_Service_Interface *iface EINA_UNUSED, const El
|
|||
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 layer = 0;
|
||||
int layer = -1;
|
||||
Eldbus_Message *ret;
|
||||
AtspiComponentLayer atspi_layer;
|
||||
|
||||
ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg);
|
||||
|
||||
layer = efl_access_component_layer_get(obj);
|
||||
if (efl_gfx_visible_get(obj))
|
||||
layer = evas_object_layer_get(obj);
|
||||
|
||||
ret = eldbus_message_method_return_new(msg);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||
|
@ -3545,12 +3553,17 @@ _component_get_alpha(const Eldbus_Service_Interface *iface EINA_UNUSED, const El
|
|||
Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
|
||||
Eo *obj = _bridge_object_from_path(bridge, obj_path);
|
||||
Eldbus_Message *ret;
|
||||
double alpha = 0;
|
||||
double alpha = -1;
|
||||
int a;
|
||||
|
||||
if (!obj)
|
||||
return _dbus_invalid_ref_error_new(msg);
|
||||
|
||||
alpha = efl_access_component_alpha_get(obj);
|
||||
if (efl_gfx_visible_get(obj))
|
||||
{
|
||||
evas_object_color_get(obj, NULL, NULL, NULL, &a);
|
||||
alpha = a / 255.0;
|
||||
}
|
||||
|
||||
ret = eldbus_message_method_return_new(msg);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||
|
@ -3593,7 +3606,7 @@ _component_set_position(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;
|
||||
int x = -1, y = -1;
|
||||
Eina_Bool result = EINA_FALSE;
|
||||
AtspiCoordType coord_type;
|
||||
Eldbus_Message *ret;
|
||||
|
@ -3604,7 +3617,16 @@ _component_set_position(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_position_set(obj, type, x, y);
|
||||
if (efl_gfx_visible_get(obj))
|
||||
{
|
||||
if (type)
|
||||
result = efl_access_component_screen_position_set(obj, x, y);
|
||||
else
|
||||
{
|
||||
result = EINA_TRUE;
|
||||
evas_object_move(obj, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
ret = eldbus_message_method_return_new(msg);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||
|
@ -3621,7 +3643,7 @@ _component_set_size(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eld
|
|||
Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
|
||||
Eo *obj = _bridge_object_from_path(bridge, obj_path);
|
||||
int w, h;
|
||||
Eina_Bool result;
|
||||
Eina_Bool result = EINA_TRUE;
|
||||
Eldbus_Message *ret;
|
||||
|
||||
ELM_ATSPI_OBJ_CHECK_OR_RETURN_DBUS_ERROR(obj, EFL_ACCESS_COMPONENT_MIXIN, msg);
|
||||
|
@ -3629,7 +3651,7 @@ _component_set_size(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eld
|
|||
if (!eldbus_message_arguments_get(msg, "ii", &w, &h))
|
||||
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
|
||||
|
||||
result = efl_access_component_size_set(obj, w, h);
|
||||
evas_object_resize(obj, w, h);
|
||||
|
||||
ret = eldbus_message_method_return_new(msg);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
|
||||
|
|
|
@ -543,8 +543,6 @@ class Elm.Widget.Item(Efl.Object, Efl.Access,
|
|||
Efl.Access.state_set { get; }
|
||||
Efl.Access.attributes { get; }
|
||||
Efl.Access.Component.extents { get; set; }
|
||||
Efl.Access.Component.alpha { get; }
|
||||
Efl.Access.Component.layer { get; }
|
||||
Efl.Access.Component.focus_grab;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ START_TEST (elm_atspi_role_get)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (elm_atspi_component_position)
|
||||
START_TEST (elm_atspi_component_screen_position)
|
||||
{
|
||||
Eina_Bool ret;
|
||||
int x, y;
|
||||
|
@ -108,7 +108,7 @@ START_TEST (elm_atspi_component_position)
|
|||
|
||||
Eo *win = elm_win_add(NULL, "win", ELM_WIN_BASIC);
|
||||
|
||||
ret = efl_access_component_position_set(win, EINA_TRUE, 45, 45);
|
||||
ret = efl_access_component_screen_position_set(win, 45, 45);
|
||||
ck_assert(ret == EINA_TRUE);
|
||||
|
||||
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win));
|
||||
|
@ -121,26 +121,6 @@ START_TEST (elm_atspi_component_position)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (elm_atspi_component_size)
|
||||
{
|
||||
Eina_Bool ret;
|
||||
int w, h;
|
||||
|
||||
elm_init(0, NULL);
|
||||
|
||||
Eo *win = elm_win_add(NULL, "win", ELM_WIN_BASIC);
|
||||
evas_object_resize(win, 50, 50);
|
||||
|
||||
ret = efl_access_component_size_set(win, 100, 100);
|
||||
ck_assert(ret == EINA_TRUE);
|
||||
|
||||
evas_object_geometry_get(win, NULL, NULL, &w, &h);
|
||||
ck_assert((w == 100) && (h == 100));
|
||||
|
||||
elm_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (elm_win_autohide)
|
||||
{
|
||||
elm_init(0, NULL);
|
||||
|
@ -419,8 +399,7 @@ void elm_test_win(TCase *tc)
|
|||
{
|
||||
tcase_add_test(tc, elm_win_legacy_type_check);
|
||||
tcase_add_test(tc, elm_atspi_role_get);
|
||||
tcase_add_test(tc, elm_atspi_component_position);
|
||||
tcase_add_test(tc, elm_atspi_component_size);
|
||||
tcase_add_test(tc, elm_atspi_component_screen_position);
|
||||
tcase_add_test(tc, elm_win_policy_quit_last_window_hidden);
|
||||
tcase_add_test(tc, efl_ui_win_multi_touch_inputs);
|
||||
#ifdef HAVE_ELEMENTARY_X
|
||||
|
|
Loading…
Reference in New Issue