woohyun pushed a commit to branch master.

commit 9a64a3b46ead7e9010f02f9f5fcbd27e96648339
Author: WooHyun Jung <[email protected]>
Date:   Wed Apr 10 13:48:19 2013 +0900

    edje_entry.c: When cursor is located to each edge, entry now doesn't grab 
events for cursor movement.
---
 src/lib/edje/edje_entry.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 1dfe2cb..5f43d39 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -457,7 +457,7 @@ _curs_end(Evas_Textblock_Cursor *c, Evas_Object *o 
EINA_UNUSED, Entry *en EINA_U
    evas_textblock_cursor_paragraph_last(c);
 }
 
-static void
+static Eina_Bool
 _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
 {
    Evas_Coord cx, cy;
@@ -473,9 +473,9 @@ _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, 
Entry *en, int ln)
    _curs_update_from_curs(c, o, en, &cx, &cy);
 
    if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, 
&lh))
-     return;
+     return EINA_FALSE;
    if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
-     return;
+     return EINA_FALSE;
    evas_textblock_cursor_line_set(c, ln);
    if (cx < (lx + (lw / 2)))
      {
@@ -489,27 +489,28 @@ _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, 
Entry *en, int ln)
         else
           _curs_lin_end(c, o, en);
      }
+   return EINA_TRUE;
 }
 
-static void
+static Eina_Bool
 _curs_jump_line_by(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int by)
 {
    int ln;
 
    ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + 
by;
-   _curs_jump_line(c, o, en, ln);
+   return _curs_jump_line(c, o, en, ln);
 }
 
-static void
+static Eina_Bool
 _curs_up(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
 {
-   _curs_jump_line_by(c, o, en, -1);
+   return _curs_jump_line_by(c, o, en, -1);
 }
 
-static void
+static Eina_Bool
 _curs_down(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
 {
-   _curs_jump_line_by(c, o, en, 1);
+   return _curs_jump_line_by(c, o, en, 1);
 }
 
 static void
@@ -1348,13 +1349,13 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
                   if (shift) _sel_start(en->cursor, rp->object, en);
                   else _sel_clear(ed, en->cursor, rp->object, en);
                }
-             _curs_up(en->cursor, rp->object, en);
+             if (_curs_up(en->cursor, rp->object, en))
+               ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
              if (en->select_allow)
                {
                 if (shift) _sel_extend(ed, en->cursor, rp->object, en);
                   else _sel_clear(ed, en->cursor, rp->object, en);
                }
-             ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
           }
         _edje_emit(ed, "entry,key,up", rp->part->name);
         _edje_emit(ed, "cursor,changed,manual", rp->part->name);
@@ -1370,13 +1371,13 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
                   if (shift) _sel_start(en->cursor, rp->object, en);
                   else _sel_clear(ed, en->cursor, rp->object, en);
                }
-             _curs_down(en->cursor, rp->object, en);
+             if (_curs_down(en->cursor, rp->object, en))
+               ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
              if (en->select_allow)
                {
                 if (shift) _sel_extend(ed, en->cursor, rp->object, en);
                   else _sel_clear(ed, en->cursor, rp->object, en);
                }
-             ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
           }
         _edje_emit(ed, "entry,key,down", rp->part->name);
         _edje_emit(ed, "cursor,changed,manual", rp->part->name);
@@ -1390,7 +1391,8 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
             if (shift) _sel_start(en->cursor, rp->object, en);
              else _sel_clear(ed, en->cursor, rp->object, en);
           }
-        evas_textblock_cursor_char_prev(en->cursor);
+        if (evas_textblock_cursor_char_prev(en->cursor))
+          ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
         /* If control is pressed, go to the start of the word */
         if (control) evas_textblock_cursor_word_start(en->cursor);
         if (en->select_allow)
@@ -1400,7 +1402,6 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
           }
         _edje_emit(ed, "entry,key,left", rp->part->name);
         _edje_emit(ed, "cursor,changed,manual", rp->part->name);
-        ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
      }
    else if (!strcmp(ev->keyname, "Right") ||
             (!strcmp(ev->keyname, "KP_Right") && !ev->string))
@@ -1413,7 +1414,8 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
           }
         /* If control is pressed, go to the end of the word */
         if (control) evas_textblock_cursor_word_end(en->cursor);
-        evas_textblock_cursor_char_next(en->cursor);
+        if (evas_textblock_cursor_char_next(en->cursor))
+          ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
         if (en->select_allow)
           {
             if (shift) _sel_extend(ed, en->cursor, rp->object, en);
@@ -1421,7 +1423,6 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
           }
         _edje_emit(ed, "entry,key,right", rp->part->name);
         _edje_emit(ed, "cursor,changed,manual", rp->part->name);
-        ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
      }
    else if (!strcmp(ev->keyname, "BackSpace"))
      {

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to