[access] scroll basded on highlight object geometry
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 29 Mar 2013 08:59:31 +0000 (17:59 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Tue, 2 Apr 2013 09:46:09 +0000 (18:46 +0900)
src/lib/elm_access.c
src/lib/elm_widget.h
src/lib/elm_win.c

index 652c29d..57c5495 100644 (file)
@@ -1,5 +1,6 @@
 #include <Elementary.h>
 #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,
index 14aee72..1cacf2c 100644 (file)
@@ -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);
index 1f84068..e6032f3 100755 (executable)
@@ -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;