From: Shinwoo Kim Date: Fri, 29 Mar 2013 08:59:31 +0000 (+0900) Subject: [access] scroll basded on highlight object geometry X-Git-Tag: accepted/tizen/20130607.213307~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=768b4d0db278e2f75eb7fd754ea4975b1c2fd563;p=profile%2Fmobile%2Felementary.git [access] scroll basded on highlight object geometry --- diff --git a/src/lib/elm_access.c b/src/lib/elm_access.c index 652c29d..57c5495 100644 --- a/src/lib/elm_access.c +++ b/src/lib/elm_access.c @@ -1,5 +1,6 @@ #include #include "elm_priv.h" +#include "elm_interface_scrollable.h" static const char ACCESS_SMART_NAME[] = "elm_access"; @@ -25,6 +26,8 @@ typedef struct _Action_Info Action_Info; static Eina_Bool mouse_event_enable = EINA_TRUE; static Eina_Bool read_mode = EINA_FALSE; +static Evas_Coord_Point offset; +static Evas_Object *s_parent; /* scrollable parent */ static Evas_Object * _elm_access_add(Evas_Object *parent); @@ -449,6 +452,69 @@ _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item) } } +void +_elm_access_highlight_object_scroll(Evas_Object *obj, int type, int x, int y) +{ + Evas *evas; + Evas_Object *ho; + Evas_Coord_Rectangle ho_area; + + if (!obj) return; + + evas = evas_object_evas_get(obj); + if (!evas) return; + + switch (type) + { + case 0: + ho = _access_highlight_object_get(obj); + if (!ho) + { + s_parent = NULL; + return; + } + else + { + /* find scrollable parent */ + s_parent = elm_widget_parent_get(ho); + while (s_parent) + { + if(!!evas_object_smart_interface_get(s_parent, ELM_SCROLLABLE_IFACE_NAME)) + break; + s_parent = elm_widget_parent_get(s_parent); + } + + if (!s_parent) return; + //TODO: new interface to disable repeat event + + evas_object_geometry_get + (ho, &ho_area.x, &ho_area.y, &ho_area.w, &ho_area.h); + + offset.x = x - (ho_area.x + (ho_area.w / 2)); + offset.y = y - (ho_area.y + (ho_area.h / 2)); + } + + evas_event_feed_mouse_in(evas, 0, NULL); + evas_event_feed_mouse_move(evas, x - offset.x, y - offset.y, 0, NULL); + evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL); + break; + + case 1: + if (!s_parent) return; + evas_event_feed_mouse_move(evas, x - offset.x, y - offset.y, 0, NULL); + break; + + case 2: + if (!s_parent) return; + evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL); + //TODO: new interface to enable repeat event + break; + + default: + break; + } +} + static Eina_Bool _access_action_callback_call(Evas_Object *obj, Elm_Access_Action_Type type, diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 14aee72..1cacf2c 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -592,6 +592,7 @@ Eina_Bool _elm_access_read_mode_get(); void _elm_access_widget_item_access_order_set(Elm_Widget_Item *item, Eina_List *objs); const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item); void _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item); +void _elm_access_highlight_object_scroll(Evas_Object *obj, int type, int x, int y); EAPI void _elm_access_clear(Elm_Access_Info *ac); EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text); diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 1f84068..e6032f3 100755 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -1960,6 +1960,7 @@ _elm_win_client_message(void *data, int type __UNUSED__, void *event) { + Ecore_X_Atom atom_scroll; Elm_Win_Smart_Data *sd = data; Ecore_X_Event_Client_Message *e = event; @@ -1997,6 +1998,8 @@ _elm_win_client_message(void *data, { if ((unsigned int)e->data.l[0] == sd->x.xwin) { + atom_scroll = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_"); + if ((unsigned int)e->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT) { @@ -2051,6 +2054,11 @@ _elm_win_client_message(void *data, _elm_access_highlight_object_activate (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_DOWN); } + else if ((unsigned int)e->data.l[1] == atom_scroll) + { + _elm_access_highlight_object_scroll(ELM_WIDGET_DATA(sd)->obj, + e->data.l[2], e->data.l[3], e->data.l[4]); + } } } return ECORE_CALLBACK_PASS_ON;