diff options
author | Thiep Ha <thiepha@gmail.com> | 2015-04-30 14:43:59 +0900 |
---|---|---|
committer | Thiep Ha <thiepha@gmail.com> | 2015-06-02 21:50:24 +0900 |
commit | 9508eac0cd0bc5326e5f9f44494ebdd2ddf738a3 (patch) | |
tree | 365955d571ff979e235b3b2746cb5ab1870691e0 | |
parent | 7a119ad957e8adb1a715fd024169039cd80119a8 (diff) | |
download | elementary-9508eac0cd0bc5326e5f9f44494ebdd2ddf738a3.tar.gz |
DnD/Wl: Entry should handle image drop
When image is dropped into entry, we should insert image to the entry.
This patch checks drop format and inserts image to entry if needed.
Test case: Run elementary_test with wayland, Types Dnd, drag image and
drop it to right entry.
-rw-r--r-- | src/lib/elm_entry.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 5ab7fd1c7..e810afd1c 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -654,7 +654,24 @@ _drag_drop_cb(void *data EINA_UNUSED, } memcpy(buf, drop->data, drop->len); buf[drop->len] = '\0'; - elm_entry_entry_insert(obj, buf); + + if (drop->format & ELM_SEL_FORMAT_IMAGE) + { + char *entry_tag; + int len; + static const char *tag_string = + "<item absize=240x180 href=file://%s></item>"; + + len = strlen(tag_string) + strlen(buf); + entry_tag = alloca(len + 1); + snprintf(entry_tag, len + 1, tag_string, buf); + elm_entry_entry_insert(obj, entry_tag); + } + else + { + elm_entry_entry_insert(obj, buf); + } + free(buf); edje_object_part_text_cursor_copy (sd->entry_edje, "elm.text", EDJE_CURSOR_USER, /*->*/ EDJE_CURSOR_MAIN); |