From: Hyoyoung Chang <hyoyoung@gmail.com>
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 28 Feb 2012 06:17:22 +0000 (06:17 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 28 Feb 2012 06:17:22 +0000 (06:17 +0000)
Subject: [E-devel] [patch] elm_cnp - revise apis
Date: Tue, 28 Feb 2012 15:11:12 +0900

Dear all.

I made a small patch about revise cnp apis.
It changed argument orders of apis to consistence and make elm widget centric.
now all cnp api's first argument is a elm widget.
It breaks api compatibility. so elementarychanges is needed to update.

thanks.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68491 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_cnp.c
src/lib/elm_cnp.c
src/lib/elm_cnp.h
src/lib/elm_entry.c

index af23ca1..0a22001 100644 (file)
@@ -13,7 +13,7 @@ _bt_copy_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU
    const char *txt = elm_object_text_get(en);
 
    elm_object_text_set(glb, txt);
-   elm_cnp_selection_set(ELM_SEL_TYPE_CLIPBOARD, elm_object_parent_widget_get(en),
+   elm_cnp_selection_set(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD,
                          ELM_SEL_FORMAT_TEXT, txt, strlen(txt));
 }
 
@@ -22,8 +22,8 @@ _bt_paste_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UN
 {
    Evas_Object *en = (Evas_Object*)(data);
 
-   elm_cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
-                         en, NULL, NULL);
+   elm_cnp_selection_get(en, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
+                         NULL, NULL);
 }
 
 static void
index ea06156..50f3921 100644 (file)
@@ -390,7 +390,7 @@ elm_selection_selection_has_owner(void)
 }
 
 EAPI Eina_Bool
-elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
+elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
                       Elm_Sel_Format format, const void *selbuf, size_t buflen)
 {
 #ifdef HAVE_ELEMENTARY_X
@@ -463,8 +463,8 @@ elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection)
 }
 
 EAPI Eina_Bool
-elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format,
-                      Evas_Object *obj, Elm_Drop_Cb datacb, void *udata)
+elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection,
+                      Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata)
 {
 #ifdef HAVE_ELEMENTARY_X
    Evas_Object *top;
index 57afefc..3c469e6 100644 (file)
@@ -113,12 +113,9 @@ typedef Eina_Bool (*Elm_Drop_Cb)(void *data, Evas_Object *obj, Elm_Selection_Dat
  * @ingroup CopyPaste
  *
  */
-// XXX: EAPI void elm_object_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
-//                                             Elm_Sel_Format format, const void *buf,
-//                                             size_t buflen);
-EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
-                                     Elm_Sel_Format format, const void *buf,
-                                     size_t buflen);
+EAPI Eina_Bool elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
+                                     Elm_Sel_Format format,
+                                     const void *buf, size_t buflen);
 
 /**
  * @brief Retrieve data from a widget that has a selection.
@@ -142,15 +139,10 @@ EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
  */
 // XXX: This api needs to be refined by cnp experts.
 //      I suggest:
-//         1. return copy and paste data.
-//         2. call cnp callback regardless of widget type.
-//         3. apps insert text data into entry manually.
-// XXX: EAPI void *elm_object_cnp_selection_get(Evas_Object *obj,
-//                                              Elm_Sel_Type selection,
-//                                              Elm_Sel_Format format,
-//                                              Elm_Cnp_Cb datacb);
-EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection,
-                                     Elm_Sel_Format format, Evas_Object *obj,
+//         1. call cnp callback regardless of widget type.
+//         2. apps insert text data into entry manually.
+EAPI Eina_Bool elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection,
+                                     Elm_Sel_Format format,
                                      Elm_Drop_Cb datacb, void *udata);
 
 /**
@@ -167,8 +159,8 @@ EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection,
  * @ingroup CopyPaste
  *
  */
-EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj, 
-                                               Elm_Sel_Type selection);
+EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj,
+                                              Elm_Sel_Type selection);
 
 /**
  * @}
index d32fc54..ef65416 100644 (file)
@@ -1182,7 +1182,7 @@ _paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
         formats = ELM_SEL_FORMAT_MARKUP;
         if (!wd->textonly)
           formats |= ELM_SEL_FORMAT_IMAGE;
-        elm_cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, formats, data, NULL, NULL);
+        elm_cnp_selection_get(data, ELM_SEL_TYPE_CLIPBOARD, formats, NULL, NULL);
 #endif
      }
 }
@@ -1196,7 +1196,7 @@ _store_selection(Elm_Sel_Type seltype, Evas_Object *obj)
    if (!wd) return;
    sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
    if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */
-   elm_cnp_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel));
+   elm_cnp_selection_set(obj, seltype, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel));
    if (seltype == ELM_SEL_TYPE_CLIPBOARD)
      eina_stringshare_replace(&wd->cut_sel, sel);
 }
@@ -1588,7 +1588,7 @@ _signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emi
 
         top = elm_widget_top_get(data);
         if (txt && top && (elm_win_xwindow_get(top)))
-          elm_cnp_selection_set(ELM_SEL_TYPE_PRIMARY, data,
+          elm_cnp_selection_set(data, ELM_SEL_TYPE_PRIMARY,
                                 ELM_SEL_FORMAT_MARKUP, txt, strlen(txt));
      }
 #endif
@@ -1637,7 +1637,7 @@ _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *e
 
              top = elm_widget_top_get(data);
              if ((top) && (elm_win_xwindow_get(top)))
-               elm_cnp_selection_set(ELM_SEL_TYPE_PRIMARY, data,
+               elm_cnp_selection_set(data, ELM_SEL_TYPE_PRIMARY,
                                      ELM_SEL_FORMAT_MARKUP, wd->cut_sel,
                                      strlen(wd->cut_sel));
 #endif
@@ -1674,7 +1674,7 @@ _signal_entry_paste_request(void *data, Evas_Object *obj __UNUSED__, const char
         if ((top) && (elm_win_xwindow_get(top)))
           {
              wd->selection_asked = EINA_TRUE;
-             elm_cnp_selection_get(type, ELM_SEL_FORMAT_MARKUP, data,
+             elm_cnp_selection_get(data, type, ELM_SEL_FORMAT_MARKUP,
                                NULL, NULL);
           }
 #endif