Dear Elementary developers.

I've made a patch about elm_cnp_helper.
It's contains two things.

First is remove pastedimages variable (unused variable)
Other thing is about determine type.
When a user is trying to paste data, elm_cnp_helper call
notify_handler_targets.
In notify_handler_targets, it enumerates atoms and figure out matching
types.
Atom types are sorted by rich types to simple types.
So if a user's trying to paste simple text type, it will match uri type.
Because uri type also can be a text type. 
However in uri type handling functions, there are no fallback to text type.
This patch makes if pasting data is just text, do not pass it as a uri.

Thank you.

----------------------------------
Hyoyoung CHANG
Engineer

SAMSUNG ELECTRONICS, Co., Ltd.
E-mail: hyoyoung.ch...@samsung.com
----------------------------------
Index: elm_cnp_helper.c
===================================================================
--- elm_cnp_helper.c    (리비전 60340)
+++ elm_cnp_helper.c    (작업 사본)
@@ -378,8 +378,6 @@
 /* FIXME: who left this out of XAtoms.h */
 static Ecore_X_Atom clipboard_atom;
 
-static Eina_List *pastedimages = NULL;
-
 /**
  * Drag & Drop functions
  */
@@ -632,6 +630,30 @@
 
    return EINA_TRUE;
 }
+
+static Eina_Bool
+is_uri_type_data(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify)
+{
+   Ecore_X_Selection_Data *data;
+   Ecore_X_Selection_Data_Files *files;
+   Paste_Image *pi;
+   char *p;
+
+   data = notify->data;
+   cnp_debug("data->format is %d %p %p\n", data->format, notify, data);
+   if (data->content == ECORE_X_SELECTION_CONTENT_FILES) return EINA_TRUE;
+   else p = (char *)data->data;
+
+   if (!p) return EINA_TRUE;
+   cnp_debug("Got %s\n", p);
+   if (strncmp(p, "file://", 7))
+     {
+        if (*p != '/') return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
+
 /*
  * Callback to handle a targets response on a selection request:
  * So pick the format we'd like; and then request it.
@@ -655,6 +677,11 @@
           {
              if ((atoms[j].atom == atomlist[i]) && (atoms[j].notify))
                {
+                  if ((j == CNP_ATOM_text_uri) ||
+                      (j == CNP_ATOM_text_urilist))
+                    {
+                      if(!is_uri_type_data(sel, notify)) continue;
+                    }
                   cnp_debug("Atom %s matches\n",atoms[j].name);
                   goto done;
                }
@@ -1029,7 +1056,6 @@
 
    len = strlen(tagstring)+strlen(pi->file);
 
-   pastedimages = eina_list_append(pastedimages, pi);
    entrytag = alloca(len + 1);
    snprintf(entrytag, len + 1, tagstring, pi->file);
    elm_entry_entry_insert(entry, entrytag);
@@ -1253,7 +1279,6 @@
                   int len;
                   ddata.format = ELM_SEL_FORMAT_MARKUP;
 
-                  pastedimages = eina_list_append(pastedimages, savedtypes.pi);
                   len = strlen(tagstring) + strlen(savedtypes.pi->file);
                   entrytag = alloca(len + 1);
                   snprintf(entrytag, len + 1, tagstring, savedtypes.pi->file);
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to