}
-static void display_info_about_object(AtspiAccessible * obj, bool display_parent_info)
+static void display_info_about_object(AtspiAccessible *obj, bool display_parent_info)
{
if(!obj)
{
DEBUG("INTERFACES:");
GArray *ifaces = atspi_accessible_get_interfaces(obj);
for (a = 0; ifaces && (a < ifaces->len); ++a) {
- gchar * interface_name = g_array_index(ifaces, gchar *, a);
+ gchar *interface_name = g_array_index(ifaces, gchar *, a);
DEBUG(" %s", interface_name);
g_free(interface_name);
}
g_free(description);
}
-char *generate_description_for_subtrees(AtspiAccessible * obj)
+char *generate_description_for_subtrees(AtspiAccessible *obj)
{
DEBUG("START");
*/
}
-static int _check_list_children_count(AtspiAccessible * obj)
+static int _check_list_children_count(AtspiAccessible *obj)
{
int list_count = 0;
int i;
return list_count;
}
-static int _find_popup_list_children_count(AtspiAccessible * obj)
+static int _find_popup_list_children_count(AtspiAccessible *obj)
{
int list_items_count = 0;
int children_count = atspi_accessible_get_child_count(obj, NULL);
return 0;
}
-static bool _widget_has_state(AtspiAccessible * obj, AtspiStateType type)
+static bool _widget_has_state(AtspiAccessible *obj, AtspiStateType type)
{
Eina_Bool ret = EINA_FALSE;
AtspiStateSet *st = atspi_accessible_get_state_set(obj);
g_object_unref(value_iface);
}
-char *generate_trait(AtspiAccessible * obj)
+char *generate_trait(AtspiAccessible *obj)
{
if (!obj)
return strdup("");
if (parent_role == ATSPI_ROLE_TOOL_BAR) {
int children_count = atspi_accessible_get_child_count(parent, NULL);
int index = atspi_accessible_get_index_in_parent(obj, NULL);
- AtspiSelection* selection = atspi_accessible_get_selection_iface(parent);
+ AtspiSelection *selection = atspi_accessible_get_selection_iface(parent);
gboolean is_selected = atspi_selection_is_child_selected(selection, index, &err);
GERROR_CHECK(err);
char tab_index[MENU_ITEM_TAB_INDEX_SIZE];
return strdup(ret);
}
-char *generate_text_for_relation_objects(AtspiAccessible * obj, AtspiRelationType search, char *(*text_generate_cb)(AtspiAccessible *obj))
+char *generate_text_for_relation_objects(AtspiAccessible *obj, AtspiRelationType search, char *(*text_generate_cb)(AtspiAccessible *obj))
{
GError *err = NULL;
GArray *relations;
DEBUG("END");
}
-void test_debug(AtspiAccessible * current_widget)
+void test_debug(AtspiAccessible *current_widget)
{
int jdx;
int count_child;
if(relation)
g_object_unref(relation);
g_object_unref(ss);
-
}
static void _quickpanel_change_state(gboolean quickpanel_switch)
return EINA_FALSE;
}
-static Eina_Bool _is_slider(AtspiAccessible * obj)
+static Eina_Bool _is_slider(AtspiAccessible *obj)
{
DEBUG("START");
return action;
}
-static int _find_action_index(AtspiAction * action, char *action_name_to_find)
+static int _find_action_index(AtspiAction *action, char *action_name_to_find)
{
int action_num = atspi_action_get_n_actions(action, NULL);
char *action_name = NULL;
g_object_unref(obj);
}
-static AtspiAccessible *_get_modal_descendant(AtspiAccessible * root)
+static AtspiAccessible *_get_modal_descendant(AtspiAccessible *root)
{
GError *err = NULL;
AtspiStateSet *states = atspi_state_set_new(NULL);
navigator_gestures_tracker_register(on_gesture_detected, sd);
// register on active_window
sd->gesture_adapter_data = dbus_gesture_adapter_init();
- app_tracker_init();
+ sd->app_tracker_ctx = app_tracker_init();
app_tracker_new_obj_highlighted_callback_register(_new_highlighted_obj_changed, sd->app_tracker_ctx);
sd->window_tracker_data = window_tracker_init();
window_tracker_register(sd->window_tracker_data, on_window_activate, sd);
window_tracker_active_window_request(sd->window_tracker_data);
- smart_notification_init();
+ sd->smart_notification_data = smart_notification_init();
+ if (sd->smart_notification_data == NULL){
+ ERROR("Smart Notification not initialized");
+ return NULL;
+ }
+
#ifndef SCREEN_READER_TV
sd->system_data = system_notifications_init(sd);
#endif
if (sd->flat_navi_context != NULL) {
flat_navi_context_free(sd->flat_navi_context);
}
- dbus_gesture_adapter_shutdown(sd->gesture_adapter_data);
- //app_tracker_shutdown(sd->app_tracker_ctx);
+ dbus_gesture_adapter_shutdown(sd->gesture_adapter_data);
app_tracker_shutdown(sd->app_tracker_ctx);
window_tracker_shutdown(sd->window_tracker_data);
- smart_notification_shutdown();
+ smart_notification_shutdown(sd->smart_notification_data);
#ifndef SCREEN_READER_TV
system_notifications_shutdown(sd->system_data);
sd->system_data = NULL;
* limitations under the License.
*/
-#include <Ecore.h>
+
#include <Ecore_Evas.h>
#include <Evas.h>
#include <atspi/atspi.h>
#define RED "\x1B[31m"
#define RESET "\033[0m"
-static Eina_Bool status = EINA_FALSE;
-
-static void _smart_notification_focus_chain_end(void);
-static void _smart_notification_realized_items(int start_idx, int end_idx);
-static void _smart_notification_highlight(void);
-static void _smart_notification_highlight_actionable(void);
-static void _smart_notification_action(void);
-static void _smart_notification_contextual_menu(void);
-static void _smart_notification_long_press(void);
-static void _smart_notification_state_change(void);
+static void _handle_focus_chain_end(void);
+static void _handle_realized_items(int start_idx, int end_idx);
+static void _handle_highlight(void);
+static void _handle_highlight_actionable(void);
+static void _handle_action(void);
+static void _handle_contextual_menu(void);
+static void _handle_long_press(void);
+static void _handle_state_change(void);
static void
_playback_completed_cb(int id, void *user_data)
{
- const char* path = (const char*)user_data;
+ const char *path = (const char*)user_data;
DEBUG("WAV Player", "Completed! [id:%d, path:%s]", id, path);
}
DEBUG("path: (%s)", path);
return path;
}
-/**
- * @brief Smart Notifications event handler
- *
- * @param nt Notification event type
- * @param start_index int first visible items index smart_notification_realized_items
- * @param end_index int last visible items index used for smart_notification_realized_items
- */
+
void smart_notification(Notification_Type nt, int start_index, int end_index)
{
DEBUG("START");
- if (!status)
+ Service_Data *sd = get_pointer_to_service_data_struct();
+
+ if (sd == NULL || sd->smart_notification_data == NULL) {
+ ERROR("NULL context");
return;
+ }
+
+ if (sd->smart_notification_data->status == EINA_FALSE) {
+ ERROR("smart_notification disabled");
+ return;
+ }
switch (nt) {
case FOCUS_CHAIN_END_NOTIFICATION_EVENT:
- _smart_notification_focus_chain_end();
+ _handle_focus_chain_end();
break;
+
case REALIZED_ITEMS_NOTIFICATION_EVENT:
- _smart_notification_realized_items(start_index, end_index);
+ _handle_realized_items(start_index, end_index);
break;
+
case HIGHLIGHT_NOTIFICATION_EVENT:
- _smart_notification_highlight();
+ _handle_highlight();
break;
+
case HIGHLIGHT_NOTIFICATION_EVENT_ACTIONABLE:
- _smart_notification_highlight_actionable();
+ _handle_highlight_actionable();
break;
+
case ACTION_NOTIFICATION_EVENT:
- _smart_notification_action();
+ _handle_action();
break;
+
case CONTEXTUAL_MENU_NOTIFICATION_EVENT:
- _smart_notification_contextual_menu();
+ _handle_contextual_menu();
break;
+
case LONG_PRESS_NOTIFICATION_EVENT:
- _smart_notification_long_press();
+ _handle_long_press();
break;
+
case WINDOW_STATE_CHANGE_NOTIFICATION_EVENT:
- _smart_notification_state_change();
+ _handle_state_change();
break;
+
default:
DEBUG("Gesture type %d not handled in switch", nt);
}
* @param start_index int first visible items index smart_notification_realized_items
* @param end_index int last visible items index used for smart_notification_realized_items
*/
-void get_realized_items_count(AtspiAccessible * scrollable_object, int *start_idx, int *end_idx)
+void get_realized_items_count(AtspiAccessible *scrollable_object, int *start_idx, int *end_idx)
{
DEBUG("START");
int count_child, jdx;
* @param user_data UNUSED
*/
-static void _scroll_event_cb(AtspiEvent * event, gpointer user_data)
+static void _scroll_event_cb(AtspiEvent *event, gpointer user_data)
{
- if (!status)
+ Smart_Notification_Data *snd = (Smart_Notification_Data *)user_data;
+
+ if (snd == NULL || snd->status == EINA_FALSE)
return;
int start_index, end_index;
DEBUG("Scrolling finished");
tts_speak_customized(_("IDS_SCROLLING_FINISHED"), EINA_FALSE, EINA_TRUE, event->source);
get_realized_items_count((AtspiAccessible *) event->source, &start_index, &end_index);
- _smart_notification_realized_items(start_index, end_index);
+ _handle_realized_items(start_index, end_index);
}
}
*
*
*/
-void smart_notification_init(void)
+Smart_Notification_Data *smart_notification_init()
{
DEBUG("Smart Notification init!");
+ Smart_Notification_Data *snd = malloc(sizeof(Smart_Notification_Data));
+
+ if (snd == NULL) {
+ ERROR("memory not allocated");
+ return NULL;
+ }
+
+ snd->status = EINA_TRUE;
AtspiEventListener *listener;
+ listener = atspi_event_listener_new(_scroll_event_cb, snd, NULL);
+
+ if (listener == NULL) {
+ ERROR("listener not created");
+ free(snd);
+ return NULL;
+ }
- listener = atspi_event_listener_new(_scroll_event_cb, NULL, NULL);
atspi_event_listener_register(listener, "object:scroll-start", NULL);
atspi_event_listener_register(listener, "object:scroll-end", NULL);
haptic_module_init();
#endif
- status = EINA_TRUE;
+ return snd;
}
/**
* @brief Smart notifications shutdown
*
*/
-void smart_notification_shutdown(void)
+void smart_notification_shutdown(Smart_Notification_Data *snd)
{
#ifndef SCREEN_READER_TV
haptic_module_disconnect();
#endif
- status = EINA_FALSE;
+ free(snd);
}
/**
* @brief Smart notifications focus chain event handler
*
*/
-static void _smart_notification_focus_chain_end(void)
+static void _handle_focus_chain_end(void)
{
- if (!status)
- return;
-
DEBUG(RED "Smart notification - FOCUS CHAIN END" RESET);
int wav_player_id;
//sound to play when reached start/end not given hence using below.
* @brief Smart notifications hightlight event handler
*
*/
-static void _smart_notification_highlight(void)
+static void _handle_highlight(void)
{
- if (!status)
- return;
int wav_player_id;
- gchar* wav_path = _get_sound_path("focus_general.ogg");
+ gchar *wav_path = _get_sound_path("focus_general.ogg");
DEBUG("Smart notification - HIGHLIGHT" RESET);
wav_player_start(wav_path, SOUND_TYPE_MEDIA, _playback_completed_cb, (void*)wav_path, &wav_player_id);
g_free(wav_path);
}
-static void _smart_notification_highlight_actionable(void)
+static void _handle_highlight_actionable(void)
{
- if (!status)
- return;
int wav_player_id;
- gchar* wav_path = _get_sound_path("focus_actionable.ogg");
+ gchar *wav_path = _get_sound_path("focus_actionable.ogg");
DEBUG("Smart notification - HIGHLIGHT" RESET);
wav_player_start(wav_path, SOUND_TYPE_MEDIA, _playback_completed_cb, (void*)wav_path, &wav_player_id);
g_free(wav_path);
}
-static void _smart_notification_action(void)
+static void _handle_action(void)
{
- if (!status)
- return;
int wav_player_id;
- gchar* wav_path = _get_sound_path("clicked.ogg");
+ gchar *wav_path = _get_sound_path("clicked.ogg");
DEBUG("Smart notification - ACTION" RESET);
wav_player_start(wav_path, SOUND_TYPE_MEDIA, _playback_completed_cb, (void*)wav_path, &wav_player_id);
g_free(wav_path);
}
-static void _smart_notification_contextual_menu(void)
+static void _handle_contextual_menu(void)
{
- if (!status)
- return;
int wav_player_id;
- gchar* wav_path = _get_sound_path("contextual_menu.ogg");
+ gchar *wav_path = _get_sound_path("contextual_menu.ogg");
DEBUG("Smart notification - context menu" RESET);
wav_player_start(wav_path, SOUND_TYPE_MEDIA, _playback_completed_cb, (void*)wav_path, &wav_player_id);
g_free(wav_path);
}
-static void _smart_notification_long_press(void)
+static void _handle_long_press(void)
{
- if (!status)
- return;
int wav_player_id;
gchar* wav_path = _get_sound_path("long_clicked.ogg");
g_free(wav_path);
}
-static void _smart_notification_state_change(void)
+static void _handle_state_change(void)
{
- if (!status)
- return;
int wav_player_id;
- gchar* wav_path = _get_sound_path("window_state_changed.ogg");
+ gchar *wav_path = _get_sound_path("window_state_changed.ogg");
DEBUG("Smart notification - view change" RESET);
wav_player_start(wav_path, SOUND_TYPE_MEDIA, _playback_completed_cb, (void*)wav_path, &wav_player_id);
* @brief Smart notifications realized items event handler
*
*/
-static void _smart_notification_realized_items(int start_idx, int end_idx)
+static void _handle_realized_items(int start_idx, int end_idx)
{
- if (!status)
- return;
-
if (start_idx == end_idx)
return;