efl_selection: reintroduce missing ELM_CNP_EVENT_SELECTION_CHANGED symbol.
authorAlastair Poole <netstar@gmail.com>
Mon, 30 Jul 2018 15:42:28 +0000 (11:42 -0400)
committerSangHyeon Jade Lee <sh10233.lee@samsung.com>
Wed, 1 Aug 2018 04:27:56 +0000 (13:27 +0900)
Summary:
During the 1.21 development cycle the symbol ELM_CNP_EVENT_SELECTION_CHANGED was lost.

The commit which introduced this:  e88bbaa1e314751e5c1a04dec7f1f179188428ae

This patch re-introduced the symbol and expected behaviour.

Reviewers: #committers, zmike, bu5hm4n, herb

Reviewed By: #committers, zmike

Subscribers: herb, ManMower, segfaultxavi, stefan_schmidt, cedric, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6689

src/lib/elementary/efl_selection_manager.c
src/lib/elementary/elm_main.c

index ebb95ed..8556039 100644 (file)
@@ -45,6 +45,8 @@ static Ecore_Wl2_Input *_wl_seat_get(Ecore_Wl2_Window *win, Evas_Object *obj, un
 static void _set_selection_list(Sel_Manager_Selection *sel_list, Sel_Manager_Seat_Selection *seat_sel);
 #endif
 
+EAPI int ELM_CNP_EVENT_SELECTION_CHANGED = -1;
+
 /* TIZEN_ONLY(20180430): fix duplicated string memory issue */
 static Eina_Rw_Slice
 _eina_slice_dup_safe(Eina_Slice slice)
@@ -858,6 +860,7 @@ _x11_fixes_selection_notify(void *data, int t EINA_UNUSED, void *event)
 {
    Efl_Selection_Manager_Data *pd = data;
    Efl_Selection_Changed e;
+   Elm_Cnp_Event_Selection_Changed *_e;
    Ecore_X_Event_Fixes_Selection_Notify *ev = event;
    Sel_Manager_Seat_Selection *seat_sel;
    Efl_Selection_Type type;
@@ -883,8 +886,15 @@ _x11_fixes_selection_notify(void *data, int t EINA_UNUSED, void *event)
    e.type = type;
    e.seat = 1; /* under x11 this is always the default seat */
    e.exist = !!ev->owner;
+
+   _e = calloc(1, sizeof(Elm_Cnp_Event_Selection_Changed));
+   EINA_SAFETY_ON_NULL_RETURN_VAL(_e, ECORE_CALLBACK_RENEW);
+   _e->type = type;
+   _e->seat_id = 1;
+   _e->exists = e.exist;
+
+   ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, _e, NULL, NULL);
    efl_event_callback_call(sel->owner, EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
-   //ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, e, NULL, NULL);
 
    return ECORE_CALLBACK_RENEW;
 }
@@ -2628,16 +2638,19 @@ _wl_efl_sel_manager_selection_set(Efl_Selection_Manager_Data *pd,
    return _update_sel_lost_list(owner, type, seat_sel);
 }
 
-/*static void
-_wl_selection_changed_free(void *data, void *ev EINA_UNUSED)
+static void
+_wl_selection_changed_free(void *data, void *ev)
 {
    ecore_wl2_display_disconnect(data);
-}*/
+
+   free(ev);
+}
 
 static Eina_Bool
 _wl_selection_changed(void *data, int type EINA_UNUSED, void *event)
 {
    Efl_Selection_Manager_Data *pd = data;
+   Elm_Cnp_Event_Selection_Changed *_e;
    Sel_Manager_Seat_Selection *seat_sel;
    Sel_Manager_Selection *sel;
    Efl_Selection_Changed e;
@@ -2656,7 +2669,15 @@ _wl_selection_changed(void *data, int type EINA_UNUSED, void *event)
    /* connect again to add ref */
    e.display = ecore_wl2_display_connect(ecore_wl2_display_name_get(ev->display));
    e.exist = !!ecore_wl2_dnd_selection_get(seat);
-   //ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, e, _wl_selection_changed_free, ev->display);
+
+   _e = calloc(1, sizeof(Elm_Cnp_Event_Selection_Changed));
+   EINA_SAFETY_ON_NULL_RETURN_VAL(_e, ECORE_CALLBACK_RENEW);
+   _e->type = e.type;
+   _e->seat_id = e.seat;
+   _e->display = e.display;
+   _e->exists = e.exist;
+
+   ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, _e, _wl_selection_changed_free, ev->display);
    efl_event_callback_call(sel->request_obj, EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
 
    return ECORE_CALLBACK_RENEW;
index 58969a3..097679a 100644 (file)
@@ -423,6 +423,10 @@ elm_init(int argc, char **argv)
    _accessibility_currently_highlighted_obj = NULL;
    //
 
+   ELM_CNP_EVENT_SELECTION_CHANGED = ecore_event_type_new();
+
+   if (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF)
+     _elm_atspi_bridge_init();
    if (!_elm_config->web_backend)
      _elm_config->web_backend = eina_stringshare_add("none");
    if (!_elm_web_init(_elm_config->web_backend))