entry: fix scroll region jumping issue
authorYoungbok Shin <youngb.shin@samsung.com>
Thu, 10 Nov 2016 08:45:49 +0000 (17:45 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 29 Nov 2016 12:32:29 +0000 (21:32 +0900)
When elm_entry takes focus by mouse clicked,
scroll region should be decided by new cursor position.

1. *_on_focus_region
   *_on_focus_region will be called before updating cursor position.
   So, elm_entry need to predict cursor position by mouse down and move.

2. _show_region_hook
   The geometry from elm_widget_show_region_get() is not proper when
   the hook function is called. We need to get cursor's geometry everytime.
   Becasue, the geometry is relative. Whenever scroll region updated,
   the geometry also has to be updated.

* dependancy warrning :
  - efl
  "edje entry: keep cursor position on mouse down and move"
  https://review.tizen.org/gerrit/#/c/96783/

@tizen_fix

Change-Id: I5c74b95de32701088a9031423939ce23909c4956

src/lib/elm_entry.c

index 7e28816..7ba0fc1 100644 (file)
@@ -2289,8 +2289,13 @@ _elm_entry_elm_widget_on_focus_region(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, E
    Evas_Coord edx, edy;
    Evas_Coord elx, ely, elw, elh;
 
+   /* TIZEN_ONLY(20161110): fix scroll region jumping issue
    edje_object_part_text_cursor_geometry_get
      (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
+    */
+   edje_object_part_text_cursor_on_mouse_geometry_get
+     (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
+   /* END */
 
    if (sd->single_line)
      {
@@ -2326,7 +2331,14 @@ _show_region_hook(void *data EINA_UNUSED,
 {
    Evas_Coord x, y, w, h;
 
+   /* TIZEN_ONLY(20161110): fix scroll region jumping issue
    elm_widget_show_region_get(obj, &x, &y, &w, &h);
+    */
+   ELM_ENTRY_DATA_GET(obj, sd);
+
+   edje_object_part_text_cursor_geometry_get
+     (sd->entry_edje, "elm.text", &x, &y, &w, &h);
+   /* END */
 
    eo_do(obj, elm_interface_scrollable_content_region_show(x, y, w, h));
 }