diff --git a/data/elementary/objects/test.edc b/data/elementary/objects/test.edc index 3b665e13f9..fa7c835d30 100644 --- a/data/elementary/objects/test.edc +++ b/data/elementary/objects/test.edc @@ -800,6 +800,16 @@ group { name: "page_layout"; description { state: "default" 0.0; rel1.relative: 0.4 0.6; rel1.to:"bg"; + rel2.relative: 0.6 0.7; + rel2.to:"bg"; + } + } + part { name: "element3"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + rel1.relative: 0.4 0.7; + rel1.to:"bg"; rel2.relative: 0.6 0.8; rel2.to:"bg"; } diff --git a/src/bin/elementary/test_entry.c b/src/bin/elementary/test_entry.c index c56e093be2..04003a8d15 100644 --- a/src/bin/elementary/test_entry.c +++ b/src/bin/elementary/test_entry.c @@ -684,6 +684,44 @@ test_entry_scrolled(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void * evas_object_show(win); } +static void +my_pop_close_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *btn, *pop, *en; + pop = data; + en = elm_object_parent_widget_get(pop); + elm_object_text_set(en, "This is very long text," + " it is longer than width of this page." + " So if scroller is moved to next page," + " that is bug when you click under button" + " and then click this entry text"); + elm_entry_cursor_end_set(en); + + evas_object_del(pop); +} + +static void +my_pop_bt_clr(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *pop, *btn, *en; + en = data; + elm_object_text_set(en, ""); + elm_entry_cursor_end_set(en); + + pop = elm_popup_add(en); + elm_object_text_set(pop, "If you click confirm, " + "set long text to entry " + "and delete popup obj"); + + btn = elm_button_add(pop); + elm_object_text_set(btn, "Confirm"); + evas_object_smart_callback_add(btn, "clicked", my_pop_close_cb, pop); + elm_object_part_content_set(pop, "button1", btn); + + evas_object_show(btn); + evas_object_show(pop); +} + static void my_en_bt_clr(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -722,7 +760,11 @@ test_entry_on_page_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, en = elm_entry_add(ly); elm_object_part_text_set(en, "guide", "Entry area"); - elm_object_text_set(en, "This is very long text, it is longer than width of this page. So if scroller is moved to next page, that is bug when you click under button and then click this entry text"); + elm_object_text_set(en, "This is very long text," + " it is longer than width of this page." + " So if scroller is moved to next page," + " that is bug when you click under button" + " and then click this entry text"); elm_object_part_content_set(ly, "element1", en); elm_entry_scrollable_set(en, EINA_TRUE); elm_entry_single_line_set(en, EINA_TRUE); @@ -735,6 +777,13 @@ test_entry_on_page_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, evas_object_show(btn); elm_object_focus_set(btn, EINA_TRUE); + btn = elm_button_add(ly); + elm_object_text_set(btn, "Click this and close popup"); + elm_object_part_content_set(ly, "element3", btn); + evas_object_smart_callback_add(btn, "clicked", my_pop_bt_clr, en); + evas_object_show(btn); + elm_object_focus_set(btn, EINA_TRUE); + elm_object_part_text_set(ly, "text", "Page1"); elm_box_pack_end(bx, ly); evas_object_show(ly); diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 0c5e25c7b2..28655eafa6 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -1276,25 +1276,39 @@ _elm_entry_elm_widget_on_focus(Eo *obj, Elm_Entry_Data *sd, Elm_Object_Item *ite } EOLIAN static Eina_Bool -_elm_entry_elm_widget_on_focus_region(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +_elm_entry_elm_widget_on_focus_region(Eo *obj, Elm_Entry_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) { - Evas_Coord edje_x, edje_y, elm_x, elm_y; + Evas_Coord cx, cy, cw, ch; + Evas_Coord edx, edy; + Evas_Coord elx, ely, elw, elh; edje_object_part_text_cursor_geometry_get - (sd->entry_edje, "elm.text", x, y, w, h); + (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch); if (sd->single_line) { - evas_object_geometry_get(sd->entry_edje, NULL, NULL, NULL, h); - if (y) *y = 0; + evas_object_geometry_get(sd->entry_edje, &edx, &edy, NULL, &ch); + cy = 0; } + else + { + evas_object_geometry_get(sd->entry_edje, &edx, &edy, NULL, NULL); + } + evas_object_geometry_get(obj, &elx, &ely, &elw, &elh); - evas_object_geometry_get(sd->entry_edje, &edje_x, &edje_y, NULL, NULL); + if (x) + { + *x = cx + edx - elx; + if ((cw < elw) && (*x + cw > elw)) *x = elw - cw; + } + if (y) + { + *y = cy + edy - ely; + if ((ch < elh) && (*y + ch > elh)) *y = elh - ch; + } + if (w) *w = cw; + if (h) *h = ch; - evas_object_geometry_get(obj, &elm_x, &elm_y, NULL, NULL); - - if (x) *x += edje_x - elm_x; - if (y) *y += edje_y - elm_y; return EINA_TRUE; }