ecore_cocoa: move MARKUP outside of ecore_cocoa
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Sat, 18 Aug 2018 08:36:55 +0000 (10:36 +0200)
committerWoochanlee <wc0917.lee@samsung.com>
Thu, 23 Aug 2018 06:44:17 +0000 (15:44 +0900)
the elementary MARKUP stuff requires ecore_cocoa to be linked to evas to
find the function. However, ecore_XXXXX things should stay unrelated to
evas in most cases. Thus this was not a good idea and created a circular
dependency, this is fixed now.

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

configure.ac
src/lib/ecore_cocoa/ecore_cocoa_cnp.m
src/lib/elementary/efl_selection_manager.c

index 69dc344..bdcb85f 100755 (executable)
@@ -3635,8 +3635,6 @@ EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [ecore])
 EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [eo])
 EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [efl])
 EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [eina])
-EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [evas])
-EFL_INTERNAL_DEPEND_PKG([ECORE_COCOA], [emile])
 
 ### Checks for header files
 
index 03dcb22..de9163f 100644 (file)
@@ -3,7 +3,6 @@
 #endif
 
 #include <Eina.h>
-#include <Evas.h>
 #import <Cocoa/Cocoa.h>
 #import "ecore_cocoa_window.h"
 #include "ecore_cocoa_private.h"
@@ -29,16 +28,9 @@ ecore_cocoa_clipboard_set(const void           *data,
      }
    if (type & ECORE_COCOA_CNP_TYPE_MARKUP)
      {
-        char *utf8;
-
-        utf8 = evas_textblock_text_markup_to_utf8(NULL, (const char *)data);
-        str = [[NSString alloc] initWithBytes: utf8
-                                       length: strlen(utf8) // XXX strlen() ?
-                                     encoding: NSUTF8StringEncoding];
-        free(utf8);
-        if (str)
-          [objects addObject: str];
+         WRN("Markup CNP: NOT IMPLEMENTED");
      }
+
    if (type & ECORE_COCOA_CNP_TYPE_IMAGE)
      {
          WRN("Image CNP: NOT IMPLEMENTED");
@@ -79,8 +71,7 @@ ecore_cocoa_clipboard_get(int                  *size,
 
    classes = [[NSMutableArray alloc] init];
 
-   if ((type & ECORE_COCOA_CNP_TYPE_STRING) ||
-       (type & ECORE_COCOA_CNP_TYPE_MARKUP))
+   if (type & ECORE_COCOA_CNP_TYPE_STRING)
      {
         string_class = YES;
         [classes addObject: [NSString class]];
index 05f9ce2..9263e61 100644 (file)
@@ -3920,8 +3920,6 @@ _sel_format_to_ecore_cocoa_cnp_type(Efl_Selection_Format fmt)
    if ((fmt & EFL_SELECTION_FORMAT_TEXT) ||
        (fmt & EFL_SELECTION_FORMAT_VCARD))
      type |= ECORE_COCOA_CNP_TYPE_STRING;
-   if (fmt & EFL_SELECTION_FORMAT_MARKUP)
-     type |= ECORE_COCOA_CNP_TYPE_MARKUP;
    if (fmt & EFL_SELECTION_FORMAT_HTML)
      type |= ECORE_COCOA_CNP_TYPE_HTML;
    if (fmt & EFL_SELECTION_FORMAT_IMAGE)
@@ -3975,8 +3973,6 @@ _job_pb_cb(void *data)
         ddata.format = EFL_SELECTION_FORMAT_NONE;
         if (get_type & ECORE_COCOA_CNP_TYPE_STRING)
           ddata.format |= EFL_SELECTION_FORMAT_TEXT;
-        if (get_type & ECORE_COCOA_CNP_TYPE_MARKUP)
-          ddata.format |= EFL_SELECTION_FORMAT_MARKUP;
         if (get_type & ECORE_COCOA_CNP_TYPE_IMAGE)
           ddata.format |= EFL_SELECTION_FORMAT_IMAGE;
         if (get_type & ECORE_COCOA_CNP_TYPE_HTML)
@@ -4037,11 +4033,20 @@ _cocoa_efl_sel_manager_selection_set(Efl_Selection_Manager_Data *pd,
    evas_object_event_callback_add(sel->owner, EVAS_CALLBACK_DEL,
                                   _cocoa_sel_obj_del_cb, sel);
    ELM_SAFE_FREE(sel->data.mem, free);
-   /* TIZEN_ONLY(20180430): fix duplicated string memory issue
-   sel->data = eina_slice_dup(data);
-    */
-   sel->data = _eina_slice_dup_safe(data);
-   /* END */
+
+   if (format == EFL_SELECTION_FORMAT_MARKUP)
+     {
+        //FIXME this code assumes that sel->data.mem has a \0 at the end
+        sel->data.mem = evas_textblock_text_markup_to_utf8(NULL, data.mem);
+        sel->data.len = strlen(sel->data.mem);
+        //set the new text
+        format = EFL_SELECTION_FORMAT_TEXT;
+    }
+   else
+    {
+       sel->data = eina_slice_dup(data);
+    }
+
    if (sel->data.mem)
      {
         ecore_type = _sel_format_to_ecore_cocoa_cnp_type(format);