jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=d904e9761e417ec945e0d401735f769aaa19a480

commit d904e9761e417ec945e0d401735f769aaa19a480
Author: Daniel Zaoui <daniel.za...@samsung.com>
Date:   Tue Jun 23 17:58:48 2015 +0300

    CnP: improve loss callback
    
    - Reset loss cb after invocation as it is no more needed
    - When selection is set, previous owner loss cb is invoked only
    if the new owner and the previous one are different.
---
 src/lib/elm_cnp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index e20fbb1..0bee00a 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -706,9 +706,10 @@ _x11_selection_clear(void *udata EINA_UNUSED, int type 
EINA_UNUSED, void *event)
                                          _x11_sel_obj_del2, sel);
    sel->widget = NULL;
    sel->requestwidget = NULL;
+   sel->loss_cb = NULL;
+   sel->loss_data = NULL;
 
    sel->active = EINA_FALSE;
-   sel->widget = NULL;
    ELM_SAFE_FREE(sel->selbuf, free);
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -1852,7 +1853,7 @@ _x11_elm_cnp_selection_set(Ecore_X_Window xwin, 
Evas_Object *obj, Elm_Sel_Type s
      return elm_object_cnp_selection_clear(obj, selection);
 
    sel = _x11_selections + selection;
-   if (sel->loss_cb) sel->loss_cb(sel->loss_data, selection);
+   if (sel->widget != obj && sel->loss_cb) sel->loss_cb(sel->loss_data, 
selection);
    if (sel->widget)
      evas_object_event_callback_del_full(sel->widget, EVAS_CALLBACK_DEL,
                                          _x11_sel_obj_del, sel);

-- 


Reply via email to