raster pushed a commit to branch master.

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

commit 601856ede71c1d98197933695e2d04128b915ec5
Author: Thiep Ha <thie...@gmail.com>
Date:   Tue Feb 18 15:47:07 2014 +0900

    [DnD] Fix bug of hard-coded type when drag
    
    Summary:
    When we start dragging, the type is always set to "text/uri-list" no matter 
the format type set by application.
    This patch fixs this hard-coded type issue. It will set types corresponding 
to the format type set by application.
    For example, if application set format as ELM_SEL_FORMAT_TEXT, it will set 
types UTF8_STRING, STRING, COMPOUND_TEXT, TEXT,
    text/plain, text/plain;charset=utf-8.
    
    Reviewers: JackDanielZ, raster
    
    Reviewed By: raster
    
    CC: woohyun, seoz
    
    Differential Revision: https://phab.enlightenment.org/D546
---
 src/lib/elm_cnp.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index f488003..a6a1148 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -2024,6 +2024,7 @@ _x11_elm_drag_start(Evas_Object *obj, Elm_Sel_Format 
format, const char *data,
    Evas_Object *icon = NULL;
    int w = 0, h = 0;
    Ecore_X_Atom actx;
+   int i;
 
    _x11_elm_cnp_init();
 
@@ -2035,7 +2036,24 @@ _x11_elm_drag_start(Evas_Object *obj, Elm_Sel_Format 
format, const char *data,
         return EINA_FALSE;
      }
 
-   ecore_x_dnd_type_set(xwin, "text/uri-list", EINA_TRUE);
+   ecore_x_dnd_types_set(xwin, NULL, 0);
+   for (i = 0; i < CNP_N_ATOMS; i++)
+     {
+        if (_x11_atoms[i].formats == ELM_SEL_FORMAT_TARGETS)
+          {
+             if (format == ELM_SEL_FORMAT_TARGETS)
+               {
+                  ecore_x_dnd_type_set(xwin, _x11_atoms[i].name, EINA_TRUE);
+                  cnp_debug("set dnd type: %s\n", _x11_atoms[i].name);
+               }
+          }
+        else if (_x11_atoms[i].formats & format)
+          {
+             ecore_x_dnd_type_set(xwin, _x11_atoms[i].name, EINA_TRUE);
+             cnp_debug("set dnd type: %s\n", _x11_atoms[i].name);
+          }
+     }
+
    sel = _x11_selections + ELM_SEL_TYPE_XDND;
    sel->active = EINA_TRUE;
    sel->widget = obj;

-- 


Reply via email to