capi-network-bluetooth
notification
capi-network-wifi
- capi-appfw-service-application
${TAPI_REQUIRED_PKG}
)
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DBG_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "org.tizen.clientDBusWrapper"
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+
+#endif /* __DBG_H__ */
Eina_Bool flat_navi_context_current_set(FlatNaviContext *ctx, AtspiAccessible *target);
/**
+ * Advances to previous line in natural reading order and returns
+ * new current element.
+ *
+ * @param ctx FlatNaviContext
+ *
+ * @return AtspiAccessible* pointer to current object
+ *
+ * @note If current line is first one, function returns NULL
+ * @note current element will be first of line.
+ */
+AtspiAccessible *flat_navi_context_line_prev(FlatNaviContext *ctx);
+
+/**
+ * Advances to next line in natural reading order and returns
+ * new current element.
+ *
+ * @param ctx FlatNaviContext
+ *
+ * @return AtspiAccessible* pointer to current object
+ *
+ * @note If current line is last one, function returns NULL
+ * @note current element will be first of line.
+ */
+AtspiAccessible *flat_navi_context_line_next(FlatNaviContext *ctx);
+
+/**
+ * Advances to first line.
+ *
+ * @param ctx FlatNaviContext
+ *
+ * @return AtspiAccessible* pointer to current object
+ *
+ * @note current element will be first of line.
+ */
+AtspiAccessible *flat_navi_context_line_first(FlatNaviContext *ctx);
+
+/**
+ * Advances to last line.
+ *
+ * @param ctx FlatNaviContext
+ *
+ * @return AtspiAccessible* pointer to current object
+ *
+ * @note current element will be first of line.
+ */
+AtspiAccessible *flat_navi_context_line_last(FlatNaviContext *ctx);
+
+/**
* Set current context at given position.
*
* @param ctx FlatNaviContext
Eina_Bool flat_navi_context_current_at_x_y_set( FlatNaviContext *ctx, gint x_cord, gint y_cord , AtspiAccessible **obj);
/**
+ * Give the number of visible items in context.
+ *
+ * @param ctx FlatNaviContext
+ *
+ * @return int number of visible items in context
+ */
+int flat_navi_context_current_children_count_visible_get( FlatNaviContext *ctx);
+
+/**
* Returns the first item in context;
* @param ctx FlatNaviContext
* @return Pointer to the first item in context
#ifndef LOGGER_H_
#define LOGGER_H_
-#define TIZEN_ENGINEER_MODE
-#include <libintl.h>
-#include <dlog.h>
+#include <Eina.h>
+#include <Elementary.h>
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "SCREEN-READER"
+extern int _eina_log_dom;
+
+int logger_init(void);
+void logger_shutdown(void);
-#define INFO(format, arg...) LOGI(format, ##arg)
-#define DEBUG(format, arg...) LOGD(format, ##arg)
-#define ERROR(format, arg...) LOGE(format, ##arg)
-#define WARNING(format, arg...) LOGW(format, ##arg)
+#define INFO(...) EINA_LOG_DOM_INFO(_eina_log_dom, __VA_ARGS__);
+#define DEBUG(...) EINA_LOG_DOM_DBG(_eina_log_dom, __VA_ARGS__);
+#define ERROR(...) EINA_LOG_DOM_ERR(_eina_log_dom, __VA_ARGS__);
+#define WARNING(...) EINA_LOG_DOM_WARN(_eina_log_dom, __VA_ARGS__);
#define MEMORY_ERROR "Memory allocation error"
#undef _
#endif
-#define _(str) (gettext(str))
+#define _(str) gettext(str)
#endif /* end of include guard: LOGGER_H_ */
<manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.tizen.screen-reader" version="0.1.0" install-location="internal-only">
<label>screen-reader</label>
<description>SMART NAVIGATOR</description>
- <service-application appid="org.tizen.screen-reader" exec="/usr/apps/org.tizen.screen-reader/bin/screen-reader" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+ <ui-application appid="org.tizen.screen-reader" exec="/usr/apps/org.tizen.screen-reader/bin/screen-reader" nodisplay="true" multiple="false" type="capp" taskmanage="false">
<label>screen-reader</label>
<icon>/usr/apps/org.tizen.screen-reader/res/icons/screen-reader.png</icon>
<label xml:lang="en-us">screen-reader</label>
<operation name="http://tizen.org/appcontrol/operation/read_screen"/>
</app-control>
<background-category value="media"/>
- </service-application>
+ </ui-application>
</manifest>
Name: org.tizen.screen-reader
Summary: Screen Reader Assistive Technology
-Version: 0.0.7
+Version: 0.0.6
Release: 1
License: Flora-1.1
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(capi-network-bluetooth)
BuildRequires: pkgconfig(notification)
BuildRequires: pkgconfig(capi-network-wifi)
-BuildRequires: pkgconfig(capi-appfw-service-application)
%if "%{?tizen_profile_name}" != "tv"
BuildRequires: pkgconfig(tapi)
%endif
-e 's%^.*: error: .*$%\x1b[37;41m&\x1b[m%' \
-e 's%^.*: warning: .*$%\x1b[30;43m&\x1b[m%'
export LD_LIBRARY_PATH=/emul/ia32-linux/lib:/emul/ia32-linux/usr/lib:$LD_LIBRARY_PATH
-make test
+#make test
%install
rm -rf %{buildroot}
-msgid "IDS_TRAIT_SLIDER_SWIPE_COMMUNICATE"
-msgstr "flick up and down to adjust the position. "
-
-msgid "IDS_TRAIT_SLIDER_VALUE"
-msgstr " from %.*f to %.*f, current value %.*f, "
-
msgid "IDS_SCROLLING_FINISHED"
msgstr "Scrolling finished"
msgid "IDS_TRAIT_ITEM_SELECTED_COUNT"
msgstr "%d selected in total"
-
return EINA_FALSE;
}
+ /* Extent of candidate object could be 0 */
+ component = atspi_accessible_get_component_iface(obj);
+ extent = atspi_component_get_extents(component, ATSPI_COORD_TYPE_SCREEN, NULL);
+
+ if (extent->width <= 0 || extent->height <= 0) {
+ g_free(extent);
+ return EINA_FALSE;
+ }
+ g_free(extent);
+
ss = atspi_accessible_get_state_set(obj);
if (ss) {
if (_object_is_item(obj)) {
ret = atspi_state_set_contains(pss, ATSPI_STATE_SHOWING) && atspi_state_set_contains(pss, ATSPI_STATE_VISIBLE) && !_is_collapsed(pss);
DEBUG("ITEM HAS SHOWING && VISIBLE && NOT COLLAPSED PARENT %d", ret);
g_object_unref(pss);
- g_object_unref(ss);
return ret;
}
}
} else {
- /* Extent of candidate object could be 0 */
- component = atspi_accessible_get_component_iface(obj);
- extent = atspi_component_get_extents(component, ATSPI_COORD_TYPE_SCREEN, NULL);
- g_object_unref(component);
-
- if (extent->width <= 0 || extent->height <= 0) {
- g_free(extent);
- g_object_unref(ss);
- return EINA_FALSE;
- }
- g_free(extent);
-
ret = atspi_state_set_contains(ss, ATSPI_STATE_SHOWING) && atspi_state_set_contains(ss, ATSPI_STATE_VISIBLE);
}
g_object_unref(ss);
name = atspi_accessible_get_name(obj, NULL);
ret = EINA_FALSE;
- if (name) {
- if (strncmp(name, "\0", 1)) {
- DEBUG("Has name:[%s]", name);
- ret = EINA_TRUE;
- }
- g_free(name);
+ if (strncmp(name, "\0", 1)) {
+ DEBUG("Has name:[%s]", name);
+ ret = EINA_TRUE;
}
- if (!ret) {
- desc = atspi_accessible_get_description(obj, NULL);
- if (desc) {
- if (strncmp(desc, "\0", 1)) {
- DEBUG("Has description:[%s]", desc);
- ret = EINA_TRUE;
- }
- g_free(desc);
- }
+ g_free(name);
+ desc = atspi_accessible_get_description(obj, NULL);
+ if (!ret && strncmp(desc, "\0", 1)) {
+ DEBUG("Has description:[%s]", desc);
+ ret = EINA_TRUE;
}
+ g_free(desc);
if (!ret) {
action = atspi_accessible_get_action_iface(obj);
if (action) {
static Eina_Bool _has_next_sibling(AtspiAccessible * obj, int next_sibling_idx_modifier)
{
Eina_Bool ret = EINA_FALSE;
- if (!obj) return ret;
-
int idx = atspi_accessible_get_index_in_parent(obj, NULL);
if (idx >= 0) {
AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL);
AtspiAccessible *_directional_depth_first_search(AtspiAccessible * root, AtspiAccessible * start, int next_sibling_idx_modifier, Eina_Bool(*stop_condition) (AtspiAccessible *))
{
Eina_Bool start_is_not_defunct = EINA_FALSE;
- AtspiStateSet *ss;
-
if (start) {
AtspiStateSet *ss = atspi_accessible_get_state_set(start);
start_is_not_defunct = !atspi_state_set_contains(ss, ATSPI_STATE_DEFUNCT);
g_object_unref(next_related_in_direction);
relation_mode = EINA_FALSE;
int cc = atspi_accessible_get_child_count(node, NULL);
- ss = atspi_accessible_get_state_set(node);
-
- if (cc > 0 && atspi_state_set_contains(ss, ATSPI_STATE_SHOWING)) // walk down
+ if (cc > 0) // walk down
{
int idx = next_sibling_idx_modifier > 0 ? 0 : cc - 1;
g_object_unref(node);
if (!node || node == root) {
DEBUG("DFS END");
g_object_unref(node);
- g_object_unref(ss);
return NULL;
}
g_object_unref(node);
node = atspi_accessible_get_child_at_index(atspi_accessible_get_parent(node, NULL), idx + next_sibling_idx_modifier, NULL); //... and next
DEBUG("DFS NEXT %d", idx + next_sibling_idx_modifier);
}
- g_object_unref(ss);
}
}
DEBUG("DFS END");
#include <string.h>
#include <atspi/atspi.h>
-#include <Ecore.h>
#include <Ecore_X.h>
#include "keyboard_tracker.h"
#include "logger.h"
void keyboard_tracker_init(void)
{
+ atspi_init();
listener = atspi_device_listener_new(device_cb, NULL, NULL);
atspi_register_keystroke_listener(listener, NULL, 0, ATSPI_KEY_PRESSED, ATSPI_KEYLISTENER_SYNCHRONOUS | ATSPI_KEYLISTENER_CANCONSUME, NULL);
active_xwindow_property_tracker_register();
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "logger.h"
+
+int _eina_log_dom;
+
+#define SCREEN_READER_LOG_DOMAIN_NAME "screen-reader"
+
+int logger_init(void)
+{
+ eina_init();
+
+ if (!_eina_log_dom) {
+ _eina_log_dom = eina_log_domain_register(SCREEN_READER_LOG_DOMAIN_NAME, NULL);
+ if (_eina_log_dom < 0) {
+ fprintf(stderr, "Unable to register screen-reader log domain");
+ return -1;
+ }
+ eina_log_domain_level_set(SCREEN_READER_LOG_DOMAIN_NAME, EINA_LOG_LEVEL_DBG);
+ }
+ return 0;
+}
+
+void logger_shutdown(void)
+{
+ eina_shutdown();
+
+ if (_eina_log_dom) {
+ eina_log_domain_unregister(_eina_log_dom);
+ _eina_log_dom = 0;
+ }
+}
#include <appcore-efl.h>
#include <Elementary.h>
#include <eldbus-1/Eldbus.h>
-#include <service_app.h>
-#include <vconf.h>
#include "navigator.h"
#include "window_tracker.h"
#include "logger.h"
}
}
-static bool app_create(void *data)
+static int app_create(void *data)
{
- if (vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, 1))
- ERROR("Can't set value of %s vconf key to 1", VCONFKEY_SETAPPL_ACCESSIBILITY_TTS);
- DEBUG("atspi_init");
- atspi_init();
- DEBUG("logger_init");
- DEBUG("screen_reader_create_service");
+ elm_init(0, NULL);
+
+ logger_init();
screen_reader_create_service(data);
#ifndef SCREEN_READER_TV
- DEBUG("screen_reader_gestures_init");
screen_reader_gestures_init();
- DEBUG("navigator_init");
navigator_init();
#endif
- DEBUG("screen_reader_switch_enabled_set");
screen_reader_switch_enabled_set(EINA_TRUE);
- return true;
+ return 0;
}
-static void app_terminate(void *data)
+static int app_terminate(void *data)
{
DEBUG("screen reader terminating");
#ifndef SCREEN_READER_TV
screen_reader_terminate_service(data);
DEBUG("clear ScreenReaderEnabled property");
screen_reader_switch_enabled_set(EINA_FALSE);
+ DEBUG("terminate logger");
+ logger_shutdown();
DEBUG("screen reader terminated");
- if (vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, 0))
- ERROR("Can't set value of %s vconf key to 0", VCONFKEY_SETAPPL_ACCESSIBILITY_TTS);
- DEBUG("libatspi terminated");
- atspi_exit();
-}
-
-static void app_control(app_control_h app_control, void *data)
-{
- return;
+ return 0;
}
int main(int argc, char **argv)
set_signal_handler();
unsetenv("ELM_ATSPI_MODE");
+ struct appcore_ops ops = {
+ .create = app_create,
+ .terminate = app_terminate,
+ .pause = NULL,
+ .resume = NULL,
+ .reset = NULL
+ };
+ ops.data = get_pointer_to_service_data_struct();
- service_app_lifecycle_callback_s event_callback;
-
- event_callback.create = app_create;
- event_callback.terminate = app_terminate;
- event_callback.app_control = app_control;
-
- return service_app_main(argc, argv, &event_callback, get_pointer_to_service_data_struct());
+ return appcore_efl_main("screen-reader", &argc, &argv, &ops);
}
error = NULL;\
}
-static void on_window_activate(void *data, AtspiAccessible * window);
-
typedef struct {
int x, y;
} last_focus_t;
DEBUG("START");
DEBUG("------------------------");
- gchar *name = atspi_accessible_get_name(obj, NULL);
- gchar *role = atspi_accessible_get_localized_role_name(obj, NULL);
- gchar *description = atspi_accessible_get_description(obj, NULL);
+ const char *name = atspi_accessible_get_name(obj, NULL);
+ const char *role = atspi_accessible_get_localized_role_name(obj, NULL);
+ const char *description = atspi_accessible_get_description(obj, NULL);
char *state_name = NULL;
AtspiStateSet *st = atspi_accessible_get_state_set(obj);
GArray *states = atspi_state_set_get_states(st);
}
DEBUG("NAME:%s", name);
- DEBUG("ROLE:%s", role);
+ DEBUG("ROLE:%s", role)
DEBUG("DESCRIPTION:%s", description);
DEBUG("CHILDS:%d", atspi_accessible_get_child_count(obj, NULL));
DEBUG("HIGHLIGHT_INDEX:%d", atspi_component_get_highlight_index(comp, NULL));
DEBUG("VALUE:%f", atspi_value_get_current_value(value, NULL));
DEBUG("VALUE MAX:%f", atspi_value_get_maximum_value(value, NULL));
DEBUG("VALUE MIN:%f", atspi_value_get_minimum_value(value, NULL));
- g_object_unref(value);
}
DEBUG("STATES:");
int a;
for (a = 0; ifaces && (a < ifaces->len); ++a) {
gchar * interface_name = g_array_index(ifaces, gchar *, a);
DEBUG(" %s", interface_name);
- g_free(interface_name);
+ free(interface_name);
}
if (ifaces)
g_array_free(ifaces, FALSE);
DEBUG("------------------------");
DEBUG("END");
- g_free(name);
- g_free(role);
- g_free(description);
}
char *generate_description_for_subtrees(AtspiAccessible * obj)
return 0;
}
-static bool _widget_has_state(AtspiAccessible * obj, AtspiStateType type)
-{
- Eina_Bool ret = EINA_FALSE;
- AtspiStateSet *st = atspi_accessible_get_state_set(obj);
- if (atspi_state_set_contains(st, type))
- ret = EINA_TRUE;
- g_object_unref(st);
- return ret;
-}
-
-int get_accuracy(double val, int max_accuracy)
-{
- char val_str[HOVERSEL_TRAIT_SIZE] = "";
- int position;
- int accuracy;
-
- snprintf(val_str, HOVERSEL_TRAIT_SIZE, "%.*f", max_accuracy, val);
- accuracy = max_accuracy;
- position = strlen(val_str) - 1;
- while ( position > 0 && val_str[position] == '0' ) {
- --position;
- --accuracy;
- }
- return accuracy;
-}
-
-void add_slider_description(char *dest, uint dest_size, AtspiAccessible *obj)
-{
- gchar *role_name;
- AtspiValue *value_iface;
- double val;
- double min_val;
- double max_val;
- char trait[HOVERSEL_TRAIT_SIZE] = "";
- int accuracy;
-
- role_name = atspi_accessible_get_localized_role_name(obj, NULL);
- if (role_name) {
- strncat(dest, role_name, dest_size - strlen(dest) - 1);
- g_free(role_name);
- }
-
- value_iface = atspi_accessible_get_value_iface(obj);
- if (!value_iface) {
- return;
- }
-
- accuracy = get_accuracy( atspi_value_get_minimum_increment(value_iface, NULL), 3 );
- val = atspi_value_get_current_value(value_iface, NULL);
- max_val = atspi_value_get_maximum_value(value_iface, NULL);
- min_val = atspi_value_get_minimum_value(value_iface, NULL);
- snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_SLIDER_VALUE"), accuracy, min_val, accuracy, max_val, accuracy, val);
- strncat(dest, trait, dest_size - strlen(dest) - 1);
-
- if (_widget_has_state(obj, ATSPI_STATE_ENABLED)) {
- strncat(dest, _("IDS_TRAIT_SLIDER_SWIPE_COMMUNICATE"), dest_size - strlen(dest) - 1);
- }
- g_object_unref(value_iface);
-}
-
char *generate_trait(AtspiAccessible * obj)
{
if (!obj)
AtspiRole role = atspi_accessible_get_role(obj, NULL);
AtspiStateSet *state_set = atspi_accessible_get_state_set(obj);
char ret[TTS_MAX_TEXT_SIZE] = "\0";
- switch (role) {
- case ATSPI_ROLE_ENTRY: {
- gchar *role_name = atspi_accessible_get_localized_role_name(obj, NULL);
- if (role_name) {
- strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1);
- strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
- if (atspi_state_set_contains(state_set, ATSPI_STATE_FOCUSED))
- strncat(ret, _("IDS_TRAIT_TEXT_EDIT_FOCUSED"), sizeof(ret) - strlen(ret) - 1);
- else
- strncat(ret, _("IDS_TRAIT_TEXT_EDIT"), sizeof(ret) - strlen(ret) - 1);
- g_free(role_name);
- }
- break;
- }
- case ATSPI_ROLE_MENU_ITEM: {
+ if (role == ATSPI_ROLE_ENTRY) {
+ char *role_name = atspi_accessible_get_localized_role_name(obj, NULL);
+ strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1);
+ strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
+ if (atspi_state_set_contains(state_set, ATSPI_STATE_FOCUSED))
+ strncat(ret, _("IDS_TRAIT_TEXT_EDIT_FOCUSED"), sizeof(ret) - strlen(ret) - 1);
+ else
+ strncat(ret, _("IDS_TRAIT_TEXT_EDIT"), sizeof(ret) - strlen(ret) - 1);
+ free(role_name);
+ } else if (role == ATSPI_ROLE_MENU_ITEM) {
AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL);
int children_count = atspi_accessible_get_child_count(parent, NULL);
int index = atspi_accessible_get_index_in_parent(obj, NULL);
snprintf(tab_index, MENU_ITEM_TAB_INDEX_SIZE, _("IDS_TRAIT_MENU_ITEM_TAB_INDEX"), index + 1, children_count);
strncat(ret, tab_index, sizeof(ret) - strlen(ret) - 1);
g_object_unref(parent);
- break;
- }
- case ATSPI_ROLE_POPUP_MENU: {
+ } else if (role == ATSPI_ROLE_POPUP_MENU) {
int children_count = atspi_accessible_get_child_count(obj, NULL);
char trait[HOVERSEL_TRAIT_SIZE];
snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_POPUP_CLOSE"));
strncat(ret, trait, sizeof(ret) - strlen(ret) - 1);
- break;
- }
- case ATSPI_ROLE_DIALOG: {
+ } else if (role == ATSPI_ROLE_DIALOG) {
int children_count = _find_popup_list_children_count(obj);
char trait[HOVERSEL_TRAIT_SIZE];
snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_POPUP_CLOSE"));
strncat(ret, trait, sizeof(ret) - strlen(ret) - 1);
- break;
- }
- case ATSPI_ROLE_GLASS_PANE: {
+ } else if (role == ATSPI_ROLE_GLASS_PANE) {
AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL);
int children_count = atspi_accessible_get_child_count(parent, NULL);
char trait[HOVERSEL_TRAIT_SIZE];
snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_PD_HOVERSEL"), children_count);
strncat(ret, trait, sizeof(ret) - strlen(ret) - 1);
g_object_unref(parent);
- break;
- }
- case ATSPI_ROLE_LIST_ITEM: {
+ } else if (role == ATSPI_ROLE_LIST_ITEM) {
+
AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL);
AtspiRole parent_role = atspi_accessible_get_role(parent, NULL);
} else {
strncat(ret, _("IDS_TRAIT_GROUP_INDEX_COLLAPSED"), sizeof(ret) - strlen(ret) - 1);
}
+ } else {
+ g_object_unref(parent);
+ return NULL;
}
+
g_object_unref(parent);
- break;
- }
- case ATSPI_ROLE_CHECK_BOX:
- case ATSPI_ROLE_RADIO_BUTTON: {
+
+ } else if ((role == ATSPI_ROLE_CHECK_BOX) || (role == ATSPI_ROLE_RADIO_BUTTON)) {
if (atspi_state_set_contains(state_set, ATSPI_STATE_CHECKED)) {
strncat(ret, _("IDS_TRAIT_CHECK_BOX_SELECTED"), sizeof(ret) - strlen(ret) - 1);
} else {
}
if (role == ATSPI_ROLE_RADIO_BUTTON) {
- /* Say role name ("radio button"), but only if it's not a color chooser */
+ /* Don't say role name if it's a color chooser radio button */
AtspiAccessible *parent;
AtspiRole parent_role;
parent = atspi_accessible_get_parent(obj, NULL);
parent_role = atspi_accessible_get_role(parent, NULL);
if (parent_role != ATSPI_ROLE_COLOR_CHOOSER) {
- gchar *role_name;
+ char *role_name;
role_name = atspi_accessible_get_localized_role_name(obj, NULL);
- if (role_name) {
- strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
- strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1);
- g_free(role_name);
- }
+ strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
+ strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1);
+ free(role_name);
}
g_object_unref(parent);
}
- break;
- }
- case ATSPI_ROLE_PUSH_BUTTON: {
+ } else if (role == ATSPI_ROLE_PUSH_BUTTON) {
strncat(ret, _("IDS_TRAIT_PUSH_BUTTON"), sizeof(ret) - strlen(ret) - 1);
- break;
- }
- case ATSPI_ROLE_PROGRESS_BAR: {
+ } else if (role == ATSPI_ROLE_PROGRESS_BAR) {
AtspiValue *value = atspi_accessible_get_value_iface(obj);
- if (value) {
- double val = atspi_value_get_current_value(value, NULL);
- char trait[HOVERSEL_TRAIT_SIZE];
- if (val > 0) {
- snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_PD_PROGRESSBAR_PERCENT"), val * 100);
- strncat(ret, trait, sizeof(ret) - strlen(ret) - 1);
- } else {
- strncat(ret, _("IDS_TRAIT_PD_PROGRESSBAR"), sizeof(ret) - strlen(ret) - 1);
- }
- g_object_unref(value);
+ double val = atspi_value_get_current_value(value, NULL);
+ char trait[HOVERSEL_TRAIT_SIZE];
+ if (val > 0) {
+ snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_PD_PROGRESSBAR_PERCENT"), val * 100);
+ strncat(ret, trait, sizeof(ret) - strlen(ret) - 1);
+ } else {
+ strncat(ret, _("IDS_TRAIT_PD_PROGRESSBAR"), sizeof(ret) - strlen(ret) - 1);
}
- break;
- }
- case ATSPI_ROLE_TOGGLE_BUTTON: {
+ } else if (role == ATSPI_ROLE_TOGGLE_BUTTON) {
strncat(ret, _("IDS_TRAIT_TOGGLE_BUTTON"), sizeof(ret) - strlen(ret) - 1);
strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
if (atspi_state_set_contains(state_set, ATSPI_STATE_CHECKED)) {
} else {
strncat(ret, _("IDS_TRAIT_TOGGLE_BUTTON_OFF"), sizeof(ret) - strlen(ret) - 1);
}
- break;
- }
- case ATSPI_ROLE_SLIDER: {
- add_slider_description(ret, sizeof(ret), obj);
- break;
- }
- case ATSPI_ROLE_HEADING:
- case ATSPI_ROLE_GROUPING: {
- break;
- }
- default: {
- gchar *role_name = atspi_accessible_get_localized_role_name(obj, NULL);
- if (role_name) {
- strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1);
- g_free(role_name);
- }
- }
+ } else if (role == ATSPI_ROLE_HEADING) {
+ return strdup("");
+ } else {
+ char *role_name = atspi_accessible_get_localized_role_name(obj, NULL);
+ strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1);
+ free(role_name);
}
if (state_set)
g_free(desc);
return ret;
}
-
- if (desc) {
- if (desc[0] != '\0') {
- char *tmp = ret;
- if (asprintf(&ret, "%s, %s", desc, ret) < 0)
- ERROR("asprintf failed.");
- free(tmp);
- }
- g_free(desc);
- }
-
-
- return ret;
-}
-
-static char *generate_name_from_relation_object(AtspiAccessible *obj)
-{
- GError *err = NULL;
- char *name = atspi_accessible_get_name(obj, &err);
-
- if(err)
+ if (desc[0] != '\0')
{
- g_error_free(err);
- g_free(name);
- return NULL;
+ char *tmp = ret;
+ if (asprintf(&ret, "%s, %s", desc, ret) < 0)
+ ERROR("asprintf failed.");
+ free(tmp);
}
- return name;
+ g_free(desc);
+ return ret;
}
static char *generate_what_to_read(AtspiAccessible * obj)
char *text = NULL;
char ret[TTS_MAX_TEXT_SIZE] = "\0";
char *description_from_relation;
- char *name_from_relation;
description = atspi_accessible_get_description(obj, NULL);
name = atspi_accessible_get_name(obj, NULL);
role_name = generate_trait(obj);
other = generate_description_for_subtrees(obj);
description_from_relation = generate_text_for_relation_objects(obj, ATSPI_RELATION_DESCRIBED_BY, generate_description_from_relation_object);
- name_from_relation = generate_text_for_relation_objects(obj, ATSPI_RELATION_LABELLED_BY, generate_name_from_relation_object);
AtspiText *iface_text = atspi_accessible_get_text_iface(obj);
if (iface_text) {
text = atspi_text_get_text(iface_text, 0, atspi_text_get_character_count(iface_text, NULL), NULL);
strncat(ret, names, sizeof(ret) - strlen(ret) - 1);
}
- if (name_from_relation && strlen(name_from_relation) > 0) {
- if(strlen(ret) > 0)
- strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
- strncat(ret, name_from_relation, sizeof(ret) - strlen(ret) - 1);
- }
-
if (role_name && strlen(role_name) > 0) {
if (strlen(ret) > 0)
strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1);
free(text);
free(name);
free(names);
- free(name_from_relation);
free(description);
free(role_name);
free(other);
char buf[256] = "\0";
snprintf(buf, sizeof(buf), "%d percent", proc);
DEBUG("has value %s", buf);
- tts_speak(buf, EINA_TRUE);
+ tts_speak(strdup(buf), EINA_TRUE);
}
static void _value_inc(void)
ERROR("No value interface supported!\n");
}
+static bool _check_if_widget_is_enabled(AtspiAccessible * obj)
+{
+ Eina_Bool ret = EINA_FALSE;
+ AtspiStateSet *st = atspi_accessible_get_state_set(obj);
+
+ if (atspi_state_set_contains(st, ATSPI_STATE_ENABLED))
+ ret = EINA_TRUE;
+
+ g_object_unref(st);
+ return ret;
+}
+
static void _activate_widget(void)
{
//activate the widget
if (!current_obj)
return;
- if (!_widget_has_state(current_obj, ATSPI_STATE_ENABLED)) {
+ if (!_check_if_widget_is_enabled(current_obj)) {
DEBUG("Widget is disabled so cannot be activated");
return;
}
DEBUG("START");
Ecore_X_Window xwin = 0;
- if (quickpanel_switch)
- DEBUG("QUICKPANEL STATE ON");
- else
- DEBUG("QUICKPANEL STATE OFF");
+ ERROR(quickpanel_switch ? "QUICKPANEL STATE ON" : "QUICKPANEL STATE OFF");
Ecore_X_Illume_Quickpanel_State state;
return EINA_FALSE;
}
- return _widget_has_state(current_obj, ATSPI_STATE_ENABLED);
+ return _check_if_widget_is_enabled(current_obj);
}
static Eina_Bool _is_active_entry(void)
return;
}
- if (!_widget_has_state(obj, ATSPI_STATE_ENABLED)) {
+ if (!_check_if_widget_is_enabled(obj)) {
DEBUG("Slider is disabled");
prepared = false;
return;
if (gi->state == 1) {
counter++;
- DEBUG("SCROLLING but not meet counter:%d", counter);
+ DEBUG("SCROLLING but not meet counter:%d", counter)
if (counter >= GESTURE_LIMIT) {
counter = 0;
DEBUG("Scroll on point %d %d", gi->x_end, gi->y_end);
static void _view_content_changed(AtspiAccessible * root, void *user_data)
{
+ DEBUG("START");
if (flat_navi_is_valid(context, root))
return;
- if (!_widget_has_state(root, ATSPI_STATE_SHOWING))
- return;
flat_navi_context_free(context);
context = flat_navi_context_create(root);
_current_highlight_object_set(flat_navi_context_current_get(context));
+ DEBUG("END");
}
static void _new_highlighted_obj_changed(AtspiAccessible * new_highlighted_obj, void *user_data)
GError *err = NULL;
AtspiStateSet *states = atspi_state_set_new(NULL);
atspi_state_set_add(states, ATSPI_STATE_MODAL);
- atspi_state_set_add(states, ATSPI_STATE_SHOWING);
- atspi_state_set_add(states, ATSPI_STATE_VISIBLE);
DEBUG("GET MODAL: STATE SET PREPARED");
AtspiMatchRule *rule = atspi_match_rule_new(states,
- ATSPI_Collection_MATCH_ALL,
+ ATSPI_Collection_MATCH_ANY,
NULL,
ATSPI_Collection_MATCH_INVALID,
NULL,
ATSPI_Collection_MATCH_INVALID,
NULL,
ATSPI_Collection_MATCH_INVALID,
- FALSE);
+ 0);
DEBUG("GET MODAL: MATCHING RULE PREPARED");
AtspiAccessible *ret = NULL;
AtspiCollection *col_iface = atspi_accessible_get_collection_iface(root);
GArray *result = atspi_collection_get_matches(col_iface,
rule,
- ATSPI_Collection_SORT_ORDER_CANONICAL,
+ ATSPI_Collection_SORT_ORDER_INVALID,
+ 1,
1,
- TRUE,
&err);
GERROR_CHECK(err);
DEBUG("GET MODAL: QUERY PERFORMED");
if (window) {
DEBUG("Window name: %s", atspi_accessible_get_name(window, NULL));
+ app_tracker_callback_register(window, _view_content_changed, NULL);
// TODO: modal descendant of window should be used (if exists) otherwise window
AtspiAccessible *modal_descendant = _get_modal_descendant(window);
- app_tracker_callback_register(modal_descendant ? modal_descendant : window, _view_content_changed, NULL);
_view_content_changed(modal_descendant ? modal_descendant : window, NULL);
g_object_unref(modal_descendant);
} else {
char *spi_event_get_text_to_read(AtspiEvent * event, void *user_data)
{
DEBUG("START");
+
Service_Data *sd = (Service_Data *) user_data;
char *text_to_read;
void spi_event_listener_cb(AtspiEvent * event, void *user_data)
{
- DEBUG("START");
- display_info(event);
+ DEBUG("START")
+ display_info(event);
if (!user_data) {
ERROR("Invalid parameter");
ERROR("Can not prepare text to read");
return;
}
- DEBUG("SPEAK: %s", text_to_read);
+ DEBUG("SPEAK: %s", text_to_read)
tts_speak(text_to_read, EINA_TRUE);
free(text_to_read);
- DEBUG("END");
+ DEBUG("END")
}
/**
sd->spi_listener = atspi_event_listener_new(spi_event_listener_cb, service_data, NULL);
if (sd->spi_listener == NULL) {
- DEBUG("FAILED TO CREATE spi state changed listener");
+ DEBUG("FAILED TO CREATE spi state changed listener")
}
// ---------------------------------------------------------------------------------------------------
}
if (noti_count == 0) {
+ DEBUG(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_0"));
tts_speak(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_0"), EINA_FALSE);
} else if (noti_count == 1) {
+ DEBUG(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_1"));
tts_speak(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_1"), EINA_FALSE);
} else {
DEBUG("%d %s", noti_count, _("IDS_SYSTEM_NOTIFICATIONS_UNREAD_MANY"));
flush_flag = EINA_FALSE;
}
-#ifndef SCREEN_READER_TV
if (last_utt_id == utt_id) {
DEBUG("LAST UTTERANCE");
pause_state = EINA_FALSE;
on_utterance_end();
}
-#endif
return;
}
sd->update_language_list = EINA_TRUE;
}
- DEBUG("END");
- return EINA_TRUE;
+ DEBUG("END")
+ return EINA_TRUE;
}
void state_changed_cb(tts_h tts, tts_state_e previous, tts_state_e current, void *user_data)
#include <Elementary.h>
#include <vconf.h>
-#include <service_app.h>
#include "screen_reader_vconf.h"
#include "screen_reader_spi.h"
#include "logger.h"
service_data->run_service = node->value.i;
if (service_data->run_service == 0) {
- service_app_exit();
+ elm_exit();
}
DEBUG("END");
snprintf(buf, sizeof(buf), _("IDS_REACHED_ITEMS_NOTIFICATION"), start_idx, end_idx);
- tts_speak(buf, EINA_FALSE);
+ tts_speak(strdup(buf), EINA_FALSE);
}
check
vconf
elementary
- capi-appfw-service-application
)
FOREACH(flag ${tests_CFLAGS})
${CMAKE_SOURCE_DIR}/src/screen_reader_vconf.c
${CMAKE_SOURCE_DIR}/src/screen_reader_spi.c
${CMAKE_SOURCE_DIR}/src/screen_reader_tts.c
+ ${CMAKE_SOURCE_DIR}/src/logger.c
${CMAKE_SOURCE_DIR}/src/flat_navi.c)
ADD_DEFINITIONS(-DSCREEN_READER_FLAT_NAVI_TEST_DUMMY_IMPLEMENTATION)
rect.y = 50;
rect.width = 50;
rect.height = 50;
- } else if (*(component->role) == ATSPI_ROLE_WINDOW) {
- rect.x = 0;
- rect.y = 0;
- rect.width = 100;
- rect.height = 100;
- } else if (*(component->role) == ATSPI_ROLE_FILLER) {
- rect.x = 50;
- rect.y = 50;
- rect.width = 50;
- rect.height = 50;
} else {
rect.x = 0;
rect.y = 0;
{
child->index_in_parent = obj->child_count;
child->accessible_parent = obj;
-
obj->children = g_list_append(obj->children, child);
obj->child_count++;
}
AtspiAccessible *atspi_accessible_get_parent(AtspiAccessible * obj, GError ** error)
{
- return g_object_ref (obj->accessible_parent);
+ return obj->accessible_parent;
}
int atspi_component_get_highlight_index(AtspiComponent * obj, GError ** error)
prev = flat_navi_context_prev(ctx);
fail_if(!prev || prev != child19);
}
-END_TEST
+END_TEST
+/*
START_TEST(spi_flat_navi_context_last_null_parameter)
{
AtspiAccessible *last = flat_navi_context_last(NULL);
START_TEST(spi_flat_navi_context_last_valid_parameter)
{
AtspiAccessible *last = flat_navi_context_last(ctx);
- fail_if(!last || last != child6);
+ fail_if(!last || last != child2);
}
END_TEST
START_TEST(spi_flat_navi_context_first_valid_parameter)
{
AtspiAccessible *first = flat_navi_context_first(ctx);
- fail_if(!first || first != child5);
+ fail_if(!first || first != child1);
}
END_TEST
}
END_TEST
-Suite * screen_reader_suite(void)
+START_TEST(spi_flat_navi_context_line_prev_null_parameter)
+{
+ AtspiAccessible *prev = flat_navi_context_line_prev(NULL);
+ fail_if(prev);
+}
+END_TEST
+
+START_TEST(spi_flat_navi_context_line_prev_valid_parameter)
+{
+ AtspiAccessible *prev = flat_navi_context_line_prev(ctx);
+ fail_if(prev);
+ flat_navi_context_current_set(ctx, child4);
+ prev = flat_navi_context_line_prev(ctx);
+ fail_if(!prev || prev != child1);
+}
+END_TEST
+
+START_TEST(spi_flat_navi_context_line_next_null_parameter)
+{
+ AtspiAccessible *next = flat_navi_context_line_next(NULL);
+ fail_if(next);
+}
+END_TEST
+
+START_TEST(spi_flat_navi_context_line_next_valid_parameter)
+{
+ AtspiAccessible *next = flat_navi_context_line_next(ctx);
+ fail_if(!next || next != child3);
+}
+END_TEST
+
+START_TEST(spi_flat_navi_context_line_first_null_parameter)
+{
+ AtspiAccessible *first = flat_navi_context_line_first(NULL);
+ fail_if(first);
+}
+END_TEST
+
+START_TEST(spi_flat_navi_context_line_first_valid_parameter)
+{
+ AtspiAccessible *first = flat_navi_context_line_first(ctx);
+ fail_if(!first || first != child1);
+}
+END_TEST
+
+START_TEST(spi_flat_navi_context_line_last_null_parameter)
+{
+ AtspiAccessible *last = flat_navi_context_line_last(NULL);
+ fail_if(last);
+}
+END_TEST
+
+START_TEST(spi_flat_navi_context_line_last_valid_parameter)
+{
+ AtspiAccessible *last = flat_navi_context_line_last(ctx);
+ fail_if(!last || last != child3);
+}
+END_TEST
+*/
+ Suite * screen_reader_suite(void)
{
Suite *s;
TCase *tc_spi_screen_reader_init;
tcase_add_test(tc_spi_screen_reader_on_state_changed, spi_on_state_change_role);
tcase_add_test(tc_spi_screen_reader_on_caret_move, spi_on_caret_move);
tcase_add_test(tc_spi_screen_reader_on_access_value, spi_on_value_changed);
-
tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_create_null_parameter);
tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_create_valid_parameter);
tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_prev_valid_parameter);
tcase_add_test(tc_spi_screen_reader_flat_navi2, spi_flat_navi_context_prev_valid_parameter2);
tcase_add_test(tc_spi_screen_reader_flat_navi2, spi_flat_navi_context_prev_valid_parameter3);
-
- tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_null_parameter);
- tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_valid_parameter);
- tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_null_parameter);
- tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_valid_parameter);
- tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_null_parameters);
- tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_valid_parameters);
-
+ /*
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_null_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_valid_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_null_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_valid_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_null_parameters);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_valid_parameters);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_prev_null_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_prev_valid_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_next_null_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_next_valid_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_first_null_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_first_valid_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_last_null_parameter);
+ tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_last_valid_parameter);
+ */
suite_add_tcase(s, tc_spi_screen_reader_init);
suite_add_tcase(s, tc_spi_screen_reader_on_state_changed);
suite_add_tcase(s, tc_spi_screen_reader_on_caret_move);
s = screen_reader_suite();
sr = srunner_create(s);
- srunner_run_all(sr, CK_VERBOSE);
+ srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;