char *state_to_char(AtspiStateType state);
+const char *get_debug_object_info_implementation(AtspiAccessible *obj, const char *filename, int fileline);
+#define get_debug_object_info(obj) get_debug_object_info_implementation(obj, NULL, 0)
+#define get_debug_object_info_with_location(obj) get_debug_object_info_implementation(obj, __FILE__, __LINE__)
#endif
if (active_window_context->view_content_changed_ecd && active_window_context->view_content_changed_ecd->func) {
AtspiAccessible *root = active_window_context->modals->data ? active_window_context->modals->data : active_window_context->root;
- DEBUG("Want to rebuild navigation context for new root = %p", root);
+ DEBUG("Want to rebuild navigation context for new root = %s", get_debug_object_info(root));
if (root)
active_window_context->view_content_changed_ecd->func(root, active_window_context->view_content_changed_ecd->user_data);
}
ERROR("app_tracker module used without initialization");
return;
}
- DEBUG("switching active window context (%p) from root=%p to root=%p",active_window_context, active_window_context->root, root);
+ DEBUG("switching active window context (%p) from root %s to root %s",active_window_context,
+ get_debug_object_info(active_window_context->root), get_debug_object_info(root));
if (!root) {
ERROR("Invalid parameter. root is NULL. No top window found!");
return;
#include "flat_navi.h"
#include "logger.h"
#include "smart_notification.h"
+#include "screen_reader_utils.h"
static const AtspiStateType required_states[] = {
ATSPI_STATE_SHOWING,
DEBUG("END -- no context");
return EINA_FALSE;
}
- char *root_name = atspi_accessible_get_name(root, NULL);
- DEBUG("Creating navigation context for root = %p, root_name = %s", root, root_name);
- free(root_name);
+ DEBUG("Creating navigation context for root = %s", get_debug_object_info(root));
ctx->root = root;
ctx->current = _first(ctx);
DEBUG("END");
DEBUG("START");
if (!obj) {
- DEBUG("Clearing highlight object");
+ DEBUG("Clearing highlight object %s", get_debug_object_info(nd->current_obj));
nd->current_obj = NULL;
if (nd->current_comp) {
GError *err = NULL;
tts_speak_customized(text_to_speak, EINA_TRUE, EINA_TRUE, obj, tts_data);
g_free(text_to_speak);
} else
- DEBUG("Unable to highlight on object");
+ DEBUG("Unable to highlight on object %s", get_debug_object_info(obj));
DEBUG("END");
}
return;
}
- DEBUG("context: %p, current: %p, new_highlighted_obj: %p", context, flat_navi_context_current_get(context), new_highlighted_obj);
+ DEBUG("context: %p, current: %s, new_highlighted_obj: %s", context,
+ get_debug_object_info(flat_navi_context_current_get(context)),
+ get_debug_object_info(new_highlighted_obj));
if (context && flat_navi_context_current_get(context) != new_highlighted_obj) {
flat_navi_context_current_set(context, g_object_ref(new_highlighted_obj));
if (command->obj) {
//do AT-SPI action
if (!widget_do_action(command->obj, (char *) get_signal_name(signal)))
- ERROR("Failed to do AT-SPI action by name:%s for read command:%p with accessible object:%p",
- get_signal_name(signal), command, command->obj);
+ ERROR("Failed to do AT-SPI action by name:%s for read command:%p with accessible object:%s",
+ get_signal_name(signal), command, get_debug_object_info(command->obj));
} else {
//broadcast dbus signal
if (dbus_direct_reading_adapter_emit(signal, command, sd->reading_adapter_data) != 0)
return NULL;
}
- DEBUG("READ COMMAND PARAMS, TEXT: %.63s, DISCARDABLE: %d, ATSPI_OBJECT: %p", text_to_speak, discardable, obj);
+ DEBUG("READ COMMAND PARAMS, TEXT: %.63s, DISCARDABLE: %d, ATSPI_OBJECT: %s", text_to_speak, discardable, get_debug_object_info(obj));
Read_Command *rc = calloc(1, sizeof(Read_Command));
Read_Context *ctx = &rc->context;
#include <stdlib.h>
#include "screen_reader_utils.h"
#include "logger.h"
+#include <glib/gmacros.h>
#ifndef TIZEN_GTEST
#define TIZEN_PROD_STATIC static
DEBUG("END");
return ret;
}
+
+#define BUF_SIZE 4096
+static char *_get_debug_object_info_get_unique_buffer(void)
+{
+ typedef char unique_buf[BUF_SIZE];
+ static unique_buf buffers[4];
+ static unsigned char buffer_index = 0;
+
+ char *buf = buffers[buffer_index];
+ buffer_index = (buffer_index + 1) % (sizeof(buffers) / sizeof(buffers[0]));
+ return buf;
+}
+
+const char *get_debug_object_info_implementation(AtspiAccessible *obj, const char *filename, int fileline)
+{
+ char *text = _get_debug_object_info_get_unique_buffer();
+ char *text_end = text + BUF_SIZE;
+ char *text_pos = text;
+
+#define P(...) do { int off = snprintf(text_pos, text_end - text_pos, __VA_ARGS__); if (off > 0) text_pos += MIN(off, (int)(text_end - text_pos)); } while(0)
+
+ P("[ ");
+ if (filename != NULL)
+ P("%s:%d: ", filename, fileline);
+
+ if (!obj)
+ P("nil");
+ else {
+ gchar *path = atspi_accessible_get_path(obj, NULL);
+ gchar *name = atspi_accessible_get_name(obj, NULL);
+ gchar *role_name = atspi_accessible_get_role_name(obj, NULL);
+
+ P("object %p", obj);
+ if (path) {
+ P(" path %s", path);
+ g_free(path);
+ }
+ if (name) {
+ P(" name %s", name);
+ g_free(name);
+ }
+ if (role_name) {
+ P(" role %s", role_name);
+ g_free(role_name);
+ }
+ }
+ P(" ]");
+#undef P
+ return text;
+}
#include "logger.h"
#include "screen_reader_tts.h"
#include "screen_reader_haptic.h"
+#include "screen_reader_utils.h"
#include "smart_notification.h"
#include <wav_player.h>
#include <sound_manager.h>
start_index = 0;
end_index = 0;
- gchar *role_name = atspi_accessible_get_role_name(event->source, NULL);
- fprintf(stderr, "Event: %s: %d, obj: %p: role: %s\n", event->type, event->detail1, event->source, role_name);
- g_free(role_name);
+ DEBUG("Event: %s: %d, obj: %s\n", event->type, event->detail1, get_debug_object_info(event->source));
if (!strcmp(event->type, "object:scroll-start")) {
DEBUG("Scrolling started");