summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-29 16:30:34 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-29 16:43:33 +0200
commit0dc0ad891a33572bc2c056c425a3ae6566c26050 (patch)
treec3f62865961dcf432cb0488440e6bb51599ea118
parent087ce4215668d86d53065c877a234befae94878b (diff)
atspi: fix missing Window signals on AT-SPI2 initialization
Patch adds connected/disconnected elm_atspi_bridge events to avoid races between window getting focus and AT-SPI2 bus initialization. When bridge gets connected windows will reemit all "Created", "Activated" and "Deactivated" events with regard to window focus.
-rw-r--r--src/lib/elm_atspi_bridge.c45
-rw-r--r--src/lib/elm_atspi_bridge.eo4
-rw-r--r--src/lib/elm_win.c43
3 files changed, 54 insertions, 38 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index 9a5c9cb14..289f3af96 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -2997,6 +2997,10 @@ _registered_listeners_get(void *data, const Eldbus_Message *msg, Eldbus_Pending
2997 eldbus_message_iter_arguments_get(siter, "ss", &bus, &event); 2997 eldbus_message_iter_arguments_get(siter, "ss", &bus, &event);
2998 _set_broadcast_flag(event, data); 2998 _set_broadcast_flag(event, data);
2999 } 2999 }
3000
3001 if (!pd->connected)
3002 eo_do(data, eo_event_callback_call(ELM_ATSPI_BRIDGE_EVENT_CONNECTED, NULL));
3003 pd->connected = EINA_TRUE;
3000} 3004}
3001 3005
3002static void 3006static void
@@ -3145,46 +3149,24 @@ static Eina_Bool
3145_window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED) 3149_window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED)
3146{ 3150{
3147 enum _Atspi_Window_Signals type; 3151 enum _Atspi_Window_Signals type;
3148 const char *name;
3149 3152
3150 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE); 3153 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE);
3151 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, eo_class_name_get(ELM_INTERFACE_ATSPI_WINDOW_INTERFACE), ifc, EINA_FALSE); 3154 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, eo_class_name_get(ELM_INTERFACE_ATSPI_WINDOW_INTERFACE), ifc, EINA_FALSE);
3152 3155
3153 if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED) 3156 if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED)
3154 { 3157 type = ATSPI_WINDOW_EVENT_CREATE;
3155 type = ATSPI_WINDOW_EVENT_CREATE;
3156 name = "Create";
3157 }
3158 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED) 3158 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED)
3159 { 3159 type = ATSPI_WINDOW_EVENT_DESTROY;
3160 type = ATSPI_WINDOW_EVENT_DESTROY;
3161 name = "Destroy";
3162 }
3163 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED) 3160 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED)
3164 { 3161 type = ATSPI_WINDOW_EVENT_DEACTIVATE;
3165 type = ATSPI_WINDOW_EVENT_DEACTIVATE;
3166 name = "Deactivate";
3167 }
3168 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED) 3162 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED)
3169 { 3163 type = ATSPI_WINDOW_EVENT_ACTIVATE;
3170 type = ATSPI_WINDOW_EVENT_ACTIVATE;
3171 name = "Activate";
3172 }
3173 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MAXIMIZED) 3164 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MAXIMIZED)
3174 { 3165 type = ATSPI_WINDOW_EVENT_MAXIMIZE;
3175 type = ATSPI_WINDOW_EVENT_MAXIMIZE;
3176 name = "Maximize";
3177 }
3178 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MINIMIZED) 3166 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MINIMIZED)
3179 { 3167 type = ATSPI_WINDOW_EVENT_MINIMIZE;
3180 type = ATSPI_WINDOW_EVENT_MINIMIZE;
3181 name = "Minimize";
3182 }
3183 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED) 3168 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED)
3184 { 3169 type = ATSPI_WINDOW_EVENT_RESTORE;
3185 type = ATSPI_WINDOW_EVENT_RESTORE;
3186 name = "Restore";
3187 }
3188 else 3170 else
3189 return EINA_FALSE; 3171 return EINA_FALSE;
3190 3172
@@ -3197,7 +3179,7 @@ _window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void
3197 return EINA_FALSE; 3179 return EINA_FALSE;
3198 } 3180 }
3199 3181
3200 _bridge_signal_send(data, ifc, type, name, 0, 0, "i", 0); 3182 _bridge_signal_send(data, ifc, type, "", 0, 0, "i", 0);
3201 return EINA_TRUE; 3183 return EINA_TRUE;
3202} 3184}
3203 3185
@@ -3461,6 +3443,7 @@ _a11y_connection_shutdown(Eo *bridge)
3461 if (pd->a11y_bus) eldbus_connection_unref(pd->a11y_bus); 3443 if (pd->a11y_bus) eldbus_connection_unref(pd->a11y_bus);
3462 pd->a11y_bus = NULL; 3444 pd->a11y_bus = NULL;
3463 3445
3446 eo_do(bridge, eo_event_callback_call(ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, NULL));
3464 pd->connected = EINA_FALSE; 3447 pd->connected = EINA_FALSE;
3465} 3448}
3466 3449
@@ -3492,8 +3475,6 @@ _a11y_bus_initialize(Eo *obj, const char *socket_addr)
3492 // buid cache 3475 // buid cache
3493 eo_do(obj, root = elm_obj_atspi_bridge_root_get()); 3476 eo_do(obj, root = elm_obj_atspi_bridge_root_get());
3494 _bridge_cache_build(obj, root); 3477 _bridge_cache_build(obj, root);
3495
3496 pd->connected = EINA_TRUE;
3497} 3478}
3498 3479
3499static void 3480static void
diff --git a/src/lib/elm_atspi_bridge.eo b/src/lib/elm_atspi_bridge.eo
index fc1471ac1..eafd9f4b7 100644
--- a/src/lib/elm_atspi_bridge.eo
+++ b/src/lib/elm_atspi_bridge.eo
@@ -23,4 +23,8 @@ class Elm.Atspi_Bridge (Eo.Base)
23 Eo.Base.constructor; 23 Eo.Base.constructor;
24 Eo.Base.destructor; 24 Eo.Base.destructor;
25 } 25 }
26 events {
27 connected;
28 disconnected;
29 }
26} 30}
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index ff2021e78..e41113a7d 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -1507,9 +1507,6 @@ _elm_win_evas_object_smart_show(Eo *obj, Elm_Win_Data *sd)
1507 TRAP(sd, show); 1507 TRAP(sd, show);
1508 1508
1509 if (sd->shot.info) _shot_handle(sd); 1509 if (sd->shot.info) _shot_handle(sd);
1510
1511 if (_elm_config->atspi_mode)
1512 eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, NULL));
1513} 1510}
1514 1511
1515EOLIAN static void 1512EOLIAN static void
@@ -1878,6 +1875,9 @@ _elm_win_evas_object_smart_del(Eo *obj, Elm_Win_Data *sd)
1878 evas_font_cache_flush(evas_object_evas_get(obj)); 1875 evas_font_cache_flush(evas_object_evas_get(obj));
1879 elm_exit(); 1876 elm_exit();
1880 } 1877 }
1878
1879 if (_elm_config->atspi_mode)
1880 eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED, NULL));
1881} 1881}
1882 1882
1883static void 1883static void
@@ -2796,8 +2796,6 @@ _elm_win_frame_cb_close(void *data,
2796 evas_object_ref(win); 2796 evas_object_ref(win);
2797 evas_object_smart_callback_call(win, SIG_DELETE_REQUEST, NULL); 2797 evas_object_smart_callback_call(win, SIG_DELETE_REQUEST, NULL);
2798 // FIXME: if above callback deletes - then the below will be invalid 2798 // FIXME: if above callback deletes - then the below will be invalid
2799 if (_elm_config->atspi_mode)
2800 eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED, NULL));
2801 if (autodel) evas_object_del(win); 2799 if (autodel) evas_object_del(win);
2802 else sd->autodel_clear = NULL; 2800 else sd->autodel_clear = NULL;
2803 evas_object_unref(win); 2801 evas_object_unref(win);
@@ -3761,7 +3759,10 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
3761 { 3759 {
3762 Eo *bridge = _elm_atspi_bridge_get(); 3760 Eo *bridge = _elm_atspi_bridge_get();
3763 if (bridge) 3761 if (bridge)
3764 elm_interface_atspi_accessible_children_changed_added_signal_emit(elm_atspi_bridge_root_get(bridge), obj); 3762 {
3763 elm_interface_atspi_accessible_children_changed_added_signal_emit(elm_atspi_bridge_root_get(bridge), obj);
3764 }
3765 eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, NULL));
3765 } 3766 }
3766 3767
3767 evas_object_show(sd->edje); 3768 evas_object_show(sd->edje);
@@ -5411,10 +5412,40 @@ elm_win_window_id_get(const Evas_Object *obj)
5411 return ret; 5412 return ret;
5412} 5413}
5413 5414
5415static Eina_Bool
5416_on_atspi_bus_connected(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
5417{
5418 Evas_Object *win;
5419 Eina_List *l;
5420
5421 EINA_LIST_FOREACH(_elm_win_list, l, win)
5422 {
5423 /**
5424 * Reemit accessibility events when AT-SPI2 connection is begin
5425 * established. This assures that Assistive Technology clients will
5426 * recieve all org.a11y.window events and could keep track of active
5427 * windows whithin system.
5428 */
5429 eo_do(win, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, NULL));
5430 if (elm_win_focus_get(win))
5431 eo_do(win, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED, NULL));
5432 else
5433 eo_do(win, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED, NULL));
5434 }
5435 return EINA_TRUE;
5436}
5437
5414EOLIAN static void 5438EOLIAN static void
5415_elm_win_class_constructor(Eo_Class *klass) 5439_elm_win_class_constructor(Eo_Class *klass)
5416{ 5440{
5417 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass); 5441 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
5442
5443 if (_elm_config->atspi_mode)
5444 {
5445 Eo *bridge = _elm_atspi_bridge_get();
5446 if (bridge)
5447 eo_do(bridge, eo_event_callback_add(ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _on_atspi_bus_connected, NULL));
5448 }
5418} 5449}
5419 5450
5420EOLIAN static Eo* 5451EOLIAN static Eo*