remove dependencies on AtkScrollable interface
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 4 Mar 2015 10:18:30 +0000 (11:18 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 4 Mar 2015 10:18:30 +0000 (11:18 +0100)
Change-Id: I839b15b84f8d2857f41e56b79d593604884b7c59

src/navigator.c

index a5107b8..3b37c51 100644 (file)
@@ -38,7 +38,6 @@ typedef struct
 static last_focus_t last_focus = {-1,-1};
 static AtspiAccessible *current_obj;
 static AtspiAccessible *top_window;
-static AtspiScrollable *scrolled_obj;
 static Eina_Bool _window_cache_builded;
 static FlatNaviContext *context;
 
@@ -565,190 +564,6 @@ static void _quickpanel_change_state(gboolean quickpanel_switch)
     ecore_main_loop_iterate();
 }
 
-/**
- * @brief Gets 'deepest' Scrollable accessible containing (x,y) point
- */
-static AtspiScrollable*
-_find_scrollable_ancestor_at_xy(int x, int y)
-{
-   AtspiAccessible *ret = NULL;
-   AtspiRect *rect;
-   GError *err = NULL;
-
-   if (!top_window || !ATSPI_IS_COMPONENT(top_window))
-     {
-        DEBUG("No active window detected or no AtspiComponent interface available");
-        return NULL;
-     }
-
-   rect = atspi_component_get_extents(ATSPI_COMPONENT(top_window), ATSPI_COORD_TYPE_SCREEN, &err);
-   GERROR_CHECK(err)
-   if (!rect)
-     {
-        ERROR("Unable to fetch window screen coordinates");
-        return NULL;
-     }
-
-   // Scroll must originate within window borders
-   if ((x < rect->x) || (x > rect->x + rect->width) ||
-       (y < rect->y) || (y > rect->y + rect->height))
-     {
-        DEBUG("Scroll don't start within active window borders");
-        g_free(rect);
-        return NULL;
-     }
-
-   ret = atspi_component_get_accessible_at_point(ATSPI_COMPONENT(top_window), x, y, ATSPI_COORD_TYPE_SCREEN, &err);
-   GERROR_CHECK(err)
-   if (!ret)
-     {
-        ERROR("Unable to get accessible objct at (%d, %d) screen coordinates.", x, y);
-        return NULL;
-     }
-gchar *name;
-gchar *role;
-   // find accessible object with Scrollable interface
-   while (ret && (ret != top_window))
-     {
-       name = atspi_accessible_get_name(ret, &err);
-       GERROR_CHECK(err)
-       role = atspi_accessible_get_role_name(ret, &err);
-       GERROR_CHECK(err)
-       DEBUG("Testing for scrollability: %s %s",
-                   name, role);
-        if (atspi_accessible_get_scrollable(ret))
-          {
-             DEBUG("Scrollable widget found at (%d, %d), name: %s, role: %s", x, y,
-                   name ,role);
-             g_free(name);
-             g_free(role);
-             return ATSPI_SCROLLABLE(ret);
-          }
-        g_free(name);
-        g_free(role);
-        ret = atspi_accessible_get_parent(ret, &err);
-        if (err)
-          {
-             ERROR("Unable to fetch AT-SPI parent");
-             GERROR_CHECK(err)
-             return NULL;
-          }
-     }
-
-   return NULL;
-}
-
-static void _widget_scroll_begin(Gesture_Info *gi)
-{
-   GError *err = NULL;
-
-   if (scrolled_obj)
-     {
-        ERROR("Scrolling context active when initializing new scrolling context! This should never happen.");
-        ERROR("Force reset of current scrolling context...");
-        atspi_scrollable_scroll_after_pointer(scrolled_obj, ATSPI_SCROLL_POINTER_END, gi->x_begin, gi->y_begin, &err);
-        if (err)
-          {
-             ERROR("Failed to reset scroll context.");
-             GERROR_CHECK(err)
-             scrolled_obj = NULL;
-          }
-     }
-
-   scrolled_obj = _find_scrollable_ancestor_at_xy(gi->x_begin, gi->y_begin);
-
-   if (!scrolled_obj)
-     {
-        DEBUG("No scrollable widget found at (%d, %d) coordinates", gi->x_begin, gi->y_begin);
-        return;
-     }
-
-   atspi_scrollable_scroll_after_pointer(scrolled_obj, ATSPI_SCROLL_POINTER_START, gi->x_begin, gi->y_begin, &err);
-   if (err)
-     {
-        ERROR("Failed to initialize scroll operation");
-        GERROR_CHECK(err)
-        scrolled_obj = NULL;
-     }
-}
-
-static void _widget_scroll_continue(Gesture_Info *gi)
-{
-  GError *err = NULL;
-   if (!scrolled_obj)
-     {
-        DEBUG("Scrolling context not initialized!");
-        return;
-     }
-   atspi_scrollable_scroll_after_pointer(scrolled_obj, ATSPI_SCROLL_POINTER_CONTINUE, gi->x_begin, gi->y_begin, &err);
-   GERROR_CHECK(err)
-}
-
-static void _widget_scroll_end(Gesture_Info *gi)
-{
-  GError *err = NULL;
-   if (!scrolled_obj)
-     {
-        ERROR("Scrolling context not initialized!");
-        return;
-     }
-
-   atspi_scrollable_scroll_after_pointer(scrolled_obj, ATSPI_SCROLL_POINTER_END, gi->x_begin, gi->y_begin, &err);
-   scrolled_obj = NULL;
-   GERROR_CHECK(err)
-}
-
-#if 0
-// part of structural navigation
-static void _goto_children_widget(void)
-{
-   AtspiAccessible *obj;
-   if (!current_obj)
-     {
-        DEBUG("No current object is set. Aborting diving into children structure");
-        return;
-     }
-   obj = structural_navi_level_down(current_obj);
-   if (obj)
-     _current_highlight_object_set(obj);
-   else
-     DEBUG("Unable to find hihglightable children widget");
-}
-
-static void _escape_children_widget(void)
-{
-   AtspiAccessible *obj;
-   if (!current_obj)
-     {
-        DEBUG("No current object is set. Aborting escaping from children structure");
-        return;
-     }
-   obj = structural_navi_level_up(current_obj);
-   if (obj)
-     _current_highlight_object_set(obj);
-   else
-     DEBUG("Unable to find hihglightable parent widget");
-}
-#endif
-
-static void _widget_scroll(Gesture_Info *gi)
-{
-   switch (gi->state)
-     {
-      case 0:
-         _widget_scroll_begin(gi);
-         break;
-      case 1:
-         _widget_scroll_continue(gi);
-         break;
-      case 2:
-         _widget_scroll_end(gi);
-         break;
-      default:
-         ERROR("Unrecognized gesture state: %d", gi->state);
-     }
-}
-
 static void on_gesture_detected(void *data, Gesture_Info *info)
 {
    switch(info->type)
@@ -756,9 +571,6 @@ static void on_gesture_detected(void *data, Gesture_Info *info)
       case ONE_FINGER_HOVER:
           _focus_widget(info);
           break;
-      case TWO_FINGERS_HOVER:
-          _widget_scroll(info);
-          break;
       case ONE_FINGER_FLICK_LEFT:
           _focus_prev();
           break;
@@ -837,7 +649,6 @@ static void on_window_activate(void *data, AtspiAccessible *window)
       else
       {
           ERROR("No top window found!");
-          scrolled_obj = NULL;
       }
       top_window = window;
 }