From 7253de7df2de95ce8e3ddd1ee55ab12f78218b0b Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Wed, 29 Apr 2015 15:08:57 +0200 Subject: [PATCH] atspi: more org.a11y.atspi.Window signals is broadcasted. --- src/lib/elm_atspi_bridge.c | 49 +++++++++++++++++++++-------------- src/lib/elm_interface_atspi_window.eo | 8 ++++-- src/lib/elm_win.c | 40 ++++++++++++++++++++++++---- 3 files changed, 70 insertions(+), 27 deletions(-) diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c index 9665084..ec9e2db 100644 --- a/src/lib/elm_atspi_bridge.c +++ b/src/lib/elm_atspi_bridge.c @@ -86,8 +86,12 @@ EO_CALLBACKS_ARRAY_DEFINE(_events_cb, EO_CALLBACKS_ARRAY_DEFINE(_window_cb, { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, _window_signal_send}, + { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED, _window_signal_send}, { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED, _window_signal_send}, - { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED, _window_signal_send} + { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED, _window_signal_send}, + { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MAXIMIZED, _window_signal_send}, + { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MINIMIZED, _window_signal_send}, + { ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED, _window_signal_send} ); EO_CALLBACKS_ARRAY_DEFINE(_selection_cb, @@ -2616,10 +2620,20 @@ _set_broadcast_flag(const char *event) _window_signal_broadcast_mask = -1; // broadcast all else if (!strcmp(tokens[1], "Create")) STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_CREATE); + else if (!strcmp(tokens[1], "Destroy")) + STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_DESTROY); else if (!strcmp(tokens[1], "Activate")) STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_ACTIVATE); else if (!strcmp(tokens[1], "Deactivate")) STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_DEACTIVATE); + else if (!strcmp(tokens[1], "Maximize")) + STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_MAXIMIZE); + else if (!strcmp(tokens[1], "Minimize")) + STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_MINIMIZE); + else if (!strcmp(tokens[1], "Resize")) + STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_RESIZE); + else if (!strcmp(tokens[1], "Restore")) + STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_RESTORE); } free(tokens[0]); @@ -2817,30 +2831,25 @@ _children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *d static Eina_Bool _window_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc, void *event_info EINA_UNUSED) { - const char *event_desc; Eldbus_Service_Interface *window = data; enum _Atspi_Window_Signals type; if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED) - { - event_desc = "Created"; - type = ATSPI_WINDOW_EVENT_CREATE; - } + type = ATSPI_WINDOW_EVENT_CREATE; + else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED) + type = ATSPI_WINDOW_EVENT_DESTROY; else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED) - { - event_desc = "Deactivate"; - type = ATSPI_WINDOW_EVENT_DEACTIVATE; - } + type = ATSPI_WINDOW_EVENT_DEACTIVATE; else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED) - { - event_desc = "Activate"; - type = ATSPI_WINDOW_EVENT_ACTIVATE; - } + type = ATSPI_WINDOW_EVENT_ACTIVATE; + else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MAXIMIZED) + type = ATSPI_WINDOW_EVENT_MAXIMIZE; + else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MINIMIZED) + type = ATSPI_WINDOW_EVENT_MINIMIZE; + else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED) + type = ATSPI_WINDOW_EVENT_RESTORE; else - { - WRN("ATSPI Window event not handled"); - return EINA_FALSE; - } + return EINA_FALSE; if (!STATE_TYPE_GET(_window_signal_broadcast_mask, type)) return EINA_FALSE; @@ -2851,9 +2860,9 @@ _window_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description return EINA_FALSE; } - _object_signal_send(window, type, event_desc, 0, 0, "i", 0); + _object_signal_send(window, type, "", 0, 0, "i", 0); - DBG("signal sent Window:%s", event_desc); + DBG("sent signal org.a11y.atspi.Window:%d", type); return EINA_TRUE; } diff --git a/src/lib/elm_interface_atspi_window.eo b/src/lib/elm_interface_atspi_window.eo index 4d57361..8c5c9b4 100644 --- a/src/lib/elm_interface_atspi_window.eo +++ b/src/lib/elm_interface_atspi_window.eo @@ -2,7 +2,11 @@ interface Elm_Interface_Atspi_Window () { events { window,created; /*@ Called when new window has been created. */ - window,activated; /*@ Called when new window has been activated. (unfocused) */ - window,deactivated; /*@ Called when new window has been deactivated (unfocused). */ + window,destroyed; /*@ Called when window has been destroyed. */ + window,activated; /*@ Called when window has been activated. (unfocused) */ + window,deactivated; /*@ Called when window has been deactivated (unfocused). */ + window,maximized; /* @ Called when window has been maximmized */ + window,minimized; /* @ Called when window has been minimized */ + window,restored; /* @ Called when window has been restored */ } } diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 8198a31..cc7fb34 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -1043,6 +1043,9 @@ _elm_win_focus_in(Ecore_Evas *ee) edje_object_signal_emit(sd->frame_obj, "elm,action,focus", "elm"); } + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED, NULL)); + /* do nothing */ /* else if (sd->img_obj) */ /* { */ @@ -1072,6 +1075,9 @@ _elm_win_focus_out(Ecore_Evas *ee) /* access */ _elm_access_object_highlight_disable(evas_object_evas_get(obj)); + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED, NULL)); + /* do nothing */ /* if (sd->img_obj) */ /* { */ @@ -1263,9 +1269,17 @@ _elm_win_state_change(Ecore_Evas *ee) if (sd->withdrawn) evas_object_smart_callback_call(obj, SIG_WITHDRAWN, NULL); else if (sd->iconified) - evas_object_smart_callback_call(obj, SIG_ICONIFIED, NULL); + { + evas_object_smart_callback_call(obj, SIG_ICONIFIED, NULL); + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MINIMIZED, NULL)); + } else - evas_object_smart_callback_call(obj, SIG_NORMAL, NULL); + { + evas_object_smart_callback_call(obj, SIG_NORMAL, NULL); + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED, NULL)); + } } if (ch_sticky) { @@ -1297,9 +1311,17 @@ _elm_win_state_change(Ecore_Evas *ee) if (ch_maximized) { if (sd->maximized) - evas_object_smart_callback_call(obj, SIG_MAXIMIZED, NULL); + { + evas_object_smart_callback_call(obj, SIG_MAXIMIZED, NULL); + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MAXIMIZED, NULL)); + } else - evas_object_smart_callback_call(obj, SIG_UNMAXIMIZED, NULL); + { + evas_object_smart_callback_call(obj, SIG_UNMAXIMIZED, NULL); + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED, NULL)); + } } if (ch_profile) { @@ -1468,6 +1490,9 @@ _elm_win_evas_object_smart_show(Eo *obj, Elm_Win_Data *sd) TRAP(sd, show); if (sd->shot.info) _shot_handle(sd); + + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, NULL)); } EOLIAN static void @@ -1503,6 +1528,8 @@ _elm_win_evas_object_smart_hide(Eo *obj, Elm_Win_Data *sd) ecore_evas_hide(sd->pointer.ee); #endif } + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED, NULL)); } static void @@ -1949,6 +1976,8 @@ _elm_win_delete_request(Ecore_Evas *ee) evas_object_ref(obj); evas_object_smart_callback_call(obj, SIG_DELETE_REQUEST, NULL); // FIXME: if above callback deletes - then the below will be invalid + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED, NULL)); if (autodel) evas_object_del(obj); else sd->autodel_clear = NULL; evas_object_unref(obj); @@ -2750,6 +2779,8 @@ _elm_win_frame_cb_close(void *data, evas_object_ref(win); evas_object_smart_callback_call(win, SIG_DELETE_REQUEST, NULL); // FIXME: if above callback deletes - then the below will be invalid + if (_elm_config->atspi_mode) + eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED, NULL)); if (autodel) evas_object_del(win); else sd->autodel_clear = NULL; evas_object_unref(win); @@ -3696,7 +3727,6 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_ if (_elm_config->atspi_mode == ELM_ATSPI_MODE_ON) { elm_interface_atspi_accessible_children_changed_added_signal_emit(_elm_atspi_bridge_root_get(), obj); - eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, NULL)); } evas_object_show(sd->edje); -- 2.7.4