*/
AtspiAccessible *flat_navi_context_line_last(FlatNaviContext *ctx);
+/**
+ * Set current context at given position.
+ *
+ * @param ctx FlatNaviContext
+ *
+ * @param x_cord gint X coordinate
+ *
+ * @param y_cord gint Y coordinate
+ *
+ * @param obj AtspiAccessible Reference to object on point
+ *
+ * @return Eina_Bool true on success
+ *
+ * @note current element will be first of line.
+ */
+Eina_Bool flat_navi_context_current_at_x_y_set( FlatNaviContext *ctx, gint x_cord, gint y_cord , AtspiAccessible **obj);
+
#endif /* end of include guard: FLAT_NAVI_H_ */
DEBUG("===============================");
}
+static Eina_Bool
+_contains(AtspiAccessible *obj, gint x, gint y)
+{
+ const ObjectCache *oc = object_cache_get(obj);
+
+ if (x >= oc->bounds->x && x <= oc->bounds->x + oc->bounds->width
+ && y >= oc->bounds->y && y <= oc->bounds->y + oc->bounds->height)
+ {
+ DEBUG("INSIDE");
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+
+}
+
+Eina_Bool flat_navi_context_current_at_x_y_set( FlatNaviContext *ctx, gint x_cord, gint y_cord , AtspiAccessible **target)
+{
+ if(!ctx || !target) return EINA_FALSE;
+
+ AtspiAccessible *current = flat_navi_context_current_get(ctx);
+ if (current && _contains(current, x_cord, y_cord))
+ {
+ *target = current;
+ return EINA_TRUE;
+ }
+
+ Eina_List *l, *l2, *line;
+ Eina_Bool found = EINA_FALSE;
+ AtspiAccessible *obj;
+ EINA_LIST_FOREACH(ctx->lines, l, line)
+ {
+ EINA_LIST_FOREACH(line, l2, obj)
+ if (_contains(obj, x_cord, y_cord))
+ {
+ found = EINA_TRUE;
+ break;
+ }
+ if (found)
+ {
+ *target = obj;
+ ctx->current_line = l;
+ ctx->current = l2;
+ break;
+ }
+ }
+
+ return found;
+}
+
FlatNaviContext *flat_navi_context_create(AtspiAccessible *root)
{
FlatNaviContext *ret;
int x,y;
} last_focus_t;
+static last_focus_t last_focus = {-1,-1};
static AtspiAccessible *current_obj;
static AtspiAccessible *top_window;
//static AtspiScrollable *scrolled_obj;
}
#endif
-#if 0
static void _focus_widget(Gesture_Info *info)
{
DEBUG("START");
- AtspiAccessible *target_widget;
- AtspiComponent *window_component;
- GError *err = NULL;
- window_component = atspi_accessible_get_component_iface(top_window);
- if(!window_component)
- return;
- if ((last_focus.x == info->x_begin) && (last_focus.y == info->y_begin))
+ if ((last_focus.x == info->x_beg) && (last_focus.y == info->y_beg))
return;
- target_widget = atspi_component_get_accessible_at_point(window_component, info->x_begin, info->y_begin, ATSPI_COORD_TYPE_WINDOW, &err);
- GERROR_CHECK(err)
- if (target_widget)
+ AtspiAccessible *obj;
+
+ if (flat_navi_context_current_at_x_y_set(context, info->x_beg, info->y_beg, &obj))
{
- DEBUG("WIDGET FOUND:%s", atspi_accessible_get_name(target_widget, NULL));
- if (flat_navi_context_current_set(context, target_widget))
+ if (obj == current_obj)
{
- _current_highlight_object_set(target_widget);
- last_focus.x = info->x_begin;
- last_focus.y = info->y_begin;
+ DEBUG("The same object");
+ return;
}
- else
- ERROR("Hoveed object not found in window context[%dx%d][%s]", info->x_begin, info->y_begin, atspi_accessible_get_role_name(top_window, &err));
+ last_focus.x = info->x_beg;
+ last_focus.y = info->y_beg;
+ _current_highlight_object_set(obj);
}
else
- DEBUG("NO widget under (%d, %d) found",
- info->x_begin, info->y_begin);
+ DEBUG("NO widget under (%d, %d) found or the same widget under hover",
+ info->x_beg, info->y_beg);
+
DEBUG("END");
}
-#endif
static void _focus_next(void)
{
DEBUG("END");
}
+
static void _focus_prev(void)
{
AtspiAccessible *obj;
switch(info->type)
{
case ONE_FINGER_HOVER:
- //_focus_widget(info);
+ _focus_widget(info);
break;
case TWO_FINGERS_HOVER:
// _widget_scroll(info);
_value_dec_widget();
break;
case ONE_FINGER_SINGLE_TAP:
- //_focus_widget(info);
+ _focus_widget(info);
break;
case ONE_FINGER_DOUBLE_TAP:
_activate_widget();
return FALSE;
}
+gboolean atspi_component_contains (AtspiComponent *obj, gint x, gint y, AtspiCoordType ctype, GError **error)
+{
+ return TRUE;
+}
+
GArray *atspi_state_set_get_states (AtspiStateSet *set)
{
gint i = 0;
gint atspi_relation_get_n_targets (AtspiRelation *obj);
AtspiAccessible * atspi_relation_get_target (AtspiRelation *obj, gint i);
AtspiAccessible * atspi_accessible_get_parent (AtspiAccessible *obj, GError **error);
+gboolean atspi_component_contains (AtspiComponent *obj, gint x, gint y, AtspiCoordType ctype, GError **error);
+
int atspi_exit(void);
#endif /*__ATSPI_H__*/