forked from enlightenment/efl
atspi: improve way of setting ATSPI SHOWING state
After this patch calculation of the atspi SHOWING state takes into account also viewport of any parent implementing ELM_INTERFACE_SCROLLABLE.
This commit is contained in:
parent
5edaf3a9b1
commit
8062db6ab1
|
@ -4445,8 +4445,60 @@ _elm_widget_item_elm_interface_atspi_accessible_role_set(Eo *eo_item EINA_UNUSED
|
|||
item->role = role;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
_elm_widget_onscreen_is(Evas_Object *widget)
|
||||
{
|
||||
Evas_Object *parent = widget;
|
||||
Evas_Coord x, y, w, h, wx, wy, ww, wh;
|
||||
|
||||
Evas *evas = evas_object_evas_get(widget);
|
||||
if (!evas) return EINA_FALSE;
|
||||
|
||||
// check if on canvas
|
||||
evas_output_viewport_get(evas, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(widget, &wx, &wy, &ww, &wh);
|
||||
if (((wx < x) && (wx + ww < x)) || ((wx > x + w) && (wx + ww > x + w)) ||
|
||||
((wy < y) && (wy + wh < y)) || ((wy > y+ h) && (wy + wh > y + h)))
|
||||
return EINA_FALSE;
|
||||
|
||||
// check if inside scrollable parent viewport
|
||||
do {
|
||||
parent = elm_widget_parent_get(parent);
|
||||
if (parent && !evas_object_visible_get(parent))
|
||||
return EINA_FALSE;
|
||||
if (parent && eo_isa(parent, ELM_INTERFACE_SCROLLABLE_MIXIN))
|
||||
{
|
||||
evas_object_geometry_get(parent, &x, &y, &w, &h);
|
||||
if (((wx < x) && (wx + ww < x)) || ((wx > x + w) && (wx + ww > x + w)) ||
|
||||
((wy < y) && (wy + wh < y)) || ((wy > y+ h) && (wy + wh > y + h)))
|
||||
return EINA_FALSE;
|
||||
}
|
||||
} while (parent && (parent != elm_widget_top_get(widget)));
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
_elm_widget_item_onscreen_is(Elm_Object_Item *item)
|
||||
{
|
||||
Evas_Coord x, y, w, h, wx, wy, ww, wh;
|
||||
Elm_Widget_Item_Data *id = eo_data_scope_get(item, ELM_WIDGET_ITEM_CLASS);
|
||||
if (!id || !id->view) return EINA_FALSE;
|
||||
|
||||
if (!_elm_widget_onscreen_is(id->widget))
|
||||
return EINA_FALSE;
|
||||
|
||||
evas_object_geometry_get(id->view, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(id->widget, &wx, &wy, &ww, &wh);
|
||||
if (((wx < x) && (wx + ww < x)) || ((wx > x + w) && (wx + ww > x + w)) ||
|
||||
((wy < y) && (wy + wh < y)) || ((wy > y+ h) && (wy + wh > y + h)))
|
||||
return EINA_FALSE;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static Elm_Atspi_State_Set
|
||||
_elm_widget_item_elm_interface_atspi_accessible_state_set_get(Eo *eo_item EINA_UNUSED,
|
||||
_elm_widget_item_elm_interface_atspi_accessible_state_set_get(Eo *eo_item,
|
||||
Elm_Widget_Item_Data *item EINA_UNUSED)
|
||||
{
|
||||
Elm_Atspi_State_Set states = 0;
|
||||
|
@ -4459,7 +4511,10 @@ _elm_widget_item_elm_interface_atspi_accessible_state_set_get(Eo *eo_item EINA_U
|
|||
{
|
||||
STATE_TYPE_SET(states, ELM_ATSPI_STATE_ENABLED);
|
||||
STATE_TYPE_SET(states, ELM_ATSPI_STATE_SENSITIVE);
|
||||
STATE_TYPE_SET(states, ELM_ATSPI_STATE_VISIBLE);
|
||||
}
|
||||
if (_elm_widget_item_onscreen_is(eo_item))
|
||||
STATE_TYPE_SET(states, ELM_ATSPI_STATE_SHOWING);
|
||||
|
||||
return states;
|
||||
}
|
||||
|
@ -5615,21 +5670,13 @@ EOLIAN static Elm_Atspi_State_Set
|
|||
_elm_widget_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Elm_Atspi_State_Set states = 0;
|
||||
Evas *evas = NULL;
|
||||
|
||||
eo_do_super(obj, ELM_WIDGET_CLASS, states = elm_interface_atspi_accessible_state_set_get());
|
||||
|
||||
if (evas_object_visible_get(obj))
|
||||
STATE_TYPE_SET(states, ELM_ATSPI_STATE_VISIBLE);
|
||||
evas = evas_object_evas_get(obj);
|
||||
if (evas)
|
||||
{
|
||||
Evas_Coord x, y, w, h, wx, wy, ww, wh;
|
||||
|
||||
evas_output_viewport_get(evas, &x, &y, &w, &h);
|
||||
evas_object_geometry_get(obj, &wx, &wy, &ww, &wh);
|
||||
if (!(((wx < x) && (wx + ww < x)) || ((wx > x + w) && (wx + ww > x + w)) ||
|
||||
((wy < y) && (wy + wh < y)) || ((wy > y+ h) && (wy + wh > y + h))))
|
||||
STATE_TYPE_SET(states, ELM_ATSPI_STATE_VISIBLE);
|
||||
if (_elm_widget_onscreen_is(obj))
|
||||
STATE_TYPE_SET(states, ELM_ATSPI_STATE_SHOWING);
|
||||
}
|
||||
if (!elm_widget_child_can_focus_get(obj))
|
||||
|
|
|
@ -785,6 +785,8 @@ EAPI Eina_List *elm_widget_scrollable_children_get(const Evas_Object *obj)
|
|||
/* debug function. don't use it unless you are tracking parenting issues */
|
||||
EAPI void elm_widget_tree_dump(const Evas_Object *top);
|
||||
EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
|
||||
EAPI Eina_Bool _elm_widget_onscreen_is(Evas_Object *widget);
|
||||
EAPI Eina_Bool _elm_widget_item_onscreen_is(Elm_Object_Item *item);
|
||||
|
||||
#define ELM_WIDGET_DATA_GET_OR_RETURN(o, ptr, ...) \
|
||||
Elm_Widget_Smart_Data *ptr; \
|
||||
|
|
Loading…
Reference in New Issue