#include <string.h>
+#include <Ecore_X.h>
#include "border.h"
#include "logger.h"
static char *registered_event = NULL;
static Eina_Bool initialized = EINA_FALSE;
+Ecore_X_Window _get_win_below(int x, int y)
+{
+ int num;
+ Ecore_X_Window win = ecore_x_window_at_xy_get(x, y);
+ ecore_x_window_ignore_set(win, 1);
+ Ecore_X_Window *skip = ecore_x_window_ignore_list(&num);
+ //fprintf(stderr, "win_below:%d\n", ecore_x_window_at_xy_with_skip_get(x, y, skip, num));
+ //fprintf(stderr, "win_top:%d\n", win);
+ return ecore_x_window_at_xy_with_skip_get(x, y, skip, num);
+}
+
+Eina_Bool _mouse_up(void *data,
+ int type,
+ void *event)
+{
+ Ecore_Event_Mouse_Button *ev = event;
+ ecore_x_mouse_up_send(_get_win_below(ev->x, ev->y), ev->x, ev->y, 1);
+ fprintf(stderr, "mouse_up\n");
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _mouse_down(void *data,
+ int type,
+ void *event)
+{
+ Ecore_Event_Mouse_Button *ev = event;
+ ecore_x_mouse_down_send(_get_win_below(ev->x, ev->y), ev->x, ev->y, 1);
+ fprintf(stderr, "mouse_down\n");
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool _mouse_move(void *data,
+ int type,
+ void *event)
+{
+ Ecore_Event_Mouse_Button *ev = event;
+ ecore_x_mouse_move_send(_get_win_below(ev->x, ev->y), ev->x, ev->y);
+ //fprintf(stderr, "mouse_move\n");
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+
static Eina_Bool draw_border(AtspiAccessible *w)
{
if(!w)
evas_object_show(r4);
evas_object_show(win);
+ ecore_event_init();
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _mouse_down, NULL);
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _mouse_up, NULL);
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _mouse_move, NULL);
+
listener = atspi_event_listener_new (_bounds_changed, NULL, NULL);
atspi_event_listener_register (listener, BOUNDS_CHANGED, &error);
static AtspiAccessible *current_obj;
static AtspiAccessible *top_window;
-static Eina_List *focusable_obj_list;
-static Eina_Bool is_first = EINA_FALSE;
-static void _get_focusable_fillers_list(AtspiAccessible* obj);
-
-static void _scroll_action(void) // NOT YET IMPLEMENTED
-{
-
-}
-
static void _focus_widget(Gesture_Info *info)
{
AtspiAccessible *target_widget = NULL;
GArray *relations = NULL;
AtspiRelation *relation = NULL;
AtspiRelationType type;
+ gchar *roleName;
int i;
if(current_obj)
if (focus_component != NULL)
{
- ERROR("Focus component is not null\n");
- if (atspi_component_grab_focus(focus_component, NULL) == TRUE)
- ERROR("Focus was changed\n");
+ roleName = atspi_accessible_get_role_name(current_widget, NULL);
+ ERROR("Focused widget role: %s\n", roleName);
+
+ if (atspi_component_grab_focus(focus_component, NULL) == TRUE)
+ ERROR("Focus was changed\n");
}
return current_widget;
}
GArray *relations = NULL;
AtspiRelation *relation = NULL;
AtspiRelationType type;
+ gchar *roleName;
int i;
if(current_obj)
if (focus_component != NULL)
{
- if (atspi_component_grab_focus(focus_component, NULL) == TRUE)
- ERROR("Focus was changed\n");
+ roleName = atspi_accessible_get_role_name(current_widget, NULL);
+ ERROR("Focused widget role: %s\n", roleName);
+
+ if (atspi_component_grab_focus(focus_component, NULL) == TRUE)
+ ERROR("Focus was changed\n");
}
static void _focus_next(void)
{
- AtspiAccessible *current_widget = NULL;
-
current_obj = _focused_next_widget();
if(current_obj)
border_set(current_obj);
static void _focus_prev(void)
{
- AtspiAccessible *current_widget = NULL;
-
current_obj = _focused_prev_widget();
if(current_obj)
border_set(current_obj);
static void _value_inc_widget(void)
{
AtspiAccessible* current_widget = NULL;
+ AtspiText *text_interface = NULL;
+ gint current_offset;
+ gboolean ret;
if(current_obj)
current_widget = current_obj;
else
return;
+ if(!strcmp(atspi_accessible_get_role_name(current_widget, NULL), "entry"))
+ {
+ text_interface = atspi_accessible_get_text(current_widget);
+ if(text_interface)
+ {
+ current_offset = atspi_text_get_caret_offset(text_interface, NULL);
+ ret = atspi_text_set_caret_offset(text_interface, current_offset + 1, NULL);
+ if(ret)
+ {
+ ERROR("Caret position increment done");
+ }
+ else
+ {
+ ERROR("Caret position increment error");
+ }
+ }
+ else
+ ERROR("No text interface supported!");
+ return;
+ }
+
AtspiValue *value_interface = atspi_accessible_get_value(current_widget);
if(value_interface)
{
+ ERROR("Value interface supported!\n");
gdouble current_val = atspi_value_get_current_value(value_interface, NULL);
+ ERROR("Current value: %f\n ", (double)current_val);
gdouble minimum_inc = atspi_value_get_minimum_increment(value_interface, NULL);
+ ERROR("Minimum increment: %f\n ", (double)minimum_inc);
atspi_value_set_current_value(value_interface, current_val + minimum_inc, NULL);
}
+ else
+ ERROR("No value interface supported!\n");
}
static void _value_dec_widget(void)
{
AtspiAccessible* current_widget = NULL;
+ AtspiText *text_interface = NULL;
+ gint current_offset;
+ gboolean ret;
if(current_obj)
current_widget = current_obj;
else
return;
+ if(!strcmp(atspi_accessible_get_role_name(current_widget, NULL), "entry"))
+ {
+ text_interface = atspi_accessible_get_text(current_widget);
+ if(text_interface)
+ {
+ current_offset = atspi_text_get_caret_offset(text_interface, NULL);
+ ret = atspi_text_set_caret_offset(text_interface, current_offset - 1, NULL);
+ if(ret)
+ {
+ ERROR("Caret position decrement done");
+ }
+ else
+ {
+ ERROR("Caret position decrement error");
+ }
+ }
+ else
+ ERROR("No text interface supported!");
+ return;
+ }
+
AtspiValue *value_interface = atspi_accessible_get_value(current_widget);
if(value_interface)
{
+ ERROR("Value interface supported!\n");
gdouble current_val = atspi_value_get_current_value(value_interface, NULL);
+ ERROR("Current value: %f\n ", (double)current_val);
gdouble minimum_inc = atspi_value_get_minimum_increment(value_interface, NULL);
+ ERROR("Minimum increment: %f\n ", (double)minimum_inc);
atspi_value_set_current_value(value_interface, current_val - minimum_inc, NULL);
}
+ else
+ ERROR("No value interface supported!\n");
}
static Eina_Bool
return EINA_FALSE;
}
-static void _scroll_up_widget(void)
-{
- AtspiAccessible *current_widget = NULL;
-
- if(current_obj)
- current_widget = current_obj;
- else
- return;
-
- gchar *roleName;
- gchar *actionName;
- roleName = atspi_accessible_get_role_name(current_widget, NULL);
- ERROR("Widget role prev: %s\n", roleName);
-
- AtspiAction *action;
- gint number;
- int i;
- int k;
-
- action = atspi_accessible_get_action(current_widget);
- number = atspi_action_get_n_actions(action, NULL);
- ERROR("Number of available action = %d\n", number);
-/*
- if (!strcmp("scroll_up", actionName))
- {
- atspi_action_do_action(action, i, NULL);
- }
- else if (!strcmp("scroll_down", actionName))
- {
- atspi_action_do_action(action, i, NULL);
-
- }
-*/
-}
-
static void _activate_widget(void)
{
//activate the widget
int k;
action = atspi_accessible_get_action(current_widget);
+
number = atspi_action_get_n_actions(action, NULL);
ERROR("Number of available action = %d\n", number);
- GArray *array = atspi_accessible_get_interfaces(current_widget);
- ERROR("TAB LEN = %d \n", array->len);
-
- for (k=0; k < array->len; k++)
- ERROR("Interface = %s\n", g_array_index( array, gchar *, k ));
-
- for (i=0; i<number; i++)
+ if(action)
{
- actionName = atspi_action_get_name(action, i, NULL);
- ERROR("Action name = %s\n", actionName);
+ GArray *array = atspi_accessible_get_interfaces(current_widget);
+ ERROR("TAB LEN = %d \n", array->len);
+
+ for (k=0; k < array->len; k++)
+ ERROR("Interface = %s\n", g_array_index( array, gchar *, k ));
- if (!strcmp("click", actionName))
+ for (i=0; i<number; i++)
{
- atspi_action_do_action(action, i, NULL);
+ actionName = atspi_action_get_name(action, i, NULL);
+ ERROR("Action name = %s\n", actionName);
+
+ if (!strcmp("click", actionName))
+ {
+ atspi_action_do_action(action, 0, NULL);
+ }
+ ecore_timer_add(0.1, _timeout, current_widget);
}
- ecore_timer_add(0.1, _timeout, current_widget);
}
}
{
case ONE_FINGER_HOVER:
_focus_widget(info);
- return;
+ break;
case TWO_FINGERS_HOVER:
- _scroll_up_widget();
- return;
+ ERROR("Scrolling!"); // TODO
+ break;
case ONE_FINGER_FLICK_LEFT:
_focus_prev();
- return;
+ break;
case ONE_FINGER_FLICK_RIGHT:
_focus_next();
- return;
+ break;
case ONE_FINGER_FLICK_UP:
_value_inc_widget();
- return;
+ break;
case ONE_FINGER_FLICK_DOWN:
_value_dec_widget();
- return;
+ break;
case ONE_FINGER_SINGLE_TAP:
_focus_widget(info);
- return;
+ break;
case ONE_FINGER_DOUBLE_TAP:
_activate_widget();
- return;
+ break;
case THREE_FINGERS_FLICK_LEFT:
// not implemented
- return;
+ break;
case THREE_FINGERS_FLICK_RIGHT:
// not implemented
- return;
+ break;
case THREE_FINGERS_FLICK_DOWN:
// indicator show
// not implemented
- return;
+ break;
case THREE_FINGERS_FLICK_UP:
// indicator hide
// not implemented
- return;
+ break;
default:
ERROR("Function not implemented for gesture type :%d", info->type);
}
AtspiComponent *focus_component = NULL;
int i;
- gint nChild = NULL;
+ gint nChild;
gchar *winName = NULL;
gchar *widgetName = NULL;
gchar *roleName = NULL;
static void on_window_activate(void *data, AtspiAccessible *window)
{
+ ERROR("... on window activate ...");
top_window = window;
if(top_window)
{
_get_first_focusable_widget(top_window);
}
else
- top_window = NULL;
+ {
+ ERROR("No top window found!");
+ top_window = NULL;
+ current_obj = NULL;
+ }
}
void navigator_init(void)
// register on active_window
window_tracker_register(on_window_activate, NULL);
window_tracker_active_window_request();
- border_init();
+ //border_init();
}
void navigator_shutdown(void)
{