summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2015-06-09 09:20:24 +0900
committerThiep Ha <thiepha@gmail.com>2015-06-09 09:20:24 +0900
commit679a4213b554da98778417ad4a8fe2c9538dbd66 (patch)
treeac750dd55b8d2b5eb20e413cb163e89318c68002
parent0d284ea9ebd08b0517c9a0c211ce490eee7d2b16 (diff)
downloadelementary-devs/thiep/dnd.tar.gz
Cnp/Wl: remove entry-only codedevs/thiep/dnd
This patch removes the entry-only code which is used to paste text to entry widget only. The function now is hanlded inside entry.
-rw-r--r--src/lib/elm_cnp.c56
-rw-r--r--src/lib/elm_entry.c72
-rw-r--r--src/lib/elm_priv.h3
3 files changed, 3 insertions, 128 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 55bec4287..6dd18acf1 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -200,7 +200,6 @@ static Eina_Bool _local_elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format fo
static Ecore_X_Window _x11_elm_widget_xwin_get(const Evas_Object *obj);
static Tmp_Info *_tempfile_new (int size);
static int _tmpinfo_free (Tmp_Info *tmp);
-static Eina_Bool _pasteimage_append (char *file, Evas_Object *entry);
typedef struct _X11_Cnp_Selection X11_Cnp_Selection;
@@ -3013,15 +3012,7 @@ _wl_notify_handler_uri(Wl_Cnp_Selection *sel, Ecore_Wl_Event_Selection_Data_Read
ddata.action = sel->action;
sel->datacb(sel->udata, sel->requestwidget, &ddata);
}
- else
- {
- char *mkupstr;
-
- mkupstr = _elm_util_text_to_mkup((const char *)stripstr);
- /* TODO BUG: should never NEVER assume it's an elm_entry! */
- _elm_entry_entry_paste(sel->requestwidget, mkupstr);
- free(mkupstr);
- }
+ else cnp_debug("Paste request\n");
return 0;
}
@@ -3129,17 +3120,7 @@ _wl_notify_handler_image(Wl_Cnp_Selection *sel, Ecore_Wl_Event_Selection_Data_Re
ddata.action = sel->action;
sel->datacb(sel->udata, sel->requestwidget, &ddata);
}
- else
- {
- cnp_debug("no datacb\n");
- tmp = _tempfile_new(ev->len);
- if (!tmp) return 0;
- memcpy(tmp->map, ev->data, ev->len);
- munmap(tmp->map, ev->len);
- /* FIXME: Add to paste image data to clean up */
- _pasteimage_append(tmp->filename, sel->requestwidget);
- _tmpinfo_free(tmp);
- }
+ else cnp_debug("Paste request\n");
return 0;
}
@@ -3188,21 +3169,7 @@ _wl_notify_handler_text(Wl_Cnp_Selection *sel, Ecore_Wl_Event_Selection_Data_Rea
ddata.action = sel->action;
sel->datacb(sel->udata, sel->requestwidget, &ddata);
}
- else
- {
- cnp_debug("no datacb\n");
- char *stripstr, *mkupstr;
-
- stripstr = malloc(ev->len + 1);
- if (!stripstr) return 0;
- strncpy(stripstr, (char *)ev->data, ev->len);
- stripstr[ev->len] = '\0';
- mkupstr = _elm_util_text_to_mkup((const char *)stripstr);
- /* TODO BUG: should never NEVER assume it's an elm_entry! */
- _elm_entry_entry_paste(sel->requestwidget, mkupstr);
- free(stripstr);
- free(mkupstr);
- }
+ else cnp_debug("Paste request\n");
return 0;
}
@@ -4611,23 +4578,6 @@ _tmpinfo_free(Tmp_Info *info)
return 0;
}
-static Eina_Bool
-_pasteimage_append(char *file, Evas_Object *entry)
-{
- char *entrytag;
- int len;
- /* TODO BUG: shouldn't define absize=240x180. Prefer data:// instead of href:// -- may need support for evas. See http://dataurl.net/ */
- static const char *tagstring = "<item absize=240x180 href=file://%s></item>";
-
- if ((!file) || (!entry)) return EINA_FALSE;
- len = strlen(tagstring)+strlen(file);
- entrytag = alloca(len + 1);
- snprintf(entrytag, len + 1, tagstring, file);
- /* TODO BUG: should never NEVER assume it's an elm_entry! */
- _elm_entry_entry_paste(entry, entrytag);
- return EINA_TRUE;
-}
-
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 44f430c4d..96752d9b3 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -1295,78 +1295,6 @@ _hover_selected_cb(void *data,
elm_widget_scroll_hold_push(data);
}
-static char *
-_item_tags_remove(const char *str)
-{
- char *ret;
- Eina_Strbuf *buf;
-
- if (!str)
- return NULL;
-
- buf = eina_strbuf_new();
- if (!buf)
- return NULL;
-
- if (!eina_strbuf_append(buf, str))
- {
- eina_strbuf_free(buf);
- return NULL;
- }
-
- while (EINA_TRUE)
- {
- const char *temp = eina_strbuf_string_get(buf);
- char *start_tag = NULL;
- char *end_tag = NULL;
- size_t sindex;
- size_t eindex;
-
- start_tag = strstr(temp, "<item");
- if (!start_tag)
- start_tag = strstr(temp, "</item");
- if (start_tag)
- end_tag = strstr(start_tag, ">");
- else
- break;
- if (!end_tag || start_tag > end_tag)
- break;
-
- sindex = start_tag - temp;
- eindex = end_tag - temp + 1;
- if (!eina_strbuf_remove(buf, sindex, eindex))
- break;
- }
-
- ret = eina_strbuf_string_steal(buf);
- eina_strbuf_free(buf);
-
- return ret;
-}
-
-void
-_elm_entry_entry_paste(Evas_Object *obj,
- const char *entry)
-{
- char *str = NULL;
-
- ELM_ENTRY_CHECK(obj);
- ELM_ENTRY_DATA_GET(obj, sd);
-
- if (sd->cnp_mode == ELM_CNP_MODE_NO_IMAGE)
- {
- str = _item_tags_remove(entry);
- if (!str) str = strdup(entry);
- }
- else
- str = strdup(entry);
- if (!str) str = (char *)entry;
-
- edje_object_part_text_user_insert(sd->entry_edje, "elm.text", str);
-
- if (str != entry) free(str);
-}
-
static void
_paste_cb(void *data,
Evas_Object *obj EINA_UNUSED,
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 9e7bc42ba..cd3746eda 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -572,9 +572,6 @@ _elm_dgettext(const char *string)
#endif
-/* Used by the paste handler */
-void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
-
double _elm_atof(const char *s);
#endif