Merge "enable vsync configuration"
authorchuneon.park <chuneon.park@samsung.com>
Wed, 18 May 2011 05:44:15 +0000 (14:44 +0900)
committerGerrit Code Review <git@Maetan>
Wed, 18 May 2011 05:44:15 +0000 (14:44 +0900)
debian/changelog
src/lib/elm_store.c
src/modules/ctxpopup_copypasteUI/copypaste.c

index e7b78c9..0cd0f56 100644 (file)
@@ -1,3 +1,11 @@
+elementary (1.0.0+svn.58393slp2+build05) unstable; urgency=low
+
+  * [Store] Fix the crash problem in label get func
+  * Git: 165.213.180.234:/slp/pkgs/e/elementary
+  * Tag: elementary_1.0.0+svn.58393slp2+build05
+
+ -- Ilkook Yun <ilkook.yun@samsung.com>  Mon, 16 May 2011 10:40:12 +0900
+
 elementary (1.0.0+svn.58393slp2+build04) unstable; urgency=low
 
   * Package Upload
index af37eda..4bb78b3 100644 (file)
@@ -77,7 +77,6 @@ struct _Elm_Store
              void                  *data;
         } item_free;
    } cb;
-   LK(lock);
    Eina_Bool      sorted : 1;
    Eina_Bool      fetch_thread : 1;
    Eina_Bool      multi_load : 1;
@@ -643,7 +642,6 @@ elm_store_free(Elm_Store *st)
      }
    else
      {
-        LKL(st->lock);
         st->live = EINA_FALSE;
         Eina_List *l;
         Eina_List *l_next;
@@ -690,7 +688,6 @@ elm_store_free(Elm_Store *st)
              elm_genlist_clear(st->genlist);
              st->genlist = NULL;
           }
-        LKD(st->lock);
      }
    free(st);
 }
@@ -887,7 +884,6 @@ _store_init(size_t size)
 {
    Elm_Store *st = calloc(1, size);
    if (!st) return NULL;
-   LKI(st->lock);
 
    eina_magic_string_set(ELM_STORE_MAGIC, "Elm_Store");
    eina_magic_string_set(ELM_STORE_FILESYSTEM_MAGIC, "Elm_Store_Filesystem");
@@ -1090,45 +1086,47 @@ _item_realize(Elm_Store_Item *sti)
 {
    if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return;
    Elm_Store *st = sti->store;
-
-   int index = elm_store_item_index_get(sti);
-
-   if ((st->start_fetch_index <= index) && (index <= (st->start_fetch_index + st->cache_max)))
+   if (sti->store->live)
      {
-        if (sti->fetched)
-          {
-             _item_unfetch(st, index);
-          }
-        _item_fetch(st, index);
+        int index = elm_store_item_index_get(sti);
 
-        if(st->end_fetch_index < index)
+        if ((st->start_fetch_index <= index) && (index <= (st->start_fetch_index + st->cache_max)))
           {
-             st->end_fetch_index = index;
+             if (sti->fetched)
+               {
+                  _item_unfetch(st, index);
+               }
+             _item_fetch(st, index);
+
+             if(st->end_fetch_index < index)
+               {
+                  st->end_fetch_index = index;
+               }
           }
-     }
-   else if (st->start_fetch_index > index)
-     {
-        int diff = st->start_fetch_index - index;
-        int loop;
-        for (loop = 1; loop <= diff; loop++)
+        else if (st->start_fetch_index > index)
           {
-             _item_unfetch(st, st->end_fetch_index);
-             st->end_fetch_index--;
-             _item_fetch(sti->store, (st->start_fetch_index - loop));
+             int diff = st->start_fetch_index - index;
+             int loop;
+             for (loop = 1; loop <= diff; loop++)
+               {
+                  _item_unfetch(st, st->end_fetch_index);
+                  st->end_fetch_index--;
+                  _item_fetch(sti->store, (st->start_fetch_index - loop));
+               }
+             st->start_fetch_index = index;
           }
-        st->start_fetch_index = index;
-     }
-   else if (index > st->end_fetch_index)
-     {
-        int diff = index - st->end_fetch_index;
-        int loop;
-        for (loop = 1; loop <= diff; loop++)
+        else if (index > st->end_fetch_index)
           {
-             _item_unfetch(st, st->start_fetch_index);
-             st->start_fetch_index++;
-             _item_fetch(st, (st->end_fetch_index + loop));
+             int diff = index - st->end_fetch_index;
+             int loop;
+             for (loop = 1; loop <= diff; loop++)
+               {
+                  _item_unfetch(st, st->start_fetch_index);
+                  st->start_fetch_index++;
+                  _item_fetch(st, (st->end_fetch_index + loop));
+               }
+             st->end_fetch_index = index;
           }
-        st->end_fetch_index = index;
      }
 }
 
@@ -1139,47 +1137,50 @@ _item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
    Elm_Store_Item *sti = data;
    EINA_SAFETY_ON_NULL_RETURN_VAL(sti,NULL);
 
-   if (sti->item)
+   if (sti->store->live)
      {
-        if (!sti->data)
+        if (sti->item)
           {
-             _item_realize(sti);
-          }
+             if (!sti->data)
+               {
+                  _item_realize(sti);
+               }
 
-        LKL(sti->lock);
-        if (sti->data)
-          {
-             const char *s = "";
-             const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part);
-             if (m)
+             LKL(sti->lock);
+             if (sti->data)
                {
-                  switch (m->type)
+                  const char *s = "";
+                  const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part);
+                  if (m)
                     {
-                     case ELM_STORE_ITEM_MAPPING_LABEL:
-                        s = *(char **)(((unsigned char *)sti->data) + m->offset);
-                        break;
+                       switch (m->type)
+                         {
+                          case ELM_STORE_ITEM_MAPPING_LABEL:
+                             s = *(char **)(((unsigned char *)sti->data) + m->offset);
+                             break;
 
-                     case ELM_STORE_ITEM_MAPPING_CUSTOM:
-                        if (m->details.custom.func)
-                          s = m->details.custom.func(sti->data, sti, part);
-                        break;
+                          case ELM_STORE_ITEM_MAPPING_CUSTOM:
+                             if (m->details.custom.func)
+                               s = m->details.custom.func(sti->data, sti, part);
+                             break;
 
-                     default:
-                        break;
-                    }
-                  if (s)
-                    {
-                       LKU(sti->lock);
-                       return strdup(s);
-                    }
-                  else
-                    {
-                       LKU(sti->lock);
-                       return NULL;
+                          default:
+                             break;
+                         }
+                       if (s)
+                         {
+                            LKU(sti->lock);
+                            return strdup(s);
+                         }
+                       else
+                         {
+                            LKU(sti->lock);
+                            return NULL;
+                         }
                     }
                }
+             LKU(sti->lock);
           }
-        LKU(sti->lock);
      }
    return NULL;
 }
@@ -1191,68 +1192,71 @@ _item_icon_get(void *data, Evas_Object *obj, const char *part)
    Elm_Store_Item *sti = data;
    EINA_SAFETY_ON_NULL_RETURN_VAL(sti,NULL);
 
-   if (sti->item)
+   if (sti->store->live)
      {
-        if (!sti->data)
+        if (sti->item)
           {
-             _item_realize(sti);
-          }
-
-        LKL(sti->lock);
-        if (sti->data)
-          {
-             const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part);
-             if (m)
+             if (!sti->data)
                {
-                  Evas_Object *ic = NULL;
-                  const char *s = NULL;
+                  _item_realize(sti);
+               }
 
-                  switch (m->type)
+             LKL(sti->lock);
+             if (sti->data)
+               {
+                  const Elm_Store_Item_Mapping *m = _item_mapping_find(sti, part);
+                  if (m)
                     {
-                     case ELM_STORE_ITEM_MAPPING_ICON:
-                        ic = elm_icon_add(obj);
-                        s = *(char **)(((unsigned char *)sti->data) + m->offset);
-                        elm_icon_order_lookup_set(ic, m->details.icon.lookup_order);
-                        evas_object_size_hint_aspect_set(ic,
-                                                         EVAS_ASPECT_CONTROL_VERTICAL,
-                                                         m->details.icon.w,
-                                                         m->details.icon.h);
-                        elm_icon_smooth_set(ic, m->details.icon.smooth);
-                        elm_icon_no_scale_set(ic, m->details.icon.no_scale);
-                        elm_icon_scale_set(ic,
-                                           m->details.icon.scale_up,
-                                           m->details.icon.scale_down);
-
-                        if (s)
-                          {
-                             if (m->details.icon.standard_name)
-                               elm_icon_standard_set(ic, s);
-                             else
-                               elm_icon_file_set(ic, s, NULL);
-                          }
-                        break;
-
-                     case ELM_STORE_ITEM_MAPPING_PHOTO:
-                        ic = elm_icon_add(obj);
-                        s = *(char **)(((unsigned char *)sti->data) + m->offset);
-                        elm_photo_size_set(ic, m->details.photo.size);
-                        if (s)
-                          elm_photo_file_set(ic, s);
-                        break;
-
-                     case ELM_STORE_ITEM_MAPPING_CUSTOM:
-                        if (m->details.custom.func)
-                          ic = m->details.custom.func(sti->data, sti, part);
-                        break;
-
-                     default:
-                        break;
+                       Evas_Object *ic = NULL;
+                       const char *s = NULL;
+
+                       switch (m->type)
+                         {
+                          case ELM_STORE_ITEM_MAPPING_ICON:
+                             ic = elm_icon_add(obj);
+                             s = *(char **)(((unsigned char *)sti->data) + m->offset);
+                             elm_icon_order_lookup_set(ic, m->details.icon.lookup_order);
+                             evas_object_size_hint_aspect_set(ic,
+                                                              EVAS_ASPECT_CONTROL_VERTICAL,
+                                                              m->details.icon.w,
+                                                              m->details.icon.h);
+                             elm_icon_smooth_set(ic, m->details.icon.smooth);
+                             elm_icon_no_scale_set(ic, m->details.icon.no_scale);
+                             elm_icon_scale_set(ic,
+                                                m->details.icon.scale_up,
+                                                m->details.icon.scale_down);
+
+                             if (s)
+                               {
+                                  if (m->details.icon.standard_name)
+                                    elm_icon_standard_set(ic, s);
+                                  else
+                                    elm_icon_file_set(ic, s, NULL);
+                               }
+                             break;
+
+                          case ELM_STORE_ITEM_MAPPING_PHOTO:
+                             ic = elm_icon_add(obj);
+                             s = *(char **)(((unsigned char *)sti->data) + m->offset);
+                             elm_photo_size_set(ic, m->details.photo.size);
+                             if (s)
+                               elm_photo_file_set(ic, s);
+                             break;
+
+                          case ELM_STORE_ITEM_MAPPING_CUSTOM:
+                             if (m->details.custom.func)
+                               ic = m->details.custom.func(sti->data, sti, part);
+                             break;
+
+                          default:
+                             break;
+                         }
+                       LKU(sti->lock);
+                       return ic;
                     }
-                  LKU(sti->lock);
-                  return ic;
                }
+             LKU(sti->lock);
           }
-        LKU(sti->lock);
      }
    return NULL;
 }
@@ -2235,7 +2239,6 @@ elm_store_item_add(Elm_Store *st, Elm_Store_Item_Info *info)
 
    if (st->live)
      {
-        LKL(st->lock);
         if (sti->item_info->item_type == ELM_GENLIST_ITEM_GROUP)
           {
              _group_item_append(sti, itc);
@@ -2244,7 +2247,6 @@ elm_store_item_add(Elm_Store *st, Elm_Store_Item_Info *info)
           {
              _normal_item_append(sti, itc);
           }
-        LKU(st->lock);
         return sti;
      }
    else
@@ -2345,75 +2347,78 @@ elm_store_item_del(Elm_Store_Item *sti)
    Eina_List*l_next;
    Eina_List *header_list;
 
-   EINA_LIST_FOREACH_SAFE(st->header_items, l, l_next, header_list)
+   if (st->live)
      {
-        if (header_list)
+        EINA_LIST_FOREACH_SAFE(st->header_items, l, l_next, header_list)
           {
-             Elm_Store_Item *header_item = eina_list_nth(header_list, 0);
-
-             if (header_item->item_info->group_index == sti->item_info->group_index)
+             if (header_list)
                {
-                  Eina_Bool removed = EINA_FALSE;
-                  Eina_List *in_l;
-                  Eina_List *in_l_next;
-                  Elm_Store_Item *remove_sti;
-                  EINA_LIST_FOREACH_SAFE(header_list, in_l, in_l_next, remove_sti)
+                  Elm_Store_Item *header_item = eina_list_nth(header_list, 0);
+
+                  if (header_item->item_info->group_index == sti->item_info->group_index)
                     {
-                       if(remove_sti)
+                       Eina_Bool removed = EINA_FALSE;
+                       Eina_List *in_l;
+                       Eina_List *in_l_next;
+                       Elm_Store_Item *remove_sti;
+                       EINA_LIST_FOREACH_SAFE(header_list, in_l, in_l_next, remove_sti)
                          {
-                            if (removed == EINA_TRUE)
-                              {
-                                 remove_sti->item_info->index--;
-                              }
-                            else
+                            if(remove_sti)
                               {
-                                 if (remove_sti->item_info->index == sti->item_info->index)
+                                 if (removed == EINA_TRUE)
                                    {
-                                      if (st->cb.item_free.func)
-                                        {
-                                           st->cb.item_free.func(st->cb.item_free.data, remove_sti->item_info);
-                                        }
-                                      if (remove_sti->fetched)
-                                        {
-                                           int index = elm_store_item_index_get(remove_sti);
-                                           _item_unfetch(st, index);
-                                        }
-                                      Eina_List *temp_header_list = header_list;
-                                      header_list = eina_list_remove(header_list, remove_sti);
-                                      st->total_item_count--;
-                                      LKD(remove_sti->lock);
-                                      elm_genlist_item_del(remove_sti->item);
-                                      free(remove_sti);
-
-                                      if (eina_list_count(header_list) == 0)
-                                        {
-                                           st->header_items = eina_list_remove(st->header_items, temp_header_list);
-                                           eina_list_free(header_list);
-                                        }
-                                      else if (eina_list_count(header_list) == 1)
+                                      remove_sti->item_info->index--;
+                                   }
+                                 else
+                                   {
+                                      if (remove_sti->item_info->index == sti->item_info->index)
                                         {
-                                           Elm_Store_Item *temp_sti = eina_list_nth(header_list, 0);
-                                           if (temp_sti->item_info->item_type == ELM_GENLIST_ITEM_GROUP)
+                                           if (st->cb.item_free.func)
+                                             {
+                                                st->cb.item_free.func(st->cb.item_free.data, remove_sti->item_info);
+                                             }
+                                           if (remove_sti->fetched)
+                                             {
+                                                int index = elm_store_item_index_get(remove_sti);
+                                                _item_unfetch(st, index);
+                                             }
+                                           Eina_List *temp_header_list = header_list;
+                                           header_list = eina_list_remove(header_list, remove_sti);
+                                           st->total_item_count--;
+                                           LKD(remove_sti->lock);
+                                           elm_genlist_item_del(remove_sti->item);
+                                           free(remove_sti);
+
+                                           if (eina_list_count(header_list) == 0)
                                              {
-                                                if (st->cb.item_free.func)
-                                                  {
-                                                     st->cb.item_free.func(st->cb.item_free.data, temp_sti->item_info);
-                                                  }
-                                                if (temp_sti->fetched)
-                                                  {
-                                                     int index = elm_store_item_index_get(temp_sti);
-                                                     _item_unfetch(st, index);
-                                                  }
-                                                header_list = eina_list_remove(header_list, temp_sti);
-                                                st->total_item_count--;
-                                                LKD(temp_sti->lock);
-                                                elm_genlist_item_del(temp_sti->item);
-                                                free(temp_sti);
                                                 st->header_items = eina_list_remove(st->header_items, temp_header_list);
                                                 eina_list_free(header_list);
                                              }
+                                           else if (eina_list_count(header_list) == 1)
+                                             {
+                                                Elm_Store_Item *temp_sti = eina_list_nth(header_list, 0);
+                                                if (temp_sti->item_info->item_type == ELM_GENLIST_ITEM_GROUP)
+                                                  {
+                                                     if (st->cb.item_free.func)
+                                                       {
+                                                          st->cb.item_free.func(st->cb.item_free.data, temp_sti->item_info);
+                                                       }
+                                                     if (temp_sti->fetched)
+                                                       {
+                                                          int index = elm_store_item_index_get(temp_sti);
+                                                          _item_unfetch(st, index);
+                                                       }
+                                                     header_list = eina_list_remove(header_list, temp_sti);
+                                                     st->total_item_count--;
+                                                     LKD(temp_sti->lock);
+                                                     elm_genlist_item_del(temp_sti->item);
+                                                     free(temp_sti);
+                                                     st->header_items = eina_list_remove(st->header_items, temp_header_list);
+                                                     eina_list_free(header_list);
+                                                  }
+                                             }
+                                           removed = EINA_TRUE;
                                         }
-                                      removed = EINA_TRUE;
                                    }
                               }
                          }
index 74d7bd0..a35b1a5 100644 (file)
@@ -3,6 +3,7 @@
 #include "elm_priv.h"
 
 Elm_Entry_Extension_data *ext_mod;
+static int _mod_hook_count = 0;
 
 typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
 struct _Elm_Entry_Context_Menu_Item
@@ -19,20 +20,22 @@ struct _Elm_Entry_Context_Menu_Item
 static void
 _ctxpopup_position(Evas_Object *obj)
 {
+   if(!ext_mod) return;
+
    Evas_Coord cx, cy, cw, ch, x, y, mw, mh;
    evas_object_geometry_get(ext_mod->ent, &x, &y, NULL, NULL);
    edje_object_part_text_cursor_geometry_get(ext_mod->ent, "elm.text",
-                                            &cx, &cy, &cw, &ch);
+                                             &cx, &cy, &cw, &ch);
    evas_object_size_hint_min_get(ext_mod->popup, &mw, &mh);
    if (cw < mw)
      {
-       cx += (cw - mw) / 2;
-       cw = mw;
+        cx += (cw - mw) / 2;
+        cw = mw;
      }
    if (ch < mh)
      {
-       cy += (ch - mh) / 2;
-       ch = mh;
+        cy += (ch - mh) / 2;
+        ch = mh;
      }
    evas_object_move(ext_mod->popup, x + cx, y + cy);
    evas_object_resize(ext_mod->popup, cw, ch);
@@ -41,6 +44,8 @@ _ctxpopup_position(Evas_Object *obj)
 static void
 _select_all(void *data, Evas_Object *obj, void *event_info)
 {
+   if(!ext_mod) return;
+
    ext_mod->selectall(data,obj,event_info);
    evas_object_hide(obj);
 }
@@ -48,6 +53,8 @@ _select_all(void *data, Evas_Object *obj, void *event_info)
 static void
 _select(void *data, Evas_Object *obj, void *event_info)
 {
+   if(!ext_mod) return;
+
    ext_mod->select(data,obj,event_info);
    evas_object_hide(obj);
 }
@@ -55,47 +62,57 @@ _select(void *data, Evas_Object *obj, void *event_info)
 static void
 _paste(void *data, Evas_Object *obj, void *event_info)
 {
-       ext_mod->paste(data,obj,event_info);
-       evas_object_hide(obj);
+   if(!ext_mod) return;
+
+   ext_mod->paste(data,obj,event_info);
+   evas_object_hide(obj);
 }
 
 static void
 _cut(void *data, Evas_Object *obj, void *event_info)
 {
-       ext_mod->cut(data,obj,event_info);
-       evas_object_hide(obj);
-       elm_object_scroll_freeze_pop(ext_mod->popup);
+   if(!ext_mod) return;
+
+   ext_mod->cut(data,obj,event_info);
+   evas_object_hide(obj);
+   elm_object_scroll_freeze_pop(ext_mod->popup);
 }
 
 static void
 _copy(void *data, Evas_Object *obj, void *event_info)
 {
-       ext_mod->copy(data,obj,event_info);
-       evas_object_hide(obj);
-       elm_object_scroll_freeze_pop(ext_mod->popup);
+   if(!ext_mod) return;
+
+   ext_mod->copy(data,obj,event_info);
+   evas_object_hide(obj);
+   elm_object_scroll_freeze_pop(ext_mod->popup);
 }
 
 static void
 _cancel(void *data, Evas_Object *obj, void *event_info)
 {
-       ext_mod->cancel(data,obj,event_info);
-       evas_object_hide(obj);
-       elm_object_scroll_freeze_pop(ext_mod->popup);
+   if(!ext_mod) return;
+
+   ext_mod->cancel(data,obj,event_info);
+   evas_object_hide(obj);
+   elm_object_scroll_freeze_pop(ext_mod->popup);
 }
 
 static void
 _clipboard_menu(void *data, Evas_Object *obj, void *event_info)
 {
-       // start for cbhm
-       ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
-       ext_mod->cnpinit(data,obj,event_info);
-       elm_cbhm_helper_init(obj);
-       if (ext_mod->textonly)
-               elm_cbhm_send_raw_data("show0");
-       else
-               elm_cbhm_send_raw_data("show1");
-       evas_object_hide(obj);
-       // end for cbhm
+   if(!ext_mod) return;
+
+   // start for cbhm
+   ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
+   ext_mod->cnpinit(data,obj,event_info);
+   elm_cbhm_helper_init(obj);
+   if (ext_mod->textonly)
+      elm_cbhm_send_raw_data("show0");
+   else
+      elm_cbhm_send_raw_data("show1");
+   evas_object_hide(obj);
+   // end for cbhm
 }
 
 static void
@@ -104,8 +121,8 @@ _item_clicked(void *data, Evas_Object *obj, void *event_info)
    Elm_Entry_Context_Menu_Item *it = data;
    Evas_Object *obj2 = it->obj;
 
-       if (it->func) it->func(it->data, obj2, NULL);
-       evas_object_hide(obj);
+   if (it->func) it->func(it->data, obj2, NULL);
+   evas_object_hide(obj);
 }
 
 // module api funcs needed
@@ -121,150 +138,157 @@ elm_modapi_shutdown(void *m)
    return 1; // succeed always
 }
 
-// module fucns for the specific module type
+// module funcs for the specific module type
 EAPI void
 obj_hook(Evas_Object *obj)
 {
-       if(!ext_mod)
-               {
-                       ext_mod = ELM_NEW(Elm_Entry_Extension_data);
-               elm_entry_extension_module_data_get(obj,ext_mod);
-               }
+   _mod_hook_count++;
+   //if(_mod_hook_count > 1) return;
+
+   if(!ext_mod)
+     {
+        ext_mod = ELM_NEW(Elm_Entry_Extension_data);
+        elm_entry_extension_module_data_get(obj,ext_mod);
+     }
 }
 
 EAPI void
 obj_unhook(Evas_Object *obj)
 {
+   _mod_hook_count--;
+   if(_mod_hook_count > 0) return;
+
    if(ext_mod)
-               {
-                       free(ext_mod);
-                       ext_mod = NULL;
-       }
+     {
+        free(ext_mod);
+        ext_mod = NULL;
+     }
 }
 
 EAPI void
 obj_longpress(Evas_Object *obj)
 {      
-       if(!ext_mod) return;
-       Evas_Object *top;
-       const Eina_List *l;
-       const Elm_Entry_Context_Menu_Item *it;
-       const char *context_menu_orientation;
-       char buf[255];
-       Evas_Object* icon;
-
-       /*update*/
-       elm_entry_extension_module_data_get(obj,ext_mod);
-       if (ext_mod->context_menu)
-       {
-               if (ext_mod->popup) evas_object_del(ext_mod->popup);
-//             else elm_widget_scroll_freeze_push(obj);
-               top = elm_widget_top_get(obj);
-               if(top)
-                       ext_mod->popup = elm_ctxpopup_add(top);
-               /*currently below theme not used,when guideline comes a new theme can be created if required*/
-               elm_object_style_set(ext_mod->popup,"extended/entry");
-               context_menu_orientation = edje_object_data_get
-               (ext_mod->ent, "context_menu_orientation");
-               if ((context_menu_orientation) &&
-               (!strcmp(context_menu_orientation, "horizontal")))
-               elm_ctxpopup_horizontal_set(ext_mod->popup, EINA_TRUE);
-
-               elm_widget_sub_object_add(obj, ext_mod->popup);
-               if (!ext_mod->selmode)
-               {       
-                       if (!ext_mod->password)
-                       {
-                               if (!elm_entry_is_empty(obj))
-                               {
-                                       elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
-                                       elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
-                               }
-                       }
-                       if (1) // need way to detect if someone has a selection
-                               {
-                                       if (ext_mod->editable)
-                                               elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
-                               }
-       //              elm_ctxpopup_item_append(wd->ctxpopup, NULL, "Selectall",_select_all, obj );
-       // start for cbhm
-                       if ((!ext_mod->password) && (ext_mod->editable))
-                       {
-                               icon = elm_icon_add(ext_mod->popup);
-                               snprintf(buf, sizeof(buf), "%s/images/copypaste_icon_clipboard.png", PACKAGE_DATA_DIR);
-                               elm_icon_file_set(icon, buf, NULL);
-                               elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _clipboard_menu, obj);
-                               //elm_ctxpopup_item_append(ext_mod->popup, "More", NULL, _clipboard_menu, obj );
-                       }
-       // end for cbhm
-               }
-               else
-               {
-                         if (!ext_mod->password)
-                               {
-                                       if (ext_mod->have_selection)
-                                               {
-                                                       elm_ctxpopup_item_append(ext_mod->popup, "Copy", NULL, _copy, obj );
-                                                       if (ext_mod->editable)
-                                                               elm_ctxpopup_item_append(ext_mod->popup, "Cut", NULL, _cut, obj );                                                      
-                                                       if (ext_mod->editable)
-                                                               elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
-                                               }
-                                       else
-                                               {
-                                                       _cancel(obj,ext_mod->popup,NULL);               
-                                                       if (!elm_entry_is_empty(obj))
-                                                       {
-                                                               elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
-                                                               elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
-                                                       }
-                                                       if (1) // need way to detect if someone has a selection
-                                                               {
-                                                                       if (ext_mod->editable)
-                                                                               elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
-                                                               }
-                                               }
-       // start for cbhm
-                                       if (ext_mod->editable)
-                                       {
-                                               icon = elm_icon_add(ext_mod->popup);
-                                               snprintf(buf, sizeof(buf), "%s/images/copypaste_icon_clipboard.png", PACKAGE_DATA_DIR);
-                                               elm_icon_file_set(icon, buf, NULL);
-                                               elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _clipboard_menu, obj);
-                                               //elm_ctxpopup_item_append(ext_mod->popup, "More", NULL, _clipboard_menu, obj );
-                                       }
-       // end for cbhm
-                               }
-               }
-               EINA_LIST_FOREACH(ext_mod->items, l, it)
-               {
-                       elm_ctxpopup_item_append(ext_mod->popup, it->label, NULL, _item_clicked, it );
-               }
-               if (ext_mod->popup)
-                       {
-                               elm_object_scroll_freeze_push(ext_mod->popup);
-                               _ctxpopup_position(obj);
-                               evas_object_show(ext_mod->popup);                 
-                       }
-               }
-       ext_mod->longpress_timer = NULL;
-       }
+   if(!ext_mod) return;
+
+   Evas_Object *top;
+   const Eina_List *l;
+   const Elm_Entry_Context_Menu_Item *it;
+   const char *context_menu_orientation;
+   char buf[255];
+   Evas_Object* icon;
+
+   /*update*/
+   elm_entry_extension_module_data_get(obj,ext_mod);
+   if (ext_mod->context_menu)
+     {
+        if (ext_mod->popup) evas_object_del(ext_mod->popup);
+        //else elm_widget_scroll_freeze_push(obj);
+        top = elm_widget_top_get(obj);
+        if(top)
+           ext_mod->popup = elm_ctxpopup_add(top);
+        /*currently below theme not used,when guideline comes a new theme can be created if required*/
+        elm_object_style_set(ext_mod->popup,"extended/entry");
+        context_menu_orientation = edje_object_data_get
+           (ext_mod->ent, "context_menu_orientation");
+        if ((context_menu_orientation) &&
+            (!strcmp(context_menu_orientation, "horizontal")))
+           elm_ctxpopup_horizontal_set(ext_mod->popup, EINA_TRUE);
+
+        elm_widget_sub_object_add(obj, ext_mod->popup);
+        if (!ext_mod->selmode)
+          {
+             if (!ext_mod->password)
+               {
+                  if (!elm_entry_is_empty(obj))
+                    {
+                       elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
+                       elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                    }
+               }
+             if (1) // need way to detect if someone has a selection
+               {
+                  if (ext_mod->editable)
+                     elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
+               }
+             //elm_ctxpopup_item_append(wd->ctxpopup, NULL, "Selectall",_select_all, obj );
+             // start for cbhm
+             if ((!ext_mod->password) && (ext_mod->editable))
+               {
+                  icon = elm_icon_add(ext_mod->popup);
+                  snprintf(buf, sizeof(buf), "%s/images/copypaste_icon_clipboard.png", PACKAGE_DATA_DIR);
+                  elm_icon_file_set(icon, buf, NULL);
+                  elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _clipboard_menu, obj);
+                  //elm_ctxpopup_item_append(ext_mod->popup, "More", NULL, _clipboard_menu, obj );
+               }
+             // end for cbhm
+          }
+        else
+          {
+             if (!ext_mod->password)
+               {
+                  if (ext_mod->have_selection)
+                    {
+                       elm_ctxpopup_item_append(ext_mod->popup, "Copy", NULL, _copy, obj );
+                       if (ext_mod->editable)
+                          elm_ctxpopup_item_append(ext_mod->popup, "Cut", NULL, _cut, obj );
+                       if (ext_mod->editable)
+                          elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
+                    }
+                  else
+                    {
+                       _cancel(obj,ext_mod->popup,NULL);
+                       if (!elm_entry_is_empty(obj))
+                         {
+                            elm_ctxpopup_item_append(ext_mod->popup, "Select", NULL, _select, obj );
+                            elm_ctxpopup_item_append(ext_mod->popup, "Select All", NULL, _select_all, obj );
+                         }
+                       if (1) // need way to detect if someone has a selection
+                         {
+                            if (ext_mod->editable)
+                               elm_ctxpopup_item_append(ext_mod->popup, "Paste", NULL, _paste, obj );
+                         }
+                    }
+                  // start for cbhm
+                  if (ext_mod->editable)
+                    {
+                       icon = elm_icon_add(ext_mod->popup);
+                       snprintf(buf, sizeof(buf), "%s/images/copypaste_icon_clipboard.png", PACKAGE_DATA_DIR);
+                       elm_icon_file_set(icon, buf, NULL);
+                       elm_ctxpopup_item_append(ext_mod->popup, NULL, icon, _clipboard_menu, obj);
+                       //elm_ctxpopup_item_append(ext_mod->popup, "More", NULL, _clipboard_menu, obj );
+                    }
+                  // end for cbhm
+               }
+          }
+        EINA_LIST_FOREACH(ext_mod->items, l, it)
+          {
+             elm_ctxpopup_item_append(ext_mod->popup, it->label, NULL, _item_clicked, it );
+          }
+        if (ext_mod->popup)
+          {
+             elm_object_scroll_freeze_push(ext_mod->popup);
+             _ctxpopup_position(obj);
+             evas_object_show(ext_mod->popup);
+          }
+     }
+   ext_mod->longpress_timer = NULL;
+}
 
 EAPI void
 obj_mouseup(Evas_Object *obj)
 {
-       if (!obj || !ext_mod) {
-               return;
-       }
+   if (!obj || !ext_mod) {
+        return;
+   }
 
-/*update*/
-       elm_entry_extension_module_data_get(obj,ext_mod);
+   /*update*/
+   elm_entry_extension_module_data_get(obj,ext_mod);
    if (ext_mod->longpress_timer)
      {    
-               if (ext_mod->have_selection )
-                       {                               
-                               _cancel(obj,ext_mod->popup,NULL);
-                       }
+        if (ext_mod->have_selection )
+          {
+             _cancel(obj,ext_mod->popup,NULL);
+          }
      }     
 }
 
@@ -272,12 +296,12 @@ obj_mouseup(Evas_Object *obj)
 EAPI void
 obj_hidemenu(Evas_Object *obj)
 {
-       if (!obj || !ext_mod) {
-               return;
-       }
+   if (!obj || !ext_mod) {
+        return;
+   }
 
-       evas_object_hide(ext_mod->popup);
-//     if (ext_mod->popup) evas_object_del(ext_mod->popup);
+   evas_object_hide(ext_mod->popup);
+   // if (ext_mod->popup) evas_object_del(ext_mod->popup);
 }