#define DEBUG_MODE
+#define GERROR_CHECK(error)\
+ if (error)\
+ {\
+ ERROR("Error_log:%s",error->message);\
+ g_error_free(error);\
+ }
+
static AtspiAccessible *current_obj;
static AtspiAccessible *top_window;
static AtspiScrollable *scrolled_obj;
static void
_current_highlight_object_set(AtspiAccessible *obj)
{
+ GError *err = NULL;
if (!obj)
{
DEBUG("Clearing highligjt object");
}
if (obj && ATSPI_IS_COMPONENT(obj))
{
- atspi_component_grab_highlight(atspi_accessible_get_component(obj), NULL);
+ AtspiComponent *comp = atspi_accessible_get_component(obj);
+ if (!comp)
+ {
+ ERROR("AtspiComponent *comp NULL");
+ return;
+ }
+ atspi_component_grab_highlight(comp, &err);
+ GERROR_CHECK(err)
+ gchar *name;
+ gchar *role;
+
+
current_obj = obj;
const ObjectCache *oc = object_cache_get(obj);
if (oc) {
- DEBUG("New highlighted object: %s, role: %s, (%d %d %d %d)",
- atspi_accessible_get_name(obj, NULL),
- atspi_accessible_get_role_name(obj, NULL),
+ name = atspi_accessible_get_name(obj, &err);
+ GERROR_CHECK(err)
+ role = atspi_accessible_get_role_name(obj, &err);
+ GERROR_CHECK(err)
+ DEBUG("New highlighted object: %s, role: %s, (%d %d %d %d)",
+ role,
+ name,
oc->bounds->x, oc->bounds->y, oc->bounds->width, oc->bounds->height);
}
else {
- DEBUG("New highlighted object: %s, role: %s",
- atspi_accessible_get_name(obj, NULL),
- atspi_accessible_get_role_name(obj, NULL));
+ name = atspi_accessible_get_name(obj, &err);
+ GERROR_CHECK(err)
+ role = atspi_accessible_get_role_name(obj, &err);
+ GERROR_CHECK(err)
+ DEBUG("New highlighted object: %s, role: %s",
+ name,
+ role
+ );
}
+ g_free(role);
+ g_free(name);
}
else
DEBUG("Unable to highlight object");
void test_debug(AtspiAccessible *current_widget)
{
int jdx;
+ int count_child;
+ gchar *role;
GError *err = NULL;
AtspiAccessible *child_iter = NULL;
-
- int count_child = atspi_accessible_get_child_count(atspi_accessible_get_parent(current_widget, NULL), NULL);
-
+ AtspiAccessible *parent = atspi_accessible_get_parent(current_widget, &err);
+ GERROR_CHECK(err)
+
+ if(!parent)
+ return;
+ count_child = atspi_accessible_get_child_count(parent, &err);
+ GERROR_CHECK(err)
+ DEBUG("Total childs in parent: %d\n", count_child);
if(!count_child)
return;
- printf("Total childs in parent: %d\n", count_child);
-
for(jdx = 0; jdx < count_child; jdx++)
{
- child_iter = atspi_accessible_get_child_at_index(atspi_accessible_get_parent(current_widget, NULL), jdx, NULL);
+ child_iter = atspi_accessible_get_child_at_index(parent, jdx, &err);
+ GERROR_CHECK(err)
if(current_widget == child_iter)
- printf("Childen found in parent: %s at index: %d\n", atspi_accessible_get_role_name(atspi_accessible_get_parent(current_widget, &err), NULL), jdx);
+ {
+ role = atspi_accessible_get_role_name(parent, &err);
+ DEBUG("Childen found in parent: %s at index: %d\n", role, jdx);
+ }
else
- printf("Childen not found in parent: %s at index: %d\n", atspi_accessible_get_role_name(atspi_accessible_get_parent(current_widget, &err), NULL), jdx);
-
- if(err != NULL)
- {
- printf("ERROR MESSAGE: %s\n", err->message);
- g_error_free(err);
- }
+ {
+ role = atspi_accessible_get_role_name(parent, &err);
+ DEBUG("Childen not found in parent: %s at index: %d\n", role, jdx);
+ }
+ g_free(role);
+ GERROR_CHECK(err)
}
}
static void _focus_widget(Gesture_Info *info)
{
- AtspiAccessible *target_widget = NULL;
- AtspiComponent *window_component = NULL;
+ AtspiAccessible *target_widget;
+ AtspiComponent *window_component;
+ GError *err = NULL;
window_component = atspi_accessible_get_component(top_window);
if(!window_component)
return;
- target_widget = atspi_component_get_accessible_at_point(window_component, info->x_begin, info->y_begin, ATSPI_COORD_TYPE_WINDOW, NULL);
+ 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) {
_current_highlight_object_set(target_widget);
if (!flat_navi_context_current_set(context, target_widget))
static void _value_inc_widget(void)
{
AtspiAccessible* current_widget = NULL;
- AtspiText *text_interface = NULL;
+ AtspiText *text_interface;
gint current_offset;
gboolean ret;
- if(current_obj)
- current_widget = current_obj;
- else
- return;
+ GError *err = NULL;
+ gchar *role;
+
+ if(!current_obj)
+ return;
+
+ current_widget = current_obj;
- if(!strcmp(atspi_accessible_get_role_name(current_widget, NULL), "entry"))
+ role = atspi_accessible_get_role_name(current_widget, &err);
+ GERROR_CHECK(err)
+ if(!strcmp(role, "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);
+ current_offset = atspi_text_get_caret_offset(text_interface, &err);
+ GERROR_CHECK(err)
+ ret = atspi_text_set_caret_offset(text_interface, current_offset + 1, &err);
+ GERROR_CHECK(err)
if(ret)
{
ERROR("Caret position increment done");
}
else
ERROR("No text interface supported!");
+ g_free(role);
return;
}
-
+ g_free(role);
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);
+ gdouble current_val = atspi_value_get_current_value(value_interface, &err);
+ GERROR_CHECK(err)
ERROR("Current value: %f\n ", (double)current_val);
- gdouble minimum_inc = atspi_value_get_minimum_increment(value_interface, NULL);
+ gdouble minimum_inc = atspi_value_get_minimum_increment(value_interface, &err);
ERROR("Minimum increment: %f\n ", (double)minimum_inc);
- atspi_value_set_current_value(value_interface, current_val + minimum_inc, NULL);
+ GERROR_CHECK(err)
+ atspi_value_set_current_value(value_interface, current_val + minimum_inc, &err);
+ GERROR_CHECK(err)
}
else
ERROR("No value interface supported!\n");
static void _value_dec_widget(void)
{
AtspiAccessible* current_widget = NULL;
- AtspiText *text_interface = NULL;
+ AtspiText *text_interface;
gint current_offset;
+ GError *err = NULL;
gboolean ret;
- if(current_obj)
- current_widget = current_obj;
- else
- return;
+ gchar *role;
+
+ if(!current_obj)
+ return;
+ current_widget = current_obj;
- if(!strcmp(atspi_accessible_get_role_name(current_widget, NULL), "entry"))
+ role = atspi_accessible_get_role_name(current_widget, &err);
+ GERROR_CHECK(err)
+ if(!strcmp(role, "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);
+ current_offset = atspi_text_get_caret_offset(text_interface, &err);
+ GERROR_CHECK(err)
+ ret = atspi_text_set_caret_offset(text_interface, current_offset - 1, &err);
+ GERROR_CHECK(err)
if(ret)
{
ERROR("Caret position decrement done");
}
else
ERROR("No text interface supported!");
+ g_free(role);
return;
}
+ g_free(role);
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);
+ gdouble current_val = atspi_value_get_current_value(value_interface, &err);
+ GERROR_CHECK(err)
ERROR("Current value: %f\n ", (double)current_val);
- gdouble minimum_inc = atspi_value_get_minimum_increment(value_interface, NULL);
+ gdouble minimum_inc = atspi_value_get_minimum_increment(value_interface, &err);
+ GERROR_CHECK(err)
ERROR("Minimum increment: %f\n ", (double)minimum_inc);
- atspi_value_set_current_value(value_interface, current_val - minimum_inc, NULL);
+ atspi_value_set_current_value(value_interface, current_val - minimum_inc, &err);
+ GERROR_CHECK(err)
}
else
ERROR("No value interface supported!\n");
//special behavior for entry, caret should move from first/last last/first
AtspiAccessible *current_widget = NULL;
- AtspiComponent *focus_component = NULL;
+ AtspiComponent *focus_component;
+ GError *err = NULL;
- if(current_obj)
- current_widget = current_obj;
- else
- return;
+ if(!current_obj)
+ return;
+
+ current_widget = current_obj;
gchar *roleName;
gchar *actionName;
- roleName = atspi_accessible_get_role_name(current_widget, NULL);
+ roleName = atspi_accessible_get_role_name(current_widget, &err);
+ GERROR_CHECK(err)
ERROR("Widget role prev: %s\n", roleName);
if(!strcmp(roleName, "entry"))
focus_component = atspi_accessible_get_component(current_widget);
if (focus_component != NULL)
{
- if (atspi_component_grab_focus(focus_component, NULL) == TRUE)
+ if (atspi_component_grab_focus(focus_component, &err) == TRUE)
+ {
ERROR("Entry activated\n");
+ GERROR_CHECK(err)
+ }
+ g_free(roleName);
return;
}
}
+ g_free(roleName);
AtspiAction *action;
gint number;
action = atspi_accessible_get_action(current_widget);
- number = atspi_action_get_n_actions(action, NULL);
+ if(!action)
+ {
+ ERROR("Action null");
+ return;
+ }
+ number = atspi_action_get_n_actions(action, &err);
ERROR("Number of available action = %d\n", number);
-
- if(action)
- {
+ GERROR_CHECK(err)
GArray *array = atspi_accessible_get_interfaces(current_widget);
ERROR("TAB LEN = %d \n", array->len);
for (i=0; i<number; i++)
{
- actionName = atspi_action_get_name(action, i, NULL);
+ actionName = atspi_action_get_name(action, i, err);
ERROR("Action name = %s\n", actionName);
+ GERROR_CHECK(err)
if (actionName && !strcmp("click", actionName))
{
- atspi_action_do_action(action, 0, NULL);
+ atspi_action_do_action(action, 0, err);
+ GERROR_CHECK(err)
#ifdef DEBUG_MODE
test_debug(current_widget);
#endif
}
}
- }
+
}
static void _quickpanel_change_state(gboolean quickpanel_switch)
{
AtspiAccessible *ret = NULL;
AtspiRect *rect;
- GError *error = NULL;
+ GError *err = NULL;
if (!top_window || !ATSPI_IS_COMPONENT(top_window))
{
return NULL;
}
- rect = atspi_component_get_extents(ATSPI_COMPONENT(top_window), ATSPI_COORD_TYPE_SCREEN, &error);
- if (!rect || error)
+ 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");
- if (error) g_error_free(error);
return NULL;
}
return NULL;
}
- ret = atspi_component_get_accessible_at_point(ATSPI_COMPONENT(top_window), x, y, ATSPI_COORD_TYPE_SCREEN, &error);
- if (!ret || error)
+ 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);
- if (error) g_error_free(error);
return NULL;
}
-
+gchar *name;
+gchar *role;
// find accessible object with Scrollable interface
while (ret && (ret != top_window))
{
- DEBUG("Testing for scrollability: %s %s",
- atspi_accessible_get_name(ret, NULL), atspi_accessible_get_role_name(ret, NULL));
+ 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,
- atspi_accessible_get_name(ret, NULL), atspi_accessible_get_role_name(ret, NULL));
+ name ,role);
+ g_free(name);
+ g_free(role);
return ATSPI_SCROLLABLE(ret);
}
- ret = atspi_accessible_get_parent(ret, &error);
- if (error)
+ g_free(name);
+ g_free(role);
+ ret = atspi_accessible_get_parent(ret, &err);
+ if (err)
{
ERROR("Unable to fetch AT-SPI parent");
- g_error_free(error);
+ GERROR_CHECK(err)
return NULL;
}
}
static void _widget_scroll_begin(Gesture_Info *gi)
{
- GError *error = NULL;
+ 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, &error);
- if (error)
+ 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.");
- g_error_free(error);
+ GERROR_CHECK(err)
scrolled_obj = NULL;
- error = NULL;
}
}
return;
}
- atspi_scrollable_scroll_after_pointer(scrolled_obj, ATSPI_SCROLL_POINTER_START, gi->x_begin, gi->y_begin, &error);
- if (error)
+ 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, NULL);
+ 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, NULL);
+ 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
void navigator_shutdown(void)
{
+ GError *err = NULL;
if (current_obj)
- atspi_component_clear_highlight(atspi_accessible_get_component(current_obj), NULL);
+ {
+ AtspiComponent *comp = atspi_accessible_get_component(current_obj);
+ if (comp)
+ {
+ atspi_component_clear_highlight(comp, &err);
+ GERROR_CHECK(err);
+ }
+ }
if (context)
{
flat_navi_context_free(context);