#include <Ecore_X.h>
+#include <Ecore.h>
#include <math.h>
#include "logger.h"
#include "navigator.h"
#define DEBUG_MODE
-static AtspiAccessible *previous_obj;
static AtspiAccessible *current_obj;
static AtspiAccessible *top_window;
static AtspiScrollable *scrolled_obj;
}
}
-static void _scroll_widget(Gesture_Info *info)
-{
- AtspiAccessible *current_widget = NULL;
-
- if(current_obj)
- current_widget = current_obj;
- else
- return NULL;
-}
-
+#if 0
static void object_get_x_y(AtspiAccessible * accessibleObject, int* x, int* y)
{
GError * error = NULL;
static void find_objects(AtspiAccessible* parent, gint x, gint y, gint radius, double* distance, AtspiAccessible **find_app)
{
- AtspiAccessible* obj = NULL;
AtspiAccessible* app = NULL;
GError* err = NULL;
int jdx, kdx;
return f_app_obj;
}
+#endif
static void _focus_widget(Gesture_Info *info)
{
AtspiAccessible *target_widget = NULL;
- AtspiComponent *target_component = NULL;
AtspiComponent *window_component = NULL;
window_component = atspi_accessible_get_component(top_window);
info->x_begin, info->y_begin);
}
-static AtspiAccessible *_focused_next_widget(void)
-{
- AtspiAccessible *current_widget = NULL;
- AtspiComponent *focus_component = NULL;
- GArray *relations = NULL;
- AtspiRelation *relation = NULL;
- AtspiRelationType type;
- gchar *roleName;
- int i;
-
- if(current_obj)
- current_widget = current_obj;
- else
- return NULL;
-
- relations = atspi_accessible_get_relation_set(current_widget, NULL);
-
- if (relations->len)
- {
- for (i = 0; i < relations->len; i++)
- {
- relation = g_array_index (relations, AtspiRelation*, i);
- type = atspi_relation_get_relation_type(relation);
-
- if (type == ATSPI_RELATION_FLOWS_TO)
- {
- current_widget = atspi_relation_get_target(relation, 0);
- }
- }
- }
-
- roleName = atspi_accessible_get_role_name(current_widget, NULL);
-
- focus_component = atspi_accessible_get_component(current_widget);
-
- ERROR("Target widget role name: %s\n", roleName);
-
- if (focus_component != NULL && strcmp(roleName, "entry"))
- {
- ERROR("Focused widget role: %s\n", roleName);
- if (atspi_component_grab_highlight(focus_component, NULL))
- ERROR("Highlighted\n");
- #ifdef DEBUG_MODE
- test_debug(current_widget);
- #endif
- }
- return current_widget;
-}
-
-static AtspiAccessible *_focused_prev_widget(void)
-{
- AtspiAccessible *current_widget = NULL;
- AtspiComponent *focus_component = NULL;
- GArray *relations = NULL;
- AtspiRelation *relation = NULL;
- AtspiRelationType type;
- gchar *roleName;
- int i;
-
- if(current_obj)
- current_widget = current_obj;
- else
- return NULL;
-
- relations = atspi_accessible_get_relation_set(current_widget, NULL);
-
- if (relations->len)
- {
- for (i = 0; i < relations->len; i++)
- {
- relation = g_array_index (relations, AtspiRelation*, i);
- type = atspi_relation_get_relation_type(relation);
-
- if (type == ATSPI_RELATION_FLOWS_FROM)
- {
- current_widget = atspi_relation_get_target(relation, 0);
- }
- }
- }
-
- roleName = atspi_accessible_get_role_name(current_widget, NULL);
-
- focus_component = atspi_accessible_get_component(current_widget);
-
- ERROR("Target widget role name: %s\n", roleName);
-
- if (focus_component != NULL && strcmp(roleName, "entry"))
- {
- if (atspi_component_grab_highlight(focus_component, NULL))
- ERROR("Highlighted\n");
- #ifdef DEBUG_MODE
- test_debug(current_widget);
- #endif
- }
-
- return current_widget;
-}
-
static void _focus_next(void)
{
if (!context)
ERROR("No value interface supported!\n");
}
-static Eina_Bool
-_timeout(void *data)
-{
- AtspiAccessible *current_widget = data;
- AtspiAction *action;
- gint number;
- gchar *actionName;
- gboolean ret = FALSE;
- int i;
-
- action = atspi_accessible_get_action(current_widget);
- number = atspi_action_get_n_actions(action, NULL);
- ERROR("Number of available action = %d\n", number);
-
- for (i=0; i<number; i++)
- {
- actionName = atspi_action_get_name(action, i, NULL);
-
- if (!strcmp("release", actionName))
- {
- ret = atspi_action_do_action(action, i, NULL);
- ERROR(ret ? "Action done" : "Action %s failed", actionName);
- }
- }
- return EINA_FALSE;
-}
-
static void _activate_widget(void)
{
//activate the widget
static void _quickpanel_change_state(gboolean quickpanel_switch)
{
Ecore_X_Window xwin = 0;
- const char *name = NULL;
- const char *clas = NULL;
- int ret;
ERROR(quickpanel_switch ? "QUICKPANEL STATE ON" : "QUICKPANEL STATE OFF");
scrolled_obj = NULL;
}
+#if 0
+// part of structural navigation
static void _goto_children_widget(void)
{
AtspiAccessible *obj;
else
DEBUG("Unable to find hihglightable parent widget");
}
+#endif
static void _widget_scroll(Gesture_Info *gi)
{
}
}
-static void _get_first_focusable_widget(AtspiAccessible* obj)
-{
- AtspiAccessible *current_widget = NULL;
- AtspiStateSet *state_set = NULL;
- AtspiComponent *focus_component = NULL;
- int i;
-
- gint nChild;
- gchar *winName = NULL;
- gchar *widgetName = NULL;
- gchar *roleName = NULL;
-
- if (obj == NULL)
- {
- ERROR("No window on top");
- return;
- }
-
- winName = atspi_accessible_get_name(obj, NULL);
- ERROR("Win name: %s\n", winName);
-
- nChild = atspi_accessible_get_child_count(obj, NULL);
- ERROR("Child count of top win: %d\n", nChild);
-
- for (i = 0; i < nChild; i++)
- {
- current_widget = atspi_accessible_get_child_at_index(obj, i, NULL);
- widgetName = atspi_accessible_get_name(current_widget, NULL);
- ERROR("Widget name: %s\n", widgetName);
-
- roleName = atspi_accessible_get_role_name(current_widget, NULL);
- ERROR("Widget role: %s\n", roleName);
-
- state_set = atspi_accessible_get_state_set(current_widget);
- if (ATSPI_IS_STATE_SET(state_set))
- {
-
- focus_component = atspi_accessible_get_component(current_widget);
- if (focus_component != NULL)
- {
- ERROR("Focus component is not null\n");
- if (atspi_component_grab_highlight(focus_component, NULL))
- ERROR("Highlighted!\n");
- return;
- }
- }
- }
-
- ERROR("Not found any focusable widget");
-
- return;
-}
-
static void
_on_cache_builded(void *data)
{
{
ERROR("... on window activate ...");
top_window = window;
- AtspiAccessible *obj;
_current_highlight_object_set(NULL);
}
}
-static void on_keyboard(void *data, Key k)
-{
- switch(k)
- {
- case KEY_LEFT:
- _focus_prev();
- break;
- case KEY_RIGHT:
- _focus_next();
- break;
- case KEY_UP:
- _value_inc_widget();
- break;
- case KEY_DOWN:
- _value_dec_widget();
- break;
- default:
- ERROR("Function not implemented for key :%d", k);
- }
-}
-
void navigator_init(void)
{
// register on gesture_getected
// register on active_window
window_tracker_register(on_window_activate, NULL);
window_tracker_active_window_request();
-
- //keyboard_tracker_init();
- //keyboard_tracker_register(on_keyboard, NULL);
}
void navigator_shutdown(void)
{
context = NULL;
}
object_cache_shutdown();
- //keyboard_tracker_shutdown();
}