[TC-editifield, entry] fix fails
[framework/uifw/elementary.git] / src / lib / elm_entry.c
index 75b22f6..0e114ea 100644 (file)
@@ -1,6 +1,7 @@
 #include <Elementary.h>
 #include <Elementary_Cursor.h>
 #include "elm_priv.h"
+#include "elm_module_priv.h"
 
 /**
  * @defgroup Entry Entry
@@ -110,11 +111,20 @@ typedef struct _Elm_Entry_Text_Filter Elm_Entry_Text_Filter;
 struct _Widget_Data
 {
    Evas_Object *ent, *scroller, *end, *icon;
+   Evas_Object *bg;
    Evas_Object *hoversel;
+   Evas_Object *hover;
+   Evas_Object *layout;
+   Evas_Object *list;
+   Evas_Object *mgf_proxy;
+   Evas_Object *mgf_clip;
+   Evas_Object *mgf_bg;
+   Evas_Coord mgf_height;
+   float mgf_scale;
+   int mgf_type;
    Ecore_Job *deferred_recalc_job;
    Ecore_Event_Handler *sel_notify_handler;
    Ecore_Event_Handler *sel_clear_handler;
-   Ecore_Timer *longpress_timer;
    Ecore_Timer *delay_write;
    /* for deferred appending */
    Ecore_Idler *append_text_idler;
@@ -124,18 +134,25 @@ struct _Widget_Data
    /* Only for clipboard */
    const char *cut_sel;
    const char *text;
+   const char *password_text;
+   Evas_Coord wrap_w;
    const char *file;
    Elm_Text_Format format;
    Evas_Coord lastw, entmw, entmh;
    Evas_Coord downx, downy;
+   Evas_Coord cx, cy, cw, ch;
    Eina_List *items;
    Eina_List *item_providers;
    Eina_List *text_filters;
+   Eina_List *match_list;
+   Ecore_Job *matchlist_job;
+   int matchlist_threshold;
    Ecore_Job *hovdeljob;
    Mod_Api *api; // module api if supplied
    int cursor_pos;
    Elm_Scroller_Policy policy_h, policy_v;
    Elm_Wrap_Type linewrap;
+   Elm_Input_Panel_Layout input_panel_layout;
    Eina_Bool changed : 1;
    Eina_Bool single_line : 1;
    Eina_Bool password : 1;
@@ -146,13 +163,22 @@ struct _Widget_Data
    Eina_Bool deferred_cur : 1;
    Eina_Bool cur_changed : 1;
    Eina_Bool disabled : 1;
+   Eina_Bool double_clicked : 1;
+   Eina_Bool long_pressed : 1;
    Eina_Bool context_menu : 1;
    Eina_Bool drag_selection_asked : 1;
+   Eina_Bool bgcolor : 1;
    Eina_Bool can_write : 1;
    Eina_Bool autosave : 1;
    Eina_Bool textonly : 1;
    Eina_Bool usedown : 1;
    Eina_Bool scroll : 1;
+   Eina_Bool autoreturnkey : 1;
+   Eina_Bool input_panel_enable : 1;
+   Eina_Bool autocapital : 1;
+   Eina_Bool autoperiod : 1;
+   Eina_Bool matchlist_list_clicked : 1;
+   Eina_Bool matchlist_case_sensitive : 1;
 };
 
 struct _Elm_Entry_Context_Menu_Item
@@ -186,6 +212,9 @@ typedef enum _Length_Unit
 } Length_Unit;
 
 static const char *widtype = NULL;
+// start for cbhm
+static Evas_Object *cnpwidgetdata = NULL;
+// end for cbhm
 
 #ifdef HAVE_ELEMENTARY_X
 static Eina_Bool _drag_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *);
@@ -200,13 +229,24 @@ static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static const char *_getbase(Evas_Object *obj);
 static void _signal_entry_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _signal_selection_start(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _signal_selection_end(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _signal_selection_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _signal_selection_cleared(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _signal_handler_move_start(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _signal_handler_move_end(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _signal_handler_moving(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _signal_entry_paste_request(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _signal_entry_copy_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _signal_entry_cut_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _signal_cursor_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit);
+static int _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int deleteflag);
+static int _stringshare_key_value_replace(const char **srcstring, char *key, const char *value, int deleteflag);
+static int _entry_length_get(Evas_Object *obj);
+static void _magnifier_create(void *data);
+static void _magnifier_show(void *data);
+static void _magnifier_hide(void *data);
+static void _magnifier_move(void *data);
 
 static const char SIG_CHANGED[] = "changed";
 static const char SIG_ACTIVATED[] = "activated";
@@ -224,28 +264,38 @@ static const char SIG_SELECTION_CHANGED[] = "selection,changed";
 static const char SIG_SELECTION_CLEARED[] = "selection,cleared";
 static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
 static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
+static const char SIG_MATCHLIST_CLICKED[] = "matchlist,clicked";
 static const char SIG_PREEDIT_CHANGED[] = "preedit,changed";
 static const Evas_Smart_Cb_Description _signals[] = {
-       {SIG_CHANGED, ""},
-       {SIG_ACTIVATED, ""},
-       {SIG_PRESS, ""},
-       {SIG_LONGPRESSED, ""},
-       {SIG_CLICKED, ""},
-       {SIG_CLICKED_DOUBLE, ""},
-       {SIG_FOCUSED, ""},
-       {SIG_UNFOCUSED, ""},
-       {SIG_SELECTION_PASTE, ""},
-       {SIG_SELECTION_COPY, ""},
-       {SIG_SELECTION_CUT, ""},
-       {SIG_SELECTION_START, ""},
-       {SIG_SELECTION_CHANGED, ""},
-       {SIG_SELECTION_CLEARED, ""},
-       {SIG_CURSOR_CHANGED, ""},
-       {SIG_ANCHOR_CLICKED, ""},
-       {SIG_PREEDIT_CHANGED, ""},
-       {NULL, NULL}
+  {SIG_CHANGED, ""},
+  {SIG_ACTIVATED, ""},
+  {SIG_PRESS, ""},
+  {SIG_LONGPRESSED, ""},
+  {SIG_CLICKED, ""},
+  {SIG_CLICKED_DOUBLE, ""},
+  {SIG_FOCUSED, ""},
+  {SIG_UNFOCUSED, ""},
+  {SIG_SELECTION_PASTE, ""},
+  {SIG_SELECTION_COPY, ""},
+  {SIG_SELECTION_CUT, ""},
+  {SIG_SELECTION_START, ""},
+  {SIG_SELECTION_CHANGED, ""},
+  {SIG_SELECTION_CLEARED, ""},
+  {SIG_CURSOR_CHANGED, ""},
+  {SIG_ANCHOR_CLICKED, ""},
+  {SIG_PREEDIT_CHANGED, ""},
+  {SIG_MATCHLIST_CLICKED, ""},
+  {NULL, NULL}
 };
 
+typedef enum _Elm_Entry_Magnifier_Type
+{
+   _ENTRY_MAGNIFIER_FIXEDSIZE = 0,
+   _ENTRY_MAGNIFIER_FILLWIDTH,
+   _ENTRY_MAGNIFIER_CIRCULAR,
+} Elm_Entry_Magnifier_Type;
+
+
 static Eina_List *entries = NULL;
 
 struct _Mod_Api
@@ -253,6 +303,8 @@ struct _Mod_Api
    void (*obj_hook) (Evas_Object *obj);
    void (*obj_unhook) (Evas_Object *obj);
    void (*obj_longpress) (Evas_Object *obj);
+   void (*obj_hidemenu) (Evas_Object *obj);
+   void (*obj_mouseup) (Evas_Object *obj);
 };
 
 static Mod_Api *
@@ -270,6 +322,10 @@ _module(Evas_Object *obj __UNUSED__)
       _elm_module_symbol_get(m, "obj_unhook");
    ((Mod_Api *)(m->api)      )->obj_longpress = // called on long press menu
       _elm_module_symbol_get(m, "obj_longpress");
+   ((Mod_Api *)(m->api)      )->obj_hidemenu = // called on hide menu
+      _elm_module_symbol_get(m, "obj_hidemenu");
+   ((Mod_Api *)(m->api)      )->obj_mouseup = // called on mouseup
+      _elm_module_symbol_get(m, "obj_mouseup");
 ok: // ok - return api
    return m->api;
 }
@@ -533,6 +589,8 @@ _del_hook(Evas_Object *obj)
 #endif
    if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
    if (wd->text) eina_stringshare_del(wd->text);
+   if (wd->password_text) eina_stringshare_del(wd->password_text);
+   if (wd->bg) evas_object_del(wd->bg);
    if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
    if (wd->append_text_idler)
      {
@@ -541,7 +599,11 @@ _del_hook(Evas_Object *obj)
         wd->append_text_left = NULL;
         wd->append_text_idler = NULL;
      }
-   if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
+   if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
+   if (wd->mgf_proxy) evas_object_del(wd->mgf_proxy);
+   if (wd->mgf_bg) evas_object_del(wd->mgf_bg);
+   if (wd->mgf_clip) evas_object_del(wd->mgf_clip);
+
    EINA_LIST_FREE(wd->items, it)
      {
         eina_stringshare_del(it->label);
@@ -572,6 +634,7 @@ _theme_hook(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    const char *t;
+   Ecore_IMF_Context *ic;
    _elm_widget_mirrored_reload(obj);
    _mirrored_set(obj, elm_widget_mirrored_get(obj));
 
@@ -583,6 +646,7 @@ _theme_hook(Evas_Object *obj)
    eina_stringshare_del(t);
    if (elm_widget_disabled_get(obj))
      edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
+   edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable);
    elm_entry_cursor_pos_set(obj, wd->cursor_pos);
    if (elm_widget_focus_get(obj))
      edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
@@ -595,7 +659,7 @@ _theme_hook(Evas_Object *obj)
      {
         const char *str;
         Evas_Object *edj;
-        
+
         edj = elm_smart_scroller_edje_object_get(wd->scroller);
         str = edje_object_data_get(edj, "focus_highlight");
         if ((str) && (!strcmp(str, "on")))
@@ -603,6 +667,24 @@ _theme_hook(Evas_Object *obj)
         else
            elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
      }
+
+   if (wd->password)
+     {
+        edje_object_part_text_autoperiod_set(wd->ent, "elm.text", EINA_FALSE);
+        edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", EINA_FALSE);
+     }
+   else
+     {
+        edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
+        edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
+     }
+
+   ic = edje_object_part_text_imf_context_get(wd->ent, "elm.text");
+   if (ic)
+     {
+        ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)wd->input_panel_layout);
+     }
+
    _sizing_eval(obj);
 }
 
@@ -629,6 +711,7 @@ _recalc_cursor_geometry(Evas_Object *obj)
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
    evas_object_smart_callback_call(obj, SIG_CURSOR_CHANGED, NULL);
+   if (!elm_object_focus_get(obj)) return;
    if (!wd->deferred_recalc_job)
      {
         Evas_Coord cx, cy, cw, ch;
@@ -636,7 +719,7 @@ _recalc_cursor_geometry(Evas_Object *obj)
               &cx, &cy, &cw, &ch);
         if (wd->cur_changed)
           {
-             elm_widget_show_region_set(obj, cx, cy, cw, ch);
+             elm_widget_show_region_set(obj, cx, cy, cw, ch, EINA_FALSE);
              wd->cur_changed = EINA_FALSE;
           }
      }
@@ -648,7 +731,7 @@ static void
 _elm_win_recalc_job(void *data)
 {
    Widget_Data *wd = elm_widget_data_get(data);
-   Evas_Coord minh = -1, resw = -1, minw = -1;
+   Evas_Coord minh = -1, resw = -1, minw = -1, fw = 0, fh = 0;
    if (!wd) return;
    wd->deferred_recalc_job = NULL;
 
@@ -666,20 +749,48 @@ _elm_win_recalc_job(void *data)
         evas_object_size_hint_min_get(data, &ominw, NULL);
         minw = ominw;
      }
-   evas_object_size_hint_min_set(data, minw, minh);
-   if (wd->single_line)
-      evas_object_size_hint_max_set(data, -1, minh);
+
+   elm_coords_finger_size_adjust(1, &fw, 1, &fh);
+   if (wd->scroll)
+     {
+        Evas_Coord vmw = 0, vmh = 0;
+
+        edje_object_size_min_calc
+           (elm_smart_scroller_edje_object_get(wd->scroller),
+               &vmw, &vmh);
+        if (wd->single_line)
+          {
+             evas_object_size_hint_min_set(data, vmw, minh + vmh);
+             evas_object_size_hint_max_set(data, -1, minh + vmh);
+          }
+        else
+          {
+             evas_object_size_hint_min_set(data, vmw, vmh);
+             evas_object_size_hint_max_set(data, -1, -1);
+          }
+     }
    else
-      evas_object_size_hint_max_set(data, -1, -1);
+     {
+        if (wd->single_line)
+          {
+             evas_object_size_hint_min_set(data, minw, minh);
+             evas_object_size_hint_max_set(data, -1, minh);
+          }
+        else
+          {
+             evas_object_size_hint_min_set(data, fw, minh);
+             evas_object_size_hint_max_set(data, -1, -1);
+          }
+     }
 
-   if (wd->deferred_cur)
+   if ((wd->deferred_cur) && (elm_object_focus_get(data)))
      {
         Evas_Coord cx, cy, cw, ch;
         edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
                                                   &cx, &cy, &cw, &ch);
         if (wd->cur_changed)
           {
-             elm_widget_show_region_set(data, cx, cy, cw, ch);
+             elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
              wd->cur_changed = EINA_FALSE;
           }
      }
@@ -712,13 +823,14 @@ _sizing_eval(Evas_Object *obj)
              wd->entmw = minw;
              wd->entmh = minh;
              elm_coords_finger_size_adjust(1, &minw, 1, &minh);
-             
+
              if ((minw > 0) && (vw < minw)) vw = minw;
              if (minh > vh) vh = minh;
 
              if (wd->single_line) h = vmh + minh;
              else h = vmh;
              evas_object_resize(wd->ent, vw, vh);
+             evas_object_size_hint_min_get(obj, &w, NULL);
              evas_object_size_hint_min_set(obj, w, h);
              if (wd->single_line)
                 evas_object_size_hint_max_set(obj, -1, h);
@@ -739,12 +851,12 @@ _sizing_eval(Evas_Object *obj)
         if (wd->scroll)
           {
              Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
-             
+
              edje_object_size_min_calc(wd->ent, &minw, &minh);
              wd->entmw = minw;
              wd->entmh = minh;
              elm_coords_finger_size_adjust(1, &minw, 1, &minh);
-             
+
              elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh);
 
              if ((minw > 0) && (vw < minw)) vw = minw;
@@ -756,6 +868,7 @@ _sizing_eval(Evas_Object *obj)
                     &vmw, &vmh);
              if (wd->single_line) h = vmh + minh;
              else h = vmh;
+             evas_object_size_hint_min_get(obj, &w, NULL);
              evas_object_size_hint_min_set(obj, w, h);
              if (wd->single_line)
                 evas_object_size_hint_max_set(obj, -1, h);
@@ -780,25 +893,54 @@ _sizing_eval(Evas_Object *obj)
 }
 
 static void
+_check_enable_returnkey(Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
+   if (!ic) return;
+
+   if (!wd->autoreturnkey) return;
+
+   if (_entry_length_get(obj) == 0)
+     {
+        ecore_imf_context_input_panel_key_disabled_set(ic, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, ECORE_IMF_INPUT_PANEL_KEY_ENTER, EINA_TRUE);
+     }
+   else
+     {
+        ecore_imf_context_input_panel_key_disabled_set(ic, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, ECORE_IMF_INPUT_PANEL_KEY_ENTER, EINA_FALSE);
+     }
+}
+
+static void
 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    Evas_Object *top = elm_widget_top_get(obj);
    if (!wd) return;
-   if (!wd->editable) return;
    if (elm_widget_focus_get(obj))
      {
+        printf("[Elm_entry::Focused] obj : %p\n", obj);
         evas_object_focus_set(wd->ent, EINA_TRUE);
         edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
         if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
         evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
+        _check_enable_returnkey(obj);
+        wd->mgf_type = _ENTRY_MAGNIFIER_FIXEDSIZE;
      }
    else
      {
+        printf("[Elm_entry::Unfocused] obj : %p\n", obj);
         edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm");
         evas_object_focus_set(wd->ent, EINA_FALSE);
         if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
         evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
+
+        if ((wd->api) && (wd->api->obj_hidemenu))
+          {
+             wd->api->obj_hidemenu(obj);
+          }
      }
 }
 
@@ -858,7 +1000,7 @@ _show_region_hook(void *data, Evas_Object *obj)
    if (!wd) return;
    elm_widget_show_region_get(obj, &x, &y, &w, &h);
    if (wd->scroll)
-      elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
+     elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
 }
 
 static void
@@ -909,7 +1051,7 @@ _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event
 {
    Widget_Data *wd = elm_widget_data_get(data);
    if (!wd) return;
-   
+
    if (wd->linewrap)
      {
         _sizing_eval(data);
@@ -917,7 +1059,7 @@ _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event
    else if (wd->scroll)
      {
         Evas_Coord vw = 0, vh = 0;
-        
+
         elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh);
         if (vw < wd->entmw) vw = wd->entmw;
         if (vh < wd->entmh) vh = wd->entmh;
@@ -961,6 +1103,18 @@ _dismissed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 }
 
 static void
+_selectall(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+   wd->selmode = EINA_TRUE;
+   edje_object_part_text_select_none(wd->ent, "elm.text");
+   edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
+   edje_object_part_text_select_all(wd->ent, "elm.text");
+   elm_object_scroll_freeze_pop(data);
+}
+
+static void
 _select(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
@@ -974,7 +1128,8 @@ _select(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
      }
    edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
    if (!_elm_config->desktop_entry)
-     elm_widget_scroll_hold_push(data);
+      elm_object_scroll_freeze_pop(data);
+      //elm_widget_scroll_hold_push(data);
 }
 
 static void
@@ -1001,12 +1156,47 @@ _store_selection(Elm_Sel_Type seltype, Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    const char *sel;
+   char *sel_str;
 
    if (!wd) return;
    sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
-   elm_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel);
+   sel_str = strdup(sel);
+   if (!sel_str)
+     return;
+   if (wd->textonly)
+     {
+        while (EINA_TRUE)
+          {
+             char *startTag = NULL;
+             char *endTag = NULL;
+
+             startTag = strstr(sel_str, "<item");
+             if (!startTag)
+               startTag = strstr(sel_str, "</item");
+             if (startTag)
+               endTag = strstr(startTag, ">");
+             else
+               break;
+             if (!endTag || startTag > endTag)
+               break;
+
+             size_t sindex = startTag - sel_str;
+             size_t eindex = endTag - sel_str + 1;
+
+             Eina_Strbuf *buf = eina_strbuf_new();
+             if (buf)
+               {
+                  eina_strbuf_append(buf, sel_str);
+                  eina_strbuf_remove(buf, sindex, eindex);
+                  sel_str = eina_strbuf_string_steal(buf);
+                  eina_strbuf_free(buf);
+               }
+          }
+     }
+   elm_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel_str);
    if (seltype == ELM_SEL_CLIPBOARD)
-     eina_stringshare_replace(&wd->cut_sel, sel);
+     eina_stringshare_replace(&wd->cut_sel, sel_str);
+   free(sel_str);
 }
 
 static void
@@ -1031,15 +1221,13 @@ _copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
    if (!wd) return;
-   wd->selmode = EINA_FALSE;
+   wd->selmode = EINA_TRUE;
    if (!_elm_config->desktop_entry)
      {
-        edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
         edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
         elm_widget_scroll_hold_pop(data);
      }
    _store_selection(ELM_SEL_CLIPBOARD, data);
-   //   edje_object_part_text_select_none(wd->ent, "elm.text");
 }
 
 static void
@@ -1057,6 +1245,36 @@ _cancel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 }
 
 static void
+_clipboard_menu(void *data, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   // start for cbhm
+#ifdef HAVE_ELEMENTARY_X
+   ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
+#endif
+   cnpwidgetdata = data;
+   elm_cbhm_helper_init(obj);
+   if (elm_entry_cnp_textonly_get(obj))
+     elm_cbhm_send_raw_data("show0");
+   else
+     elm_cbhm_send_raw_data("show1");
+   // end for cbhm
+}
+
+// start for cbhm
+static void
+_cnpinit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+   cnpwidgetdata = data;
+}
+// end for cbhm
+
+
+static void
 _item_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Elm_Entry_Context_Menu_Item *it = data;
@@ -1090,11 +1308,28 @@ _menu_press(Evas_Object *obj)
           elm_hoversel_horizontal_set(wd->hoversel, EINA_TRUE);
         elm_object_style_set(wd->hoversel, "entry");
         elm_widget_sub_object_add(obj, wd->hoversel);
-        elm_hoversel_label_set(wd->hoversel, "Text");
+        elm_object_text_set(wd->hoversel, "Text");
         top = elm_widget_top_get(obj);
         if (top) elm_hoversel_hover_parent_set(wd->hoversel, top);
         evas_object_smart_callback_add(wd->hoversel, "dismissed", _dismissed, obj);
-        if (wd->have_selection)
+        if (!wd->selmode)
+          {
+             if (!wd->password)
+               elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
+                                     _select, obj);
+             if (1) // need way to detect if someone has a selection
+               {
+                  if (wd->editable)
+                    elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
+                                          _paste, obj);
+               }
+       // start for cbhm
+             if ((!wd->password) && (wd->editable))
+               elm_hoversel_item_add(wd->hoversel, E_("More"), NULL, ELM_ICON_NONE,
+                                     _clipboard_menu, obj);
+       // end for cbhm
+          }
+        else
           {
              if (!wd->password)
                {
@@ -1108,24 +1343,11 @@ _menu_press(Evas_Object *obj)
                     }
                   elm_hoversel_item_add(wd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE,
                                         _cancel, obj);
-               }
-          }
-        else
-          {
-             if (!wd->selmode)
-               {
-                  if (!_elm_config->desktop_entry)
-                    {
-                       if (!wd->password)
-                         elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
-                                               _select, obj);
-                    }
-                  if (1) // need way to detect if someone has a selection
-                    {
-                       if (wd->editable)
-                         elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
-                                               _paste, obj);
-                    }
+       // start for cbhm
+                  if (wd->editable)
+                    elm_hoversel_item_add(wd->hoversel, E_("More"), NULL, ELM_ICON_NONE,
+                                          _clipboard_menu, obj);
+       // end for cbhm
                }
           }
         EINA_LIST_FOREACH(wd->items, l, it)
@@ -1147,13 +1369,158 @@ _menu_press(Evas_Object *obj)
      }
 }
 
+static void
+_magnifier_hide(void *data)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   evas_object_hide(wd->mgf_bg);
+   evas_object_hide(wd->mgf_clip);
+
+   if (wd->scroll)
+     elm_smart_scroller_freeze_set(wd->scroller, EINA_FALSE);
+}
+
+static void
+_magnifier_show(void *data)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   evas_object_show(wd->mgf_bg);
+   evas_object_show(wd->mgf_clip);
+}
+
+static void
+_magnifier_move(void *data)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   Evas_Coord x, y, w, h, fs;
+   Evas_Coord cx, cy, cw, ch, ox, oy;
+
+   edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
+
+   if (wd->scroll)
+     {
+        evas_object_geometry_get(wd->scroller, &x, &y, &w, &h);
+        elm_smart_scroller_child_pos_get(wd->scroller, &ox, &oy);
+        cx -= ox;
+        cy -= oy;
+     }
+   else
+     evas_object_geometry_get(data, &x, &y, &w, &h);
+
+   ox = oy = 0;
+   fs = elm_finger_size_get();
+
+   if ((cy + y) - wd->mgf_height - fs < 0)
+     oy = -1 * ((cy + y) - wd->mgf_height - fs);
+
+   if (wd->mgf_type == _ENTRY_MAGNIFIER_FIXEDSIZE)
+     evas_object_move(wd->mgf_bg, (cx + x + cw/2) + ox, (cy + y) - wd->mgf_height - fs + oy);
+   else if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
+     evas_object_move(wd->mgf_bg, x, (cy + y) - wd->mgf_height - fs + oy);
+   else
+     return;
+
+   evas_object_move(wd->mgf_proxy, (1 - wd->mgf_scale) * cx + x + ox, (1 - wd->mgf_scale) * cy + y - wd->mgf_height/2 - ch/2 - fs + oy);
+}
+
+static void
+_magnifier_create(void *data)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Coord x, y, w, h, mw, mh;
+   const char* key_data = NULL;
+
+   if (!wd) return;
+
+   if (wd->mgf_proxy)
+     {
+        evas_object_image_source_unset(wd->mgf_proxy);
+        evas_object_color_set(wd->mgf_proxy, 255, 255, 255, 0);
+        evas_object_hide(wd->mgf_proxy);
+        evas_object_clip_unset(wd->mgf_proxy);
+        evas_object_del(wd->mgf_proxy);
+     }
+   if (wd->mgf_bg) evas_object_del(wd->mgf_bg);
+   if (wd->mgf_clip) evas_object_del(wd->mgf_clip);
+
+   if (wd->scroll)
+     evas_object_geometry_get(wd->scroller, &x, &y, &w, &h);
+   else
+     evas_object_geometry_get(data, &x, &y, &w, &h);
+
+   if ((w <= 0) || (h <= 0))
+     return;
+
+   wd->mgf_bg = edje_object_add(evas_object_evas_get(data));
+
+   if (wd->mgf_type == _ENTRY_MAGNIFIER_FIXEDSIZE)
+     _elm_theme_object_set(data, wd->mgf_bg, "entry", "magnifier", "fixed-size");
+   else if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
+     _elm_theme_object_set(data, wd->mgf_bg, "entry", "magnifier", "fill-width");
+   else
+     return;
+
+   wd->mgf_clip = evas_object_rectangle_add(evas_object_evas_get(data));
+   evas_object_color_set(wd->mgf_clip, 255, 255, 255, 255);
+   edje_object_part_swallow(wd->mgf_bg, "swallow", wd->mgf_clip);
+
+   key_data = edje_object_data_get(wd->mgf_bg, "height");
+   if (key_data) wd->mgf_height = atoi(key_data);
+   key_data = edje_object_data_get(wd->mgf_bg, "scale");
+   if (key_data) wd->mgf_scale = atof(key_data);
+
+   if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
+     evas_object_resize(wd->mgf_bg, w, wd->mgf_height);
+
+   if (wd->scroll)
+     {
+        elm_smart_scroller_freeze_set(wd->scroller, EINA_TRUE);
+        wd->mgf_proxy = evas_object_image_add(evas_object_evas_get(wd->scroller));
+        evas_object_image_source_set(wd->mgf_proxy, wd->scroller);
+     }
+   else
+     {
+        wd->mgf_proxy = evas_object_image_add(evas_object_evas_get(data));
+        evas_object_image_source_set(wd->mgf_proxy, data);
+     }
+
+   mw = (Evas_Coord)((float)w * wd->mgf_scale);
+   mh = (Evas_Coord)((float)h * wd->mgf_scale);
+   if ((mw <= 0) || (mh <= 0))
+     return;
+
+   evas_object_resize(wd->mgf_proxy, mw, mh);
+   evas_object_image_fill_set(wd->mgf_proxy, 0, 0, mw, mh);
+   evas_object_color_set(wd->mgf_proxy, 255, 255, 255, 255);
+   evas_object_pass_events_set(wd->mgf_proxy, EINA_TRUE);
+   evas_object_show(wd->mgf_proxy);
+   evas_object_clip_set(wd->mgf_proxy, wd->mgf_clip);
+
+   evas_object_layer_set(wd->mgf_bg, EVAS_LAYER_MAX);
+   evas_object_layer_set(wd->mgf_proxy, EVAS_LAYER_MAX);
+}
+
 static Eina_Bool
-_long_press(void *data)
+_signal_long_pressed(void *data)
 {
    Widget_Data *wd = elm_widget_data_get(data);
    if (!wd) return ECORE_CALLBACK_CANCEL;
-   _menu_press(data);
-   wd->longpress_timer = NULL;
+
+   wd->long_pressed = EINA_TRUE;
+
+   _cancel(data, NULL, NULL);
+
+   _magnifier_create(data);
+   _magnifier_move(data);
+   _magnifier_show(data);
+   elm_object_scroll_freeze_push(data);
+
    evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
    return ECORE_CALLBACK_CANCEL;
 }
@@ -1168,11 +1535,7 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
    wd->downx = ev->canvas.x;
    wd->downy = ev->canvas.y;
-   if (ev->button == 1)
-     {
-        if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
-        wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
-     }
+   wd->long_pressed = EINA_FALSE;
 }
 
 static void
@@ -1184,11 +1547,16 @@ _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *
    if (wd->disabled) return;
    if (ev->button == 1)
      {
-        if (wd->longpress_timer)
+        if (!wd->double_clicked)
           {
-             ecore_timer_del(wd->longpress_timer);
-             wd->longpress_timer = NULL;
+             if ((wd->api) && (wd->api->obj_mouseup))
+               wd->api->obj_mouseup(data);
           }
+        _magnifier_hide(data);
+        elm_object_scroll_freeze_pop(data);
+
+        if (wd->long_pressed)
+          _menu_press(data);
      }
    else if (ev->button == 3)
      {
@@ -1204,47 +1572,13 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void
    Evas_Event_Mouse_Move *ev = event_info;
    if (!wd) return;
    if (wd->disabled) return;
-   if (!wd->selmode)
-     {
-        if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
-          {
-             if (wd->longpress_timer)
-               {
-                  ecore_timer_del(wd->longpress_timer);
-                  wd->longpress_timer = NULL;
-               }
-          }
-        else if (wd->longpress_timer)
-          {
-             Evas_Coord dx, dy;
-
-             dx = wd->downx - ev->cur.canvas.x;
-             dx *= dx;
-             dy = wd->downy - ev->cur.canvas.y;
-             dy *= dy;
-             if ((dx + dy) >
-                 ((_elm_config->finger_size / 2) *
-                  (_elm_config->finger_size / 2)))
-               {
-                  ecore_timer_del(wd->longpress_timer);
-                  wd->longpress_timer = NULL;
-               }
-          }
-     }
-   else if (wd->longpress_timer)
-     {
-        Evas_Coord dx, dy;
 
-        dx = wd->downx - ev->cur.canvas.x;
-        dx *= dx;
-        dy = wd->downy - ev->cur.canvas.y;
-        dy *= dy;
-        if ((dx + dy) >
-            ((_elm_config->finger_size / 2) *
-             (_elm_config->finger_size / 2)))
+   if (ev->buttons == 1)
+     {
+        if (wd->long_pressed)
           {
-             ecore_timer_del(wd->longpress_timer);
-             wd->longpress_timer = NULL;
+             _magnifier_show(data);
+             _magnifier_move(data);
           }
      }
 }
@@ -1303,78 +1637,377 @@ _getbase(Evas_Object *obj)
    return "base";
 }
 
-static void
-_entry_changed_common_handling(void *data, const char *event)
-{
-   Widget_Data *wd = elm_widget_data_get(data);
-   Evas_Coord minh;
-   if (!wd) return;
-   wd->changed = EINA_TRUE;
-   /* Reset the size hints which are no more relevant.
-    * Keep the height, this is a hack, but doesn't really matter
-    * cause we'll re-eval in a moment. */
-   evas_object_size_hint_min_get(data, NULL, &minh);
-   evas_object_size_hint_min_set(data, -1, minh);
-   _sizing_eval(data);
-   if (wd->text) eina_stringshare_del(wd->text);
-   wd->text = NULL;
-   evas_object_smart_callback_call(data, event, NULL);
-   if (wd->delay_write)
-     {
-        ecore_timer_del(wd->delay_write);
-        wd->delay_write = NULL;
-     }
-   if ((!wd->autosave) || (!wd->file)) return;
-   wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
-}
 
-static void
-_signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+static int
+_entry_length_get(Evas_Object *obj)
 {
-   _entry_changed_common_handling(data, SIG_CHANGED);
+   int len;
+   const char *str = elm_entry_entry_get(obj);
+   if (!str) return 0;
+
+   char *plain_str = _elm_util_mkup_to_text(str);
+   if (!plain_str) return 0;
+
+   len = strlen(plain_str);
+   free(plain_str);
+
+   return len;
 }
 
-static void
-_signal_preedit_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+#ifndef HAVE_STRCASESTR
+char* _strcasestr(const char *s, const char *find)
 {
-   _entry_changed_common_handling(data, SIG_PREEDIT_CHANGED);
+   char c, sc;
+   size_t len;
+
+   if ((c = *find++) != 0) {
+      c = tolower((unsigned char) c);
+      len = strlen(find);
+      do {
+         do {
+            if( (sc = *s++) == 0)
+               return NULL;
+         } while ((char)tolower((unsigned char)sc) != c);
+      } while (strncasecmp(s, find, len) != 0);
+      s--;
+   }
+   return ((char*) s);
 }
+#endif
 
 static void
-_signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+_matchlist_show(void *data)
 {
    Widget_Data *wd = elm_widget_data_get(data);
-   const Eina_List *l;
-   Evas_Object *entry;
+   const char *text = NULL;
+   int textlen = 0;
+   char *str_list = NULL, *str_result = NULL;
+   char *str_mkup = NULL, *str_front = NULL, *str_mid = NULL;
+
+   Eina_List *l;
+   Eina_Bool textfound = EINA_FALSE;
+
    if (!wd) return;
-   EINA_LIST_FOREACH(entries, l, entry)
+   if (elm_widget_disabled_get(data)) return;
+
+   wd->matchlist_job = NULL;
+
+   if (wd->matchlist_list_clicked)
      {
-        if (entry != data) elm_entry_select_none(entry);
+        evas_object_hide(wd->hover);
+        wd->matchlist_list_clicked = EINA_FALSE;
+        return;
      }
-   wd->have_selection = EINA_TRUE;
-   evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
-#ifdef HAVE_ELEMENTARY_X
-   if (wd->sel_notify_handler)
+   text = elm_entry_entry_get(data);
+   if (text == NULL)
+     return;
+   textlen = strlen(text);
+
+   if (textlen < wd->matchlist_threshold)
      {
-        const char *txt = elm_entry_selection_get(data);
-        Evas_Object *top;
+        evas_object_hide(wd->hover);
+        return;
+     }
 
-        top = elm_widget_top_get(data);
-        if ((top) && (elm_win_xwindow_get(top)))
+   evas_object_hide(wd->hover);
+
+   if (wd->match_list)
+     {
+        elm_list_clear(wd->list);
+        EINA_LIST_FOREACH(wd->match_list, l, str_list)
+          {
+             if (wd->matchlist_case_sensitive)
+               str_result = strstr(str_list, text);
+             else
+#ifdef HAVE_STRCASESTR
+                str_result = strcasestr(str_list, text);
+#else
+                str_result = _strcasestr(str_list, text);
+#endif
+
+             if (str_result)
+               {
+                  str_mkup = malloc(strlen(str_list) + 16);
+                  if (str_mkup == NULL) return;
+
+                  textlen = strlen(str_list) - strlen(str_result);
+                  str_front = malloc(textlen + 1);
+                  if (str_front == NULL) return;
+
+                  memset(str_front, 0, textlen + 1);
+                  strncpy(str_front, str_list, textlen);
+
+                  textlen = strlen(text);
+                  str_mid = malloc(textlen + 1);
+                  if (str_mid == NULL) return;
+
+                  memset(str_mid, 0, textlen + 1);
+                  strncpy(str_mid, str_list + strlen(str_front), textlen);
+
+                  sprintf(str_mkup, "%s<match>%s</match>%s", str_front, str_mid, str_result + strlen(text));
+
+                  elm_list_item_append(wd->list, str_mkup, NULL, NULL, NULL, NULL);
+
+                  if (str_mkup) free(str_mkup);
+                  if (str_front) free(str_front);
+                  if (str_mid) free(str_mid);
+
+                  textfound=EINA_TRUE;
+               }
+          }
+     }
+   else
+     return;
+
+   if (textfound)
+     {
+        elm_list_go(wd->list);
+        evas_object_show(wd->hover);
+        evas_object_raise(wd->hover);
+     }
+}
+
+static void _matchlist_list_clicked( void *data, Evas_Object *obj, void *event_info )
+{
+   Elm_List_Item *it = (Elm_List_Item *) elm_list_selected_item_get(obj);
+   Widget_Data *wd = elm_widget_data_get(data);
+   if ((it == NULL) || (wd == NULL))
+     return;
+
+   const char *text = elm_list_item_label_get(it);
+   evas_object_smart_callback_call((Evas_Object *)data, "selected", (void *)text);
+   if (wd->match_list)
+     {
+        if (text != NULL)
+          {
+             elm_entry_entry_set(data, elm_entry_markup_to_utf8(text));
+             elm_entry_cursor_end_set(data);
+             wd->matchlist_list_clicked = EINA_TRUE;
+
+             evas_object_smart_callback_call(data, SIG_MATCHLIST_CLICKED, elm_entry_markup_to_utf8(text));
+          }
+     }
+   elm_widget_focus_set(data, EINA_TRUE);
+}
+
+static void
+_entry_changed_common_handling(void *data, const char *event)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Coord minw, minh;
+   if (!wd) return;
+   wd->changed = EINA_TRUE;
+   /* Reset the size hints which are no more relevant.
+    * Keep the height, this is a hack, but doesn't really matter
+    * cause we'll re-eval in a moment. */
+   if (wd->scroll)
+     {
+        evas_object_size_hint_min_get(data, &minw, &minh);
+        evas_object_size_hint_min_set(data, minw, minh);
+     }
+   else
+     {
+        evas_object_size_hint_min_get(data, NULL, &minh);
+        evas_object_size_hint_min_set(data, -1, minh);
+     }
+
+   _sizing_eval(data);
+   if (wd->text) eina_stringshare_del(wd->text);
+   wd->text = NULL;
+   if (wd->password_text) eina_stringshare_del(wd->password_text);
+   wd->password_text = NULL;
+   _check_enable_returnkey(data);
+   evas_object_smart_callback_call(data, event, NULL);
+   if (wd->delay_write)
+     {
+        ecore_timer_del(wd->delay_write);
+        wd->delay_write = NULL;
+     }
+
+   if ((wd->single_line) && (wd->match_list))
+     {
+        if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
+        wd->matchlist_job = ecore_job_add(_matchlist_show, data);
+     }
+   if ((!wd->autosave) || (!wd->file)) return;
+   wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
+}
+
+static void
+_signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   _entry_changed_common_handling(data, SIG_CHANGED);
+
+   if ((wd->api) && (wd->api->obj_hidemenu))
+     wd->api->obj_hidemenu(data);
+}
+
+static void
+_signal_preedit_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   _entry_changed_common_handling(data, SIG_PREEDIT_CHANGED);
+
+   if ((wd->api) && (wd->api->obj_hidemenu))
+     wd->api->obj_hidemenu(data);
+}
+
+static void
+_signal_handler_move_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   elm_object_scroll_freeze_push(data);
+
+   if ((wd->api) && (wd->api->obj_hidemenu))
+     wd->api->obj_hidemenu(data);
+
+   _magnifier_create(data);
+   _magnifier_move(data);
+   _magnifier_show(data);
+}
+
+static void
+_signal_handler_move_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   elm_object_scroll_freeze_pop(data);
+
+   if (wd->have_selection)
+     {
+        _magnifier_hide(data);
+        _menu_press(data);
+     }
+}
+
+static void
+_signal_handler_moving(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   _magnifier_move(data);
+   _magnifier_show(data);
+}
+
+static Evas_Object *
+_viewport_obj_get(Evas_Object *data)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return NULL;
+
+   if(!data || !strlen(elm_widget_type_get(data)))
+     return NULL;
+
+   Evas_Coord x, y, w, h;
+   x = y = w = h = -1;
+
+   if (wd->scroll)
+     {
+        //evas_object_geometry_get(wd->scroller, &x, &y, &w, &h);
+        //printf(">>> wd->scroller (%d, %d, %d, %d) \n", x, y, w, h);
+        return wd->scroller;
+     }
+
+   Evas_Object *parent_obj = data;
+
+   while(parent_obj = elm_widget_parent_get(parent_obj))
+     {
+        //evas_object_geometry_get(parent_obj, &x, &y, &w, &h);
+        //printf(">>> %s (%d, %d, %d, %d) \n", elm_widget_type_get(parent_obj), x, y, w, h);
+        if (!strcmp(elm_widget_type_get(parent_obj), "scroller") ||
+            !strcmp(elm_widget_type_get(parent_obj), "genlist"))
+          return parent_obj;
+     }
+
+   return NULL;
+}
+
+static void
+_signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   _magnifier_hide(data);
+   _menu_press(data);
+}
+
+static void
+_signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   const Eina_List *l;
+   Evas_Object *entry;
+   if (!wd) return;
+   EINA_LIST_FOREACH(entries, l, entry)
+     {
+        if (entry != data) elm_entry_select_none(entry);
+     }
+   wd->have_selection = EINA_TRUE;
+   wd->selmode = EINA_TRUE;
+   evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
+#ifdef HAVE_ELEMENTARY_X
+   if (wd->sel_notify_handler)
+     {
+        const char *txt = elm_entry_selection_get(data);
+        Evas_Object *top;
+
+        top = elm_widget_top_get(data);
+        if ((top) && (elm_win_xwindow_get(top)))
           elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
      }
 #endif
+
+   if (!_elm_config->desktop_entry)
+     edje_object_part_text_viewport_object_set(wd->ent, "elm.text", _viewport_obj_get(data));
+}
+
+static void
+_signal_magnifier_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   Evas_Coord cx, cy, cw, ch;
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
+   if (!wd->deferred_recalc_job)
+     elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
+   else
+     {
+        wd->deferred_cur = EINA_TRUE;
+        wd->cx = cx;
+        wd->cy = cy;
+        wd->cw = cw;
+        wd->ch = ch + elm_finger_size_get();
+     }
 }
 
 static void
 _signal_selection_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
 {
+   Evas_Coord cx, cy, cw, ch;
    Widget_Data *wd = elm_widget_data_get(data);
    if (!wd) return;
    wd->have_selection = EINA_TRUE;
+   wd->selmode = EINA_TRUE;
    evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
    elm_selection_set(ELM_SEL_PRIMARY, obj, ELM_SEL_FORMAT_MARKUP,
                      elm_entry_selection_get(data));
+
+   edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
+   if (!wd->deferred_recalc_job)
+     elm_widget_show_region_set(data, cx, cy, cw, ch + elm_finger_size_get(), EINA_FALSE);
+   else
+     {
+        wd->deferred_cur = EINA_TRUE;
+        wd->cx = cx;
+        wd->cy = cy;
+        wd->cw = cw;
+        wd->ch = ch + elm_finger_size_get();
+     }
 }
 
 static void
@@ -1384,6 +2017,7 @@ _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *e
    if (!wd) return;
    if (!wd->have_selection) return;
    wd->have_selection = EINA_FALSE;
+   wd->selmode = EINA_FALSE;
    evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
    if (wd->sel_notify_handler)
      {
@@ -1411,6 +2045,11 @@ _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *e
 #endif
           }
      }
+
+   if ((wd->api) && (wd->api->obj_hidemenu))
+     {
+        wd->api->obj_hidemenu(data);
+     }
 }
 
 static void
@@ -1570,7 +2209,11 @@ _signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission
 {
    Widget_Data *wd = elm_widget_data_get(data);
    if (!wd) return;
+   wd->double_clicked = EINA_FALSE;
    evas_object_smart_callback_call(data, SIG_PRESS, NULL);
+
+   if ((wd->api) && (wd->api->obj_hidemenu))
+     wd->api->obj_hidemenu(data);
 }
 
 static void
@@ -1579,6 +2222,9 @@ _signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emiss
    Widget_Data *wd = elm_widget_data_get(data);
    if (!wd) return;
    evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
+
+   if (!_elm_config->desktop_entry && !wd->double_clicked)
+     _cancel(data, NULL, NULL);
 }
 
 static void
@@ -1586,6 +2232,7 @@ _signal_mouse_double(void *data, Evas_Object *obj __UNUSED__, const char *emissi
 {
    Widget_Data *wd = elm_widget_data_get(data);
    if (!wd) return;
+   wd->double_clicked = EINA_TRUE;
    evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
 }
 
@@ -1650,6 +2297,7 @@ _event_selection_notify(void *data, int type __UNUSED__, void *event)
 static Eina_Bool
 _event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
 {
+/*
    Widget_Data *wd = elm_widget_data_get(data);
    Ecore_X_Event_Selection_Clear *ev = event;
    if (!wd) return ECORE_CALLBACK_PASS_ON;
@@ -1659,6 +2307,26 @@ _event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event _
      {
         elm_entry_select_none(data);
      }
+   return 1; */
+
+   // start for cbhm
+   Evas_Object *top = elm_widget_top_get(data);
+   Ecore_X_Event_Selection_Clear *ev = event;
+
+   if (!top)
+      return ECORE_CALLBACK_PASS_ON;
+
+   if (ev->selection != ECORE_X_SELECTION_SECONDARY)
+     {
+        return ECORE_CALLBACK_PASS_ON;
+     }
+
+   if (cnpwidgetdata == data)
+     {
+        elm_selection_get(ELM_SEL_SECONDARY,ELM_SEL_FORMAT_MARKUP,data,NULL,NULL);
+     }
+
+   // end for cbhm
    return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -1722,6 +2390,115 @@ _get_item(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__,
    return o;
 }
 
+static int
+_strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int deleteflag)
+{
+   const char *srcstring = NULL;
+   Eina_Strbuf *repbuf = NULL, *diffbuf = NULL;
+   char *curlocater, *replocater;
+   char *starttag, *endtag;
+   int tagtxtlen = 0, insertflag = 0;
+
+   srcstring = eina_strbuf_string_get(srcbuf);
+   curlocater = strstr(srcstring, key);
+
+   if (!curlocater || !srcstring)
+     {
+       insertflag = 1;
+     }
+   else
+     {
+       do
+         {
+           starttag = strchr(srcstring, '<');
+           endtag = strchr(srcstring, '>');
+           tagtxtlen = endtag - starttag;
+           if (tagtxtlen <= 0) tagtxtlen = 0;
+           if (starttag < curlocater && curlocater < endtag) break;
+           if (endtag != NULL && endtag+1 != NULL)
+             srcstring = endtag+1;
+           else
+             break;
+         } while (strlen(srcstring) > 1);
+
+       if (starttag && endtag && tagtxtlen > strlen(key))
+         {
+           repbuf = eina_strbuf_new();
+           diffbuf = eina_strbuf_new();
+           eina_strbuf_append_n(repbuf, starttag, tagtxtlen);
+           srcstring = eina_strbuf_string_get(repbuf);
+           curlocater = strstr(srcstring, key);
+
+           if (curlocater != NULL)
+             {
+               replocater = curlocater + strlen(key) + 1;
+
+               while ((*replocater) && (*replocater != ' ') && (*replocater != '>'))
+                 replocater++;
+
+               if (replocater-curlocater > strlen(key)+1)
+                 {
+                   eina_strbuf_append_n(diffbuf, curlocater, replocater-curlocater+1);
+                 }
+               else
+                 insertflag = 1;
+             }
+           else
+             {
+               insertflag = 1;
+             }
+           eina_strbuf_reset(repbuf);
+         }
+       else
+         {
+           insertflag = 1;
+         }
+     }
+
+   if (repbuf == NULL) repbuf = eina_strbuf_new();
+   if (diffbuf == NULL) diffbuf = eina_strbuf_new();
+
+   if (insertflag)
+     {
+       eina_strbuf_append_printf(repbuf, "<%s=%s>", key, value);
+       eina_strbuf_prepend(srcbuf, eina_strbuf_string_get(repbuf));
+     }
+   else
+     {
+        if (deleteflag)
+          {
+            eina_strbuf_prepend(diffbuf, "<");
+            eina_strbuf_append(diffbuf, ">");
+            eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), "");
+          }
+        else
+          {
+            eina_strbuf_append_printf(repbuf, "%s=%s", key, value);
+            eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), eina_strbuf_string_get(repbuf));
+          }
+     }
+
+   if (repbuf) eina_strbuf_free(repbuf);
+   if (diffbuf) eina_strbuf_free(diffbuf);
+
+   return 0;
+}
+
+static int
+_stringshare_key_value_replace(const char **srcstring, char *key, const char *value, int deleteflag)
+{
+   Eina_Strbuf *sharebuf = NULL;
+
+   sharebuf = eina_strbuf_new();
+   eina_strbuf_append(sharebuf, *srcstring);
+   _strbuf_key_value_replace(sharebuf, key, value, deleteflag);
+   eina_stringshare_del(*srcstring);
+   *srcstring = eina_stringshare_add(eina_strbuf_string_get(sharebuf));
+   eina_strbuf_free(sharebuf);
+
+   return 0;
+}
+
 static void
 _text_filter(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, Edje_Text_Filter_Type type, char **text)
 {
@@ -1750,16 +2527,51 @@ _text_append_idler(void *data)
    Widget_Data *wd = elm_widget_data_get(obj);
    if (wd->text) eina_stringshare_del(wd->text);
    wd->text = NULL;
+   if (wd->password_text) eina_stringshare_del(wd->password_text);
+   wd->password_text = NULL;
    wd->changed = EINA_TRUE;
 
    start = wd->append_text_position;
-   if(start + _CHUNK_SIZE < wd->append_text_len)
+   if (start + _CHUNK_SIZE < wd->append_text_len)
      {
-        wd->append_text_position = (start + _CHUNK_SIZE);
-        /* Go to the start of the nearest codepoint, because we don't want
-         * to cut it in the middle */
-        eina_unicode_utf8_get_prev(wd->append_text_left,
-              &wd->append_text_position);
+        int pos = start;
+        int tag_start, esc_start;
+
+        tag_start = esc_start = -1;
+        /* Find proper markup cut place */
+        while (pos - start < _CHUNK_SIZE)
+          {
+             int prev_pos = pos;
+             Eina_Unicode tmp =
+                eina_unicode_utf8_get_next(wd->append_text_left, &pos);
+             if (esc_start == -1)
+               {
+                  if (tmp == '<')
+                     tag_start = prev_pos;
+                  else if (tmp == '>')
+                     tag_start = -1;
+               }
+             else if (tag_start == -1)
+               {
+                  if (tmp == '&')
+                     esc_start = prev_pos;
+                  else if (tmp == ';')
+                     esc_start = -1;
+               }
+          }
+
+        if (tag_start >= 0)
+          {
+             wd->append_text_position = tag_start;
+          }
+        else if (esc_start >= 0)
+          {
+             wd->append_text_position = esc_start;
+          }
+        else
+          {
+             wd->append_text_position = pos;
+          }
      }
    else
      {
@@ -1856,6 +2668,90 @@ _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit un
    evas_object_smart_callback_call(obj, "maxlength,reached", NULL);
 }
 
+static void
+_elm_entry_text_set(Evas_Object *obj, const char *item, const char *entry)
+{
+   int len = 0;
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   if (item && strcmp(item, "default")) return;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (!entry) entry = "";
+   if (wd->text) eina_stringshare_del(wd->text);
+   wd->text = NULL;
+   if (wd->password_text) eina_stringshare_del(wd->password_text);
+   wd->password_text = NULL;
+   wd->changed = EINA_TRUE;
+
+   /* Clear currently pending job if there is one */
+   if (wd->append_text_idler)
+     {
+        ecore_idler_del(wd->append_text_idler);
+        free(wd->append_text_left);
+        wd->append_text_left = NULL;
+        wd->append_text_idler = NULL;
+     }
+
+   len = strlen(entry);
+   /* Split to ~_CHUNK_SIZE chunks */
+   if (len > _CHUNK_SIZE)
+     {
+        wd->append_text_left = (char *) malloc(len + 1);
+     }
+
+   /* If we decided to use the idler */
+   if (wd->append_text_left)
+     {
+        /* Need to clear the entry first */
+        edje_object_part_text_set(wd->ent, "elm.text", "");
+        memcpy(wd->append_text_left, entry, len + 1);
+        wd->append_text_position = 0;
+        wd->append_text_len = len;
+        wd->append_text_idler = ecore_idler_add(_text_append_idler, obj);
+     }
+   else
+     {
+        edje_object_part_text_set(wd->ent, "elm.text", entry);
+     }
+}
+
+static const char *
+_elm_entry_text_get(const Evas_Object *obj, const char *item)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (item && strcmp(item, "default")) return NULL;
+   const char *text;
+   if (!wd) return NULL;
+   if (wd->password)
+     {
+        if(wd->password_text) return wd->password_text;
+     }
+   else if (wd->text) 
+     {
+        return wd->text;
+     }
+   text = edje_object_part_text_get(wd->ent, "elm.text");
+   if (!text)
+     {
+        ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
+        return NULL;
+     }
+   eina_stringshare_replace(&wd->text, text);
+   if (wd->password)
+     {
+        const char *pw_text;
+        pw_text = elm_entry_markup_to_utf8(wd->text);
+        if (pw_text)
+          {
+             eina_stringshare_replace(&wd->password_text, pw_text);
+             free(pw_text);
+             return wd->password_text;
+          }
+     }
+   return wd->text;
+}
+
 /**
  * This adds an entry to @p parent object.
  *
@@ -1890,7 +2786,9 @@ elm_entry_add(Evas_Object *parent)
    elm_object_cursor_set(obj, ELM_CURSOR_XTERM);
    elm_widget_can_focus_set(obj, EINA_TRUE);
    elm_widget_highlight_ignore_set(obj, EINA_TRUE);
-   
+   elm_widget_text_set_hook_set(obj, _elm_entry_text_set);
+   elm_widget_text_get_hook_set(obj, _elm_entry_text_get);
+
    wd->scroller = elm_smart_scroller_add(e);
    elm_widget_sub_object_add(obj, wd->scroller);
    elm_smart_scroller_widget_set(wd->scroller, obj);
@@ -1899,14 +2797,15 @@ elm_entry_add(Evas_Object *parent)
    evas_object_size_hint_weight_set(wd->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(wd->scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_FALSE, EINA_FALSE);
-   evas_object_propagate_events_set(wd->scroller, EINA_TRUE);
-   
+   elm_smart_scroller_propagate_events_set(wd->scroller, EINA_TRUE);
+
    wd->linewrap     = ELM_WRAP_WORD;
    wd->editable     = EINA_TRUE;
    wd->disabled     = EINA_FALSE;
    wd->context_menu = EINA_TRUE;
    wd->autosave     = EINA_TRUE;
    wd->textonly     = EINA_FALSE;
+   wd->autoperiod   = EINA_TRUE;
 
    wd->ent = edje_object_add(e);
    elm_widget_sub_object_add(obj, wd->ent);
@@ -1920,14 +2819,26 @@ elm_entry_add(Evas_Object *parent)
    evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_MOVE,
                                   _mouse_move, obj);
    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
-   
+
    _elm_theme_object_set(obj, wd->ent, "entry", "base", "default");
    edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text",
                                    _signal_entry_changed, obj);
    edje_object_signal_callback_add(wd->ent, "preedit,changed", "elm.text",
                                    _signal_preedit_changed, obj);
+   edje_object_signal_callback_add(wd->ent, "handler,move,start", "elm.text",
+                                   _signal_handler_move_start, obj);
+   edje_object_signal_callback_add(wd->ent, "handler,move,end", "elm.text",
+                                   _signal_handler_move_end, obj);
+   edje_object_signal_callback_add(wd->ent, "handler,moving", "elm.text",
+                                   _signal_handler_moving, obj);
    edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text",
                                    _signal_selection_start, obj);
+   edje_object_signal_callback_add(wd->ent, "selection,end", "elm.text",
+                                   _signal_selection_end, obj);
+   edje_object_signal_callback_add(wd->ent, "long,pressed", "elm.text",
+                                   _signal_long_pressed, obj);
+   edje_object_signal_callback_add(wd->ent, "magnifier,changed", "elm.text",
+                                   _signal_magnifier_changed, obj);
    edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
                                    _signal_selection_changed, obj);
    edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text",
@@ -1966,6 +2877,8 @@ elm_entry_add(Evas_Object *parent)
    elm_widget_resize_object_set(obj, wd->ent);
    _sizing_eval(obj);
 
+   wd->input_panel_enable = edje_object_part_text_input_panel_enabled_get(wd->ent, "elm.text");
+
 #ifdef HAVE_ELEMENTARY_X
    top = elm_widget_top_get(obj);
    if ((top) && (elm_win_xwindow_get(top)))
@@ -1996,6 +2909,29 @@ elm_entry_add(Evas_Object *parent)
    return obj;
 }
 
+EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extension_data *ext_mod)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   ext_mod->cancel = _cancel;
+   ext_mod->copy = _copy;
+   ext_mod->cut = _cut;
+   ext_mod->paste = _paste;
+   ext_mod->select = _select;
+   ext_mod->selectall = _selectall;
+   ext_mod->ent = wd->ent;
+   ext_mod->viewport_obj = _viewport_obj_get(obj);
+   ext_mod->items = wd->items;
+   ext_mod->editable = wd->editable;
+   ext_mod->have_selection = wd->have_selection;
+   ext_mod->password = wd->password;
+   ext_mod->selmode = wd->selmode;
+   ext_mod->cnpinit = _cnpinit;
+   ext_mod->context_menu = wd->context_menu;
+   ext_mod->textonly = wd->textonly;
+}
+
 /**
  * This sets the entry object not to line wrap.  All input will
  * be on a single line, and the entry box will extend with user input.
@@ -2020,9 +2956,12 @@ elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
    if (wd->scroller)
      {
         if (wd->single_line)
-           elm_smart_scroller_policy_set(wd->scroller, 
-                                         ELM_SMART_SCROLLER_POLICY_OFF, 
-                                         ELM_SMART_SCROLLER_POLICY_OFF);
+          {
+             elm_smart_scroller_policy_set(wd->scroller,
+                                           ELM_SMART_SCROLLER_POLICY_OFF,
+                                           ELM_SMART_SCROLLER_POLICY_OFF);
+             elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_FALSE, EINA_FALSE);
+          }
         else
           {
              const Elm_Scroller_Policy map[3] =
@@ -2031,9 +2970,10 @@ elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
                   ELM_SMART_SCROLLER_POLICY_ON,
                   ELM_SMART_SCROLLER_POLICY_OFF
                };
-             elm_smart_scroller_policy_set(wd->scroller, 
-                                           map[wd->policy_h], 
+             elm_smart_scroller_policy_set(wd->scroller,
+                                           map[wd->policy_h],
                                            map[wd->policy_v]);
+             elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_FALSE, EINA_FALSE);
           }
         _sizing_eval(obj);
      }
@@ -2110,45 +3050,7 @@ elm_entry_password_get(const Evas_Object *obj)
 EAPI void
 elm_entry_entry_set(Evas_Object *obj, const char *entry)
 {
-   int len = 0;
-   ELM_CHECK_WIDTYPE(obj, widtype);
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
-   if (!entry) entry = "";
-   if (wd->text) eina_stringshare_del(wd->text);
-   wd->text = NULL;
-   wd->changed = EINA_TRUE;
-
-   /* Clear currently pending job if there is one */
-   if (wd->append_text_idler)
-     {
-        ecore_idler_del(wd->append_text_idler);
-        free(wd->append_text_left);
-        wd->append_text_left = NULL;
-        wd->append_text_idler = NULL;
-     }
-
-   len = strlen(entry);
-   /* Split to ~_CHUNK_SIZE chunks */
-   if (len > _CHUNK_SIZE)
-     {
-        wd->append_text_left = (char *) malloc(len + 1);
-     }
-
-   /* If we decided to use the idler */
-   if (wd->append_text_left)
-     {
-        /* Need to clear the entry first */
-        edje_object_part_text_set(wd->ent, "elm.text", "");
-        memcpy(wd->append_text_left, entry, len + 1);
-        wd->append_text_position = 0;
-        wd->append_text_len = len;
-        wd->append_text_idler = ecore_idler_add(_text_append_idler, obj);
-     }
-   else
-     {
-        edje_object_part_text_set(wd->ent, "elm.text", entry);
-     }
+   _elm_entry_text_set(obj, NULL, entry);
 }
 
 /**
@@ -2199,22 +3101,10 @@ elm_entry_entry_append(Evas_Object *obj, const char *entry)
  *
  * @ingroup Entry
  */
-EAPI const char *
-elm_entry_entry_get(const Evas_Object *obj)
-{
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-   Widget_Data *wd = elm_widget_data_get(obj);
-   const char *text;
-   if (!wd) return NULL;
-   if (wd->text) return wd->text;
-   text = edje_object_part_text_get(wd->ent, "elm.text");
-   if (!text)
-     {
-        ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
-        return NULL;
-     }
-   eina_stringshare_replace(&wd->text, text);
-   return wd->text;
+EAPI const char *
+elm_entry_entry_get(const Evas_Object *obj)
+{
+   return _elm_entry_text_get(obj, NULL);
 }
 
 /**
@@ -2234,9 +3124,11 @@ elm_entry_is_empty(const Evas_Object *obj)
    ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE;
    Widget_Data *wd = elm_widget_data_get(obj);
    const Evas_Object *tb;
-   Evas_Textblock_Cursor *cur;
+   //Evas_Textblock_Cursor *cur;
    Eina_Bool ret;
    if (!wd) return EINA_TRUE;
+
+#if 0
    /* It's a hack until we get the support suggested above.
     * We just create a cursor, point it to the begining, and then
     * try to advance it, if it can advance, the tb is not empty,
@@ -2250,6 +3142,14 @@ elm_entry_is_empty(const Evas_Object *obj)
    evas_textblock_cursor_free(cur);
 
    return !ret;
+#endif
+
+   char *str = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
+   if (!str) return EINA_TRUE;
+
+   ret = (strlen(str) == 0);
+
+   return ret;
 }
 
 /**
@@ -2290,6 +3190,12 @@ elm_entry_entry_insert(Evas_Object *obj, const char *entry)
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
    edje_object_part_text_insert(wd->ent, "elm.text", entry);
+   // start for cbhm
+#ifdef HAVE_ELEMENTARY_X
+   if (cnpwidgetdata == obj)
+      ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
+#endif
+   // end for cbhm
    wd->changed = EINA_TRUE;
    _sizing_eval(obj);
 }
@@ -2319,6 +3225,24 @@ elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
 }
 
 /**
+ * Get the wrapping behavior of the entry.
+ * See also elm_entry_line_wrap_set().
+ *
+ * @param obj The entry object
+ * @return Wrap type
+ *
+ * @ingroup Entry
+ */
+EAPI Elm_Wrap_Type
+elm_entry_line_wrap_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return EINA_FALSE;
+   return wd->linewrap;
+}
+
+/**
  * This sets the editable attribute of the entry.
  *
  * @param obj The entry object
@@ -3353,7 +4277,7 @@ elm_entry_cnp_textonly_get(const Evas_Object *obj)
  * Enable or disable scrolling in entry
  *
  * Normally the entry is not scrollable unless you enable it with this call.
- * 
+ *
  * @param obj The entry object
  * @param scroll EINA_TRUE if it is to be scrollable, EINA_FALSE otherwise
  *
@@ -3376,6 +4300,26 @@ elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll)
         elm_smart_scroller_child_set(wd->scroller, wd->ent);
         evas_object_show(wd->scroller);
         elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
+        if (wd->single_line)
+          {
+             elm_smart_scroller_policy_set(wd->scroller,
+                                           ELM_SMART_SCROLLER_POLICY_OFF,
+                                           ELM_SMART_SCROLLER_POLICY_OFF);
+             elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_FALSE, EINA_FALSE);
+          }
+        else
+          {
+             const Elm_Scroller_Policy map[3] =
+               {
+                  ELM_SMART_SCROLLER_POLICY_AUTO,
+                  ELM_SMART_SCROLLER_POLICY_ON,
+                  ELM_SMART_SCROLLER_POLICY_OFF
+               };
+             elm_smart_scroller_policy_set(wd->scroller,
+                                           map[wd->policy_h],
+                                           map[wd->policy_v]);
+             elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_FALSE, EINA_FALSE);
+          }
      }
    else
      {
@@ -3396,7 +4340,7 @@ elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll)
  *
  * Normally the entry is not scrollable. This gets the scrollable state
  * of the entry. See elm_entry_scrollable_set() for more information.
- * 
+ *
  * @param obj The entry object
  * @return The scrollable state
  *
@@ -3644,8 +4588,8 @@ elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scro
    if (!wd) return;
    wd->policy_h = h;
    wd->policy_v = v;
-   elm_smart_scroller_policy_set(wd->scroller, 
-                                 map[wd->policy_h], 
+   elm_smart_scroller_policy_set(wd->scroller,
+                                 map[wd->policy_h],
                                  map[wd->policy_v]);
 }
 
@@ -3684,3 +4628,365 @@ elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_b
    if (!wd) return;
    elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
 }
+
+EINA_DEPRECATED EAPI void
+elm_entry_line_char_wrap_set(Evas_Object *obj, Eina_Bool wrap)
+{
+   if (wrap) elm_entry_line_wrap_set(obj, ELM_WRAP_CHAR);
+}
+
+/**
+ * Set background color of the entry
+ *
+ * @param obj The entry object
+ * @param r Red property background color of The entry object
+ * @param g Green property background color of The entry object
+ * @param b Blue property background color of The entry object
+ * @param a Alpha property background alpha of The entry object
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   evas_object_color_set(wd->bg, r, g, b, a);
+
+   if (wd->bgcolor == EINA_FALSE)
+     {
+       wd->bgcolor = 1;
+       edje_object_part_swallow(wd->ent, "entry.swallow.background", wd->bg);
+     }
+}
+
+/**
+ * Set whether entry should support auto capitalization
+ *
+ * @param obj The entry object
+ * @param on If true, entry suports auto capitalization.
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   if (wd->password)
+     wd->autocapital = EINA_FALSE;
+   else
+     wd->autocapital = autocap;
+
+   if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
+       wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
+     wd->autocapital = EINA_FALSE;
+
+   edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
+}
+
+/**
+ * Set whether entry should support auto period
+ *
+ * @param obj The entry object
+ * @param on If true, entry suports auto period.
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   if (wd->password)
+     wd->autoperiod = EINA_FALSE;
+   else
+     wd->autoperiod = autoperiod;
+
+   if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
+       wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
+     wd->autoperiod = EINA_FALSE;
+
+   edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
+}
+
+/**
+ * Set whether entry should enable the return key on soft keyboard automatically
+ *
+ * @param obj The entry object
+ * @param on If true, entry enables the return key on soft keyboard automatically.
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   wd->autoreturnkey = on;
+   _check_enable_returnkey(obj);
+}
+
+/**
+ * This sets the attribute to show the input panel automatically.
+ *
+ * @param obj The entry object
+ * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   wd->input_panel_enable = enabled;
+   edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
+}
+
+/**
+ * Set the input panel layout of the entry
+ *
+ * @param obj The entry object
+ * @param layout the layout to set
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
+   if (!ic) return;
+
+   wd->input_panel_layout = layout;
+
+   ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)layout);
+}
+
+/**
+ * Get the input method context in the entry widget
+ *
+ * @param obj The entry object
+ * @return The input method context
+ *
+ * @ingroup Entry
+ */
+EAPI Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd || !wd->ent) return NULL;
+
+   return edje_object_part_text_imf_context_get(wd->ent, "elm.text");
+}
+
+EAPI void
+elm_entry_matchlist_set(Evas_Object *obj, Eina_List *match_list, Eina_Bool case_sensitive)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   if (match_list)
+     {
+        Evas_Coord max_w = 9999, max_h = 9999;
+        const char* key_data = NULL;
+
+        wd->matchlist_threshold = 1;
+        wd->hover = elm_hover_add(elm_widget_parent_get(obj));
+        elm_hover_parent_set(wd->hover, elm_widget_parent_get(obj));
+        elm_hover_target_set(wd->hover, obj);
+        elm_object_style_set(wd->hover, "matchlist");
+
+        wd->layout = elm_layout_add(wd->hover);
+        elm_layout_theme_set(wd->layout, "entry", "matchlist", "default");
+        wd->list = elm_list_add(wd->layout);
+        evas_object_size_hint_weight_set(wd->list, EVAS_HINT_EXPAND, 0.0);
+        evas_object_size_hint_align_set(wd->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+        elm_list_mode_set(wd->list, ELM_LIST_EXPAND);
+        elm_object_style_set(wd->list, "matchlist");
+
+        key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_width");
+        if (key_data) max_w = atoi(key_data);
+        key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_height");
+        if (key_data) max_h = atoi(key_data);
+
+        elm_list_go(wd->list);
+        evas_object_size_hint_max_set(wd->list, max_w, max_h);
+        evas_object_smart_callback_add(wd->list, "selected", _matchlist_list_clicked, obj);
+        elm_layout_content_set(wd->layout, "elm.swallow.content", wd->list);
+        elm_hover_content_set(wd->hover, "bottom", wd->layout);
+
+        wd->match_list = match_list;
+     }
+   else
+     {
+        if (wd->hover)
+          evas_object_del(wd->hover);
+
+        wd->match_list = NULL;
+     }
+
+   wd->matchlist_case_sensitive = case_sensitive;
+}
+
+/**
+ * Set the magnifier style of the entry
+ *
+ * @param obj The entry object
+ * @param type the magnifier style to set
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_magnifier_type_set(Evas_Object *obj, int type)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   wd->mgf_type = type;
+   _magnifier_create(obj);
+}
+
+/**
+ * Set wrap width of the entry
+ *
+ * @param obj The entry object
+ * @param w The wrap width in pixels at a minimum where words need to wrap
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_wrap_width_set(Evas_Object *obj, Evas_Coord w)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (wd->wrap_w == w) return;
+   wd->wrap_w = w;
+   _sizing_eval(obj);
+}
+
+/**
+ * get wrap width of the entry
+ *
+ * @param obj The entry object
+ * @return The wrap width in pixels at a minimum where words need to wrap
+ * @ingroup Entry
+ */
+EAPI Evas_Coord
+elm_entry_wrap_width_get(const Evas_Object *obj)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   return wd->wrap_w;
+}
+
+/**
+ * Set the font size on the entry object
+ *
+ * @param obj The entry object
+ * @param size font size
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_fontsize_set(Evas_Object *obj, int fontsize)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Eina_Strbuf *fontbuf = NULL;
+   int removeflag = 0;
+   const char *t;
+
+   if (!wd) return;
+   t = eina_stringshare_add(elm_entry_entry_get(obj));
+   fontbuf = eina_strbuf_new();
+   eina_strbuf_append_printf(fontbuf, "%d", fontsize);
+
+   if (fontsize == 0) removeflag = 1; // remove fontsize tag
+
+   if (_stringshare_key_value_replace(&t, "font_size", eina_strbuf_string_get(fontbuf), removeflag) == 0)
+     {
+       elm_entry_entry_set(obj, t);
+       wd->changed = 1;
+       _sizing_eval(obj);
+     }
+   eina_strbuf_free(fontbuf);
+   eina_stringshare_del(t);
+}
+
+/**
+ * Set the text color on the entry object
+ *
+ * @param obj The entry object
+ * @param r Red property background color of The entry object
+ * @param g Green property background color of The entry object
+ * @param b Blue property background color of The entry object
+ * @param a Alpha property background alpha of The entry object
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Eina_Strbuf *colorbuf = NULL;
+   const char *t;
+   int len;
+
+   if (!wd) return;
+   t = eina_stringshare_add(elm_entry_entry_get(obj));
+   len = strlen(t);
+   if (len <= 0) return;
+   colorbuf = eina_strbuf_new();
+   eina_strbuf_append_printf(colorbuf, "#%02X%02X%02X%02X", r, g, b, a);
+
+   if (_stringshare_key_value_replace(&t, "color", eina_strbuf_string_get(colorbuf), 0) == 0)
+     {
+       elm_entry_entry_set(obj, t);
+       wd->changed = 1;
+       _sizing_eval(obj);
+     }
+   eina_strbuf_free(colorbuf);
+   eina_stringshare_del(t);
+}
+
+/**
+ * Set the text align on the entry object
+ *
+ * @param obj The entry object
+ * @param align align mode
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_text_align_set(Evas_Object *obj, const char *alignmode)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   int len;
+   const char *t;
+
+   if (!wd) return;
+   t = eina_stringshare_add(elm_entry_entry_get(obj));
+   len = strlen(t);
+   if (len <= 0) return;
+
+   if (_stringshare_key_value_replace(&t, "align", alignmode, 0) == 0)
+     elm_entry_entry_set(obj, t);
+
+   wd->changed = 1;
+   _sizing_eval(obj);
+   eina_stringshare_del(t);
+}