summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2014-06-25 10:54:02 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2014-07-01 15:38:53 +0200
commit389f300d88c292dc8c5e0c5863a32f92c3aa8e9e (patch)
treeb089773d36b49c7f26ac877b730eab6a8d0fa67a
parentf23863ee290f7bffaa7b5f87576e84816f5262bb (diff)
atspi: simplify key event handling
Keyboard events are now directly handled by atspi_bridge instead of elm_widget.
-rw-r--r--src/lib/elm_atspi_bridge.c39
-rw-r--r--src/lib/elm_priv.h1
-rw-r--r--src/lib/elm_widget.c3
3 files changed, 19 insertions, 24 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index 4aca86a51..bdfea92b0 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -62,6 +62,7 @@ static unsigned long _object_property_broadcast_mask;
62static unsigned long _object_children_broadcast_mask; 62static unsigned long _object_children_broadcast_mask;
63static unsigned long long _object_state_broadcast_mask; 63static unsigned long long _object_state_broadcast_mask;
64static unsigned long long _window_signal_broadcast_mask; 64static unsigned long long _window_signal_broadcast_mask;
65static Ecore_Event_Handler *_key_hdl;
65 66
66static Eina_Bool _state_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); 67static Eina_Bool _state_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
67static Eina_Bool _property_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info); 68static Eina_Bool _property_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info);
@@ -79,6 +80,7 @@ static void _object_append_desktop_reference(Eldbus_Message_Iter *iter);
79static void _cache_build(void *obj); 80static void _cache_build(void *obj);
80static void _object_register(Eo *obj, char *path); 81static void _object_register(Eo *obj, char *path);
81static void _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj); 82static void _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj);
83static Eina_Bool _elm_atspi_bridge_key_down_event_notify(void *data, int type, void *event);
82 84
83EO_CALLBACKS_ARRAY_DEFINE(_events_cb, 85EO_CALLBACKS_ARRAY_DEFINE(_events_cb,
84 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_PROPERTY_CHANGED, _property_changed_signal_send}, 86 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_PROPERTY_CHANGED, _property_changed_signal_send},
@@ -3102,6 +3104,8 @@ _event_handlers_register(void)
3102 // register signal handlers in order to update list of registered listeners of ATSPI-Clients 3104 // register signal handlers in order to update list of registered listeners of ATSPI-Clients
3103 _register_hdl = eldbus_signal_handler_add(_a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerRegistered", _handle_listener_change, NULL); 3105 _register_hdl = eldbus_signal_handler_add(_a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerRegistered", _handle_listener_change, NULL);
3104 _unregister_hdl = eldbus_signal_handler_add(_a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerDeregistered", _handle_listener_change, NULL); 3106 _unregister_hdl = eldbus_signal_handler_add(_a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerDeregistered", _handle_listener_change, NULL);
3107
3108 _key_hdl = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _elm_atspi_bridge_key_down_event_notify, NULL);
3105} 3109}
3106 3110
3107static Eina_Bool 3111static Eina_Bool
@@ -3301,13 +3305,17 @@ _elm_atspi_bridge_shutdown(void)
3301 eldbus_connection_unref(_a11y_bus); 3305 eldbus_connection_unref(_a11y_bus);
3302 _a11y_bus = NULL; 3306 _a11y_bus = NULL;
3303 3307
3308 if (_key_hdl)
3309 ecore_event_handler_del(_key_hdl);
3310 _key_hdl = NULL;
3311
3304 _init_count = 0; 3312 _init_count = 0;
3305 _root = NULL; 3313 _root = NULL;
3306 } 3314 }
3307} 3315}
3308 3316
3309static void 3317static void
3310_iter_marshall_key_event(Eldbus_Message_Iter *iter, Evas_Callback_Type type, void *event) 3318_iter_marshall_key_down_event(Eldbus_Message_Iter *iter, Ecore_Event_Key *event)
3311{ 3319{
3312 Eldbus_Message_Iter *struct_iter; 3320 Eldbus_Message_Iter *struct_iter;
3313 3321
@@ -3315,37 +3323,28 @@ _iter_marshall_key_event(Eldbus_Message_Iter *iter, Evas_Callback_Type type, voi
3315 3323
3316 struct_iter = eldbus_message_iter_container_new(iter, 'r', NULL); 3324 struct_iter = eldbus_message_iter_container_new(iter, 'r', NULL);
3317 3325
3318 if (type == EVAS_CALLBACK_KEY_DOWN) 3326 const char *str = event->keyname ? event->keyname : "";
3319 { 3327 int is_text = event->keyname? 1 : 0;
3320 Evas_Event_Key_Down *kde = event; 3328 eldbus_message_iter_arguments_append(struct_iter, "uiiiisb", ATSPI_KEY_PRESSED_EVENT, 0, event->keycode, 0, event->timestamp, str, is_text);
3321 const char *str = kde->string ? kde->string : "";
3322 int is_text = kde->string ? 1 : 0;
3323 eldbus_message_iter_arguments_append(struct_iter, "uiiiisb", ATSPI_KEY_PRESSED_EVENT, 0, kde->keycode, 0, kde->timestamp, str, is_text);
3324 }
3325 else if (type == EVAS_CALLBACK_KEY_UP)
3326 {
3327 Evas_Event_Key_Up *kue = event;
3328 const char *str = kue->string ? kue->string : "";
3329 int is_text = kue->string ? 1 : 0;
3330 eldbus_message_iter_arguments_append(struct_iter, "uiiiisb", ATSPI_KEY_RELEASED_EVENT, 0, kue->keycode, 0, kue->timestamp, str, is_text);
3331 }
3332 3329
3333 eldbus_message_iter_container_close(iter, struct_iter); 3330 eldbus_message_iter_container_close(iter, struct_iter);
3334} 3331}
3335 3332
3336EAPI void 3333static Eina_Bool
3337_elm_atspi_bridge_key_event_notify(Evas_Callback_Type type, void *event) 3334_elm_atspi_bridge_key_down_event_notify(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3338{ 3335{
3339 Eldbus_Message *msg; 3336 Eldbus_Message *msg;
3340 Eldbus_Message_Iter *iter; 3337 Eldbus_Message_Iter *iter;
3338 Ecore_Event_Key *key_event = event;
3341 3339
3342 if (!_init_count) return; 3340 if (!_init_count) return EINA_TRUE;
3343 if ((type != EVAS_CALLBACK_KEY_DOWN) && (type != EVAS_CALLBACK_KEY_UP)) return;
3344 3341
3345 msg = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_DEC, 3342 msg = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_DEC,
3346 ATSPI_DBUS_INTERFACE_DEC, "NotifyListenersSync"); 3343 ATSPI_DBUS_INTERFACE_DEC, "NotifyListenersSync");
3347 iter = eldbus_message_iter_get(msg); 3344 iter = eldbus_message_iter_get(msg);
3348 _iter_marshall_key_event(iter, type, event); 3345 _iter_marshall_key_down_event(iter, key_event);
3349 3346
3350 eldbus_connection_send(_a11y_bus, msg, NULL, NULL, -1); 3347 eldbus_connection_send(_a11y_bus, msg, NULL, NULL, -1);
3348
3349 return EINA_TRUE;
3351} 3350}
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index d76843d51..c9994df29 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -348,7 +348,6 @@ Eo *_elm_atspi_root_get(void);
348 348
349void _elm_atspi_bridge_init(void); 349void _elm_atspi_bridge_init(void);
350void _elm_atspi_bridge_shutdown(void); 350void _elm_atspi_bridge_shutdown(void);
351void _elm_atspi_bridge_key_event_notify(Evas_Callback_Type type, void *event);
352 351
353void _elm_prefs_init(void); 352void _elm_prefs_init(void);
354void _elm_prefs_shutdown(void); 353void _elm_prefs_shutdown(void);
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index b039011d6..a57072619 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -615,9 +615,6 @@ _propagate_event(void *data,
615 default: 615 default:
616 break; 616 break;
617 } 617 }
618 if (_elm_config->atspi_mode)
619 _elm_atspi_bridge_key_event_notify(type, event_info);
620
621 618
622 elm_widget_event_propagate(obj, type, event_info, event_flags); 619 elm_widget_event_propagate(obj, type, event_info, event_flags);
623} 620}