Edje entry: Do not update cursor for non editable entry.
authorSubodh Kumar <s7158.kumar@samsung.com>
Tue, 5 Jan 2016 14:30:20 +0000 (14:30 +0000)
committerTom Hacohen <tom@stosb.com>
Tue, 5 Jan 2016 14:30:21 +0000 (14:30 +0000)
Summary:
Do not update cursor for non editable entry.

If entry is not editable there must not be any need to query tb cursor
geometry and run other codes related to it. This may improve some
performance of non-editable entry.

Test Plan: NA

Reviewers: tasn, herdsman, thiepha

Subscribers: shilpasingh, cedric, jpeg

Projects: #efl

Differential Revision: https://phab.enlightenment.org/D3532

src/lib/edje/edje_entry.c

index 9b9d194..54fd3a8 100644 (file)
@@ -2719,50 +2719,52 @@ _edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp)
        (!rp->typedata.text)) return;
    en = rp->typedata.text->entry_data;
    if (!en) return;
-   switch (rp->part->cursor_mode)
-     {
-      case EDJE_ENTRY_CURSOR_MODE_BEFORE:
-        cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
-        break;
-
-      case EDJE_ENTRY_CURSOR_MODE_UNDER:
-      /* no break for a reason */
-      default:
-        cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
-     }
 
    _sel_update(ed, en->cursor, rp->object, en);
    _anchors_update_check(ed, rp);
-   x = y = w = h = -1;
-   xx = yy = ww = hh = -1;
-   evas_object_geometry_get(rp->object, &x, &y, &w, &h);
-   bidi_cursor = evas_textblock_cursor_geometry_bidi_get(en->cursor, &xx, &yy, &ww, &hh, &xx2, &yy2, NULL, NULL, cur_type);
-   if (ww < 1) ww = 1;
-   if (hh < 1) hh = 1;
-   if (en->cursor_bg)
-     {
-        evas_object_move(en->cursor_bg, x + xx, y + yy);
-        evas_object_resize(en->cursor_bg, ww, hh);
-     }
-   if (en->cursor_fg)
-     {
-        evas_object_move(en->cursor_fg, x + xx, y + yy);
-        evas_object_resize(en->cursor_fg, ww, hh);
-     }
-   if (en->cursor_fg2)
+   if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
      {
-        if (bidi_cursor)
+        switch (rp->part->cursor_mode)
+         {
+           case EDJE_ENTRY_CURSOR_MODE_BEFORE:
+              cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
+            break;
+
+           case EDJE_ENTRY_CURSOR_MODE_UNDER:
+          /* no break for a reason */
+           default:
+             cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
+         }
+        x = y = w = h = -1;
+        xx = yy = ww = hh = -1;
+        evas_object_geometry_get(rp->object, &x, &y, &w, &h);
+        bidi_cursor = evas_textblock_cursor_geometry_bidi_get(en->cursor, &xx, &yy, &ww, &hh, &xx2, &yy2, NULL, NULL, cur_type);
+        if (ww < 1) ww = 1;
+        if (hh < 1) hh = 1;
+        if (en->cursor_bg)
           {
-             evas_object_image_fill_set(en->cursor_fg2, 0, 0, ww, hh / 2);
-             evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2));
-             evas_object_resize(en->cursor_fg, ww, hh / 2);
-             evas_object_resize(en->cursor_fg2, ww, hh / 2);
-
-             evas_object_show(en->cursor_fg2);
+             evas_object_move(en->cursor_bg, x + xx, y + yy);
+             evas_object_resize(en->cursor_bg, ww, hh);
           }
-        else
+        if (en->cursor_fg)
           {
-             evas_object_hide(en->cursor_fg2);
+             evas_object_move(en->cursor_fg, x + xx, y + yy);
+             evas_object_resize(en->cursor_fg, ww, hh);
+          }
+        if (en->cursor_fg2)
+          {
+             if (bidi_cursor)
+               {
+                  evas_object_image_fill_set(en->cursor_fg2, 0, 0, ww, hh / 2);
+                  evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2));
+                  evas_object_resize(en->cursor_fg, ww, hh / 2);
+                  evas_object_resize(en->cursor_fg2, ww, hh / 2);
+                  evas_object_show(en->cursor_fg2);
+               }
+             else
+               {
+                  evas_object_hide(en->cursor_fg2);
+               }
           }
      }
 }