summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2018-02-01 21:19:12 +0900
committerShinwoo Kim <cinoo.kim@samsung.com>2018-02-01 21:19:12 +0900
commit6a8b97184a6087b7f29e04285a2cf7d3cf9d9a08 (patch)
tree0613f6522728d2ea181e4d35188990ec1129fca0
parentbf0e226c7eb01d7d2659ab2c06f503931b6a72b8 (diff)
Show accessible attribute informationHEADmaster
-rw-r--r--atspi_viewer.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/atspi_viewer.c b/atspi_viewer.c
index 4a488f4..658e8ad 100644
--- a/atspi_viewer.c
+++ b/atspi_viewer.c
@@ -16,6 +16,7 @@
16 fprintf(stderr, fmt, ##__VA_ARGS__); \ 16 fprintf(stderr, fmt, ##__VA_ARGS__); \
17 fprintf(stderr, "\n"); 17 fprintf(stderr, "\n");
18 18
19static AtspiEventListener *listener;
19Ecore_Timer *window_timer = NULL; 20Ecore_Timer *window_timer = NULL;
20 21
21static Eina_Bool _dbus_set_property_bool(Eldbus_Connection_Type connection_type, 22static Eina_Bool _dbus_set_property_bool(Eldbus_Connection_Type connection_type,
@@ -355,6 +356,27 @@ gl4_sel(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
355 if (ifaces) 356 if (ifaces)
356 g_array_free(ifaces, FALSE); 357 g_array_free(ifaces, FALSE);
357 358
359
360 GHashTable *attributes = atspi_accessible_get_attributes(accessible, NULL);
361 if (attributes)
362 {
363 snprintf(txt, sizeof(txt), "<br/>[Attributes]<br/>");
364 eina_strbuf_append_length(buf, txt, strlen(txt));
365
366 GHashTableIter attributes_iter;
367 gpointer attr_key;
368 gpointer attr_value;
369 g_hash_table_iter_init (&attributes_iter, attributes);
370 char *result = NULL;
371 while (g_hash_table_iter_next (&attributes_iter, &attr_key, &attr_value))
372 {
373 snprintf(txt, sizeof(txt), "%s:%s<br/>", (char *)attr_key, (char *)attr_value);
374 eina_strbuf_append_length(buf, txt, strlen(txt));
375
376 }
377 g_hash_table_unref(attributes);
378 }
379
358 Evas_Object *hbx = elm_box_add(obj); 380 Evas_Object *hbx = elm_box_add(obj);
359 elm_box_horizontal_set(hbx, EINA_TRUE); 381 elm_box_horizontal_set(hbx, EINA_TRUE);
360 382
@@ -549,10 +571,30 @@ ui_create(void)
549 evas_object_show(win); 571 evas_object_show(win);
550} 572}
551 573
574static void _listener_cb(const AtspiEvent *event)
575{
576 if (!event) return;
577 if (!event->source) return;
578
579 if (!strcmp(event->type, "object:text-changed:insert"))
580 {
581 DEBUG("insert: %s, %d, %d", g_value_get_string(&event->any_data), event->detail1, event->detail2);
582 }
583 else if (!strcmp(event->type, "object:text-changed:delete"))
584 {
585 DEBUG("delete: %s, %d, %d", g_value_get_string(&event->any_data), event->detail1, event->detail2);
586 }
587}
588
552int main(int argc, char **argv) 589int main(int argc, char **argv)
553{ 590{
554 ecore_init(); 591 ecore_init();
555 atspi_init(); 592 atspi_init();
593
594 listener = atspi_event_listener_new_simple(_listener_cb, NULL);
595 atspi_event_listener_register(listener, "object:text-changed:insert", NULL);
596 atspi_event_listener_register(listener, "object:text-changed:delete", NULL);
597
556 screen_reader_switch_enabled_set(EINA_TRUE); 598 screen_reader_switch_enabled_set(EINA_TRUE);
557 elm_init(argc, argv); 599 elm_init(argc, argv);
558 600
@@ -561,6 +603,10 @@ int main(int argc, char **argv)
561 elm_run(); 603 elm_run();
562 elm_shutdown(); 604 elm_shutdown();
563 605
606 atspi_event_listener_deregister(listener, "object:text-changed:insert", NULL);
607 atspi_event_listener_deregister(listener, "object:text-changed:delete", NULL);
608 g_object_unref(listener);
609
564 screen_reader_switch_enabled_set(EINA_FALSE); 610 screen_reader_switch_enabled_set(EINA_FALSE);
565 atspi_exit(); 611 atspi_exit();
566 ecore_shutdown(); 612 ecore_shutdown();