raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b8be1271716f85595d1ff12c5eeeedd733601f9b

commit b8be1271716f85595d1ff12c5eeeedd733601f9b
Author: Carsten Haitzler <ras...@rasterman.com>
Date:   Sat Jun 26 21:40:10 2021 +0100

    ecore evas - cnp - look for exact mime matches before conversions
    
    fixes chrome -> efl copy and paste.
    
    @fix
---
 src/modules/ecore_evas/engines/x/ecore_evas_x.c | 28 ++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c 
b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index c75af6368f..369c9cda5c 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -3788,27 +3788,45 @@ _search_fitting_type(Ecore_Evas *ee, 
Ecore_Evas_Engine_Data_X11 *edata, Ecore_Ev
 
    
EINA_SAFETY_ON_NULL_RETURN(edata->selection_data[selection].acceptable_type);
 
+   // first pass - try find an EXACT mime type match
    for (unsigned int i = 0; i < eina_array_count(arr) && !found_conversion; 
++i)
      {
         const char *x11_name = eina_array_data_get(arr, i);
+
         mime_type = _decrypt_type(x11_name);
 
         for (unsigned int j = 0; j < 
eina_array_count(edata->selection_data[selection].acceptable_type) && 
!found_conversion; ++j)
           {
-             const char *acceptable_type = (const char*) 
eina_array_data_get(edata->selection_data[selection].acceptable_type, j);
+             const char *acceptable_type = (const char 
*)eina_array_data_get(edata->selection_data[selection].acceptable_type, j);
 
              if (mime_type == acceptable_type)
-               HANDLE_TYPE()
+               {
+                  HANDLE_TYPE()
+               }
+          }
+        eina_stringshare_del(mime_type);
+     }
+   // second pass - exact match not found - look for conversions instead
+   if (!found_conversion)
+     {
+        for (unsigned int i = 0; i < eina_array_count(arr) && 
!found_conversion; ++i)
+          {
+             const char *x11_name = eina_array_data_get(arr, i);
+
+             mime_type = _decrypt_type(x11_name);
 
-             //if there is no available type yet, check if we can convert to 
the desired type via this type
-             if (!found_conversion)
+             for (unsigned int j = 0; j < 
eina_array_count(edata->selection_data[selection].acceptable_type) && 
!found_conversion; ++j)
                {
+                  const char *acceptable_type = (const char 
*)eina_array_data_get(edata->selection_data[selection].acceptable_type, j);
                   const char *convertion_type = NULL;
+
                   Eina_Iterator *iter = 
eina_content_converter_possible_conversions(mime_type);
                   EINA_ITERATOR_FOREACH(iter, convertion_type)
                     {
                        if (convertion_type == acceptable_type)
-                         HANDLE_TYPE()
+                         {
+                            HANDLE_TYPE()
+                         }
                     }
                   eina_iterator_free(iter);
                }

-- 


Reply via email to