scroller: apply key binding
authorJaeun Choi <jaeun12.choi@samsung.com>
Thu, 10 Apr 2014 08:10:00 +0000 (17:10 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 10 Apr 2014 08:10:00 +0000 (17:10 +0900)
Summary: This patch applies key binding to elm_scroller.

Test Plan: elementary_test > Scroller > check key events

Reviewers: Hermet, raster

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

config/default/base.src
config/mobile/base.src
config/standard/base.src
src/lib/elm_scroller.c

index 6268d1b..2b874ba 100644 (file)
@@ -661,5 +661,154 @@ group "Elm_Config" struct {
            }
         }
      }
+     group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Elm_Scroller";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Left";
+              value "action" string: "move";
+              value "params" string: "left";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Left";
+              value "action" string: "move";
+              value "params" string: "left";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Right";
+              value "action" string: "move";
+              value "params" string: "right";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Right";
+              value "action" string: "move";
+              value "params" string: "right";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Up";
+              value "action" string: "move";
+              value "params" string: "up";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Up";
+              value "action" string: "move";
+              value "params" string: "up";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Down";
+              value "action" string: "move";
+              value "params" string: "down";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Down";
+              value "action" string: "move";
+              value "params" string: "down";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Home";
+              value "action" string: "move";
+              value "params" string: "first";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Home";
+              value "action" string: "move";
+              value "params" string: "first";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "End";
+              value "action" string: "move";
+              value "params" string: "last";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_End";
+              value "action" string: "move";
+              value "params" string: "last";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Prior";
+              value "action" string: "move";
+              value "params" string: "prior";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Prior";
+              value "action" string: "move";
+              value "params" string: "prior";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Next";
+              value "action" string: "move";
+              value "params" string: "next";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Next";
+              value "action" string: "move";
+              value "params" string: "next";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+        }
+     }
   }
 }
index bd4361a..5d77e00 100644 (file)
@@ -665,5 +665,154 @@ group "Elm_Config" struct {
            }
         }
      }
+     group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Elm_Scroller";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Left";
+              value "action" string: "move";
+              value "params" string: "left";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Left";
+              value "action" string: "move";
+              value "params" string: "left";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Right";
+              value "action" string: "move";
+              value "params" string: "right";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Right";
+              value "action" string: "move";
+              value "params" string: "right";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Up";
+              value "action" string: "move";
+              value "params" string: "up";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Up";
+              value "action" string: "move";
+              value "params" string: "up";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Down";
+              value "action" string: "move";
+              value "params" string: "down";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Down";
+              value "action" string: "move";
+              value "params" string: "down";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Home";
+              value "action" string: "move";
+              value "params" string: "first";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Home";
+              value "action" string: "move";
+              value "params" string: "first";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "End";
+              value "action" string: "move";
+              value "params" string: "last";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_End";
+              value "action" string: "move";
+              value "params" string: "last";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Prior";
+              value "action" string: "move";
+              value "params" string: "prior";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Prior";
+              value "action" string: "move";
+              value "params" string: "prior";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Next";
+              value "action" string: "move";
+              value "params" string: "next";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Next";
+              value "action" string: "move";
+              value "params" string: "next";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+        }
+     }
   }
 }
index 0cf27eb..5f53394 100644 (file)
@@ -662,5 +662,154 @@ group "Elm_Config" struct {
            }
         }
      }
+     group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Elm_Scroller";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Left";
+              value "action" string: "move";
+              value "params" string: "left";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Left";
+              value "action" string: "move";
+              value "params" string: "left";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Right";
+              value "action" string: "move";
+              value "params" string: "right";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Right";
+              value "action" string: "move";
+              value "params" string: "right";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Up";
+              value "action" string: "move";
+              value "params" string: "up";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Up";
+              value "action" string: "move";
+              value "params" string: "up";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Down";
+              value "action" string: "move";
+              value "params" string: "down";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Down";
+              value "action" string: "move";
+              value "params" string: "down";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Home";
+              value "action" string: "move";
+              value "params" string: "first";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Home";
+              value "action" string: "move";
+              value "params" string: "first";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "End";
+              value "action" string: "move";
+              value "params" string: "last";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_End";
+              value "action" string: "move";
+              value "params" string: "last";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Prior";
+              value "action" string: "move";
+              value "params" string: "prior";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Prior";
+              value "action" string: "move";
+              value "params" string: "prior";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "Next";
+              value "action" string: "move";
+              value "params" string: "next";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 0;
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "modifiers" string: "None";
+              value "key" string: "KP_Next";
+              value "action" string: "move";
+              value "params" string: "next";
+              value "any_mod" uchar: 1;
+              value "no_string" uchar: 1;
+           }
+        }
+     }
   }
 }
index 71ff35a..edc1daf 100644 (file)
@@ -46,12 +46,18 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
 };
 #undef ELM_PRIV_SCROLLER_SIGNALS
 
-EOLIAN static Eina_Bool
-_elm_scroller_elm_widget_event(Eo *obj, Elm_Scroller_Data *sd, Evas_Object *src, Evas_Callback_Type type, void *event_info)
-{
-   (void) src;
-   Evas_Event_Key_Down *ev = event_info;
+static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
+
+static const Elm_Action key_actions[] = {
+   {"move", _key_action_move},
+   {NULL, NULL}
+};
 
+static Eina_Bool
+_key_action_move(Evas_Object *obj, const char *params)
+{
+   ELM_SCROLLER_DATA_GET(obj, sd);
+   const char *dir = params;
    Evas_Coord x = 0;
    Evas_Coord y = 0;
    Evas_Coord c_x = 0;
@@ -64,10 +70,13 @@ _elm_scroller_elm_widget_event(Eo *obj, Elm_Scroller_Data *sd, Evas_Object *src,
    Evas_Coord page_y = 0;
    Evas_Coord step_x = 0;
    Evas_Coord step_y = 0;
-
-   if (elm_widget_disabled_get(obj)) return EINA_FALSE;
-   if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
-   if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
+   Evas_Object *current_focus = NULL;
+   Eina_List *can_focus_list = NULL;
+   Evas_Object *new_focus = NULL;
+   Evas_Coord f_x = 0;
+   Evas_Coord f_y = 0;
+   Evas_Coord f_w = 0;
+   Evas_Coord f_h = 0;
 
    eo_do(obj,
          elm_interface_scrollable_content_pos_get(&x, &y),
@@ -78,150 +87,118 @@ _elm_scroller_elm_widget_event(Eo *obj, Elm_Scroller_Data *sd, Evas_Object *src,
          evas_obj_position_get(&c_x, &c_y),
          evas_obj_size_get(&max_x, &max_y));
 
-   if (((!strcmp(ev->key, "Left")) ||
-        (!strcmp(ev->key, "KP_Left")) ||
-        (!strcmp(ev->key, "Right")) ||
-        (!strcmp(ev->key, "KP_Right")) ||
-        (!strcmp(ev->key, "Up")) ||
-        (!strcmp(ev->key, "KP_Up")) ||
-        (!strcmp(ev->key, "Down")) ||
-        (!strcmp(ev->key, "KP_Down"))) && (!ev->string))
+   current_focus = elm_widget_focused_object_get(obj);
+   evas_object_geometry_get(current_focus, &f_x, &f_y, &f_w, &f_h);
+   can_focus_list = elm_widget_can_focus_child_list_get(obj);
+
+   if ((current_focus == obj) ||
+       (!ELM_RECTS_INTERSECT
+        (x, y, v_w, v_h, (f_x - c_x), (f_y - c_y), f_w, f_h)))
      {
-        Evas_Object *current_focus = NULL;
-        Eina_List *can_focus_list = NULL;
-        Evas_Object *new_focus = NULL;
-        Evas_Coord f_x = 0;
-        Evas_Coord f_y = 0;
-        Evas_Coord f_w = 0;
-        Evas_Coord f_h = 0;
-
-        current_focus = elm_widget_focused_object_get(obj);
-        evas_object_geometry_get(current_focus, &f_x, &f_y, &f_w, &f_h);
-        can_focus_list = elm_widget_can_focus_child_list_get(obj);
-        if ((current_focus == obj) ||
-            (!ELM_RECTS_INTERSECT
-               (x, y, v_w, v_h, (f_x - c_x), (f_y - c_y), f_w, f_h)))
+        Eina_List *l;
+        Evas_Object *cur;
+        double weight = 0.0;
+
+        EINA_LIST_FOREACH(can_focus_list, l, cur)
           {
-             Eina_List *l;
-             Evas_Object *cur;
-             double weight = 0.0;
+             double cur_weight = 0.0;
 
-             EINA_LIST_FOREACH(can_focus_list, l, cur)
+             evas_object_geometry_get(cur, &f_x, &f_y, &f_w, &f_h);
+             if (ELM_RECTS_INTERSECT
+                 (x, y, v_w, v_h, (f_x - c_x), (f_y - c_y), f_w, f_h))
                {
-                  double cur_weight = 0.0;
-
-                  evas_object_geometry_get(cur, &f_x, &f_y, &f_w, &f_h);
-                  if (ELM_RECTS_INTERSECT
-                        (x, y, v_w, v_h, (f_x - c_x), (f_y - c_y), f_w, f_h))
+                  if ((f_x - c_x) > x)
+                    cur_weight += ((f_x - c_x) - x) * ((f_x - c_x) - x);
+                  if ((f_y - c_y) > y)
+                    cur_weight += ((f_y - c_y) - y) * ((f_y - c_y) - y);
+                  if (cur_weight == 0.0)
                     {
-                       if ((f_x - c_x) > x)
-                         cur_weight += ((f_x - c_x) - x) * ((f_x - c_x) - x);
-                       if ((f_y - c_y) > y)
-                         cur_weight += ((f_y - c_y) - y) * ((f_y - c_y) - y);
-                       if (cur_weight == 0.0)
-                         {
-                            elm_widget_focus_steal(cur);
-                            ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
-                            return EINA_TRUE;
-                         }
-                       cur_weight = 1.0 / cur_weight;
-                       if (cur_weight > weight)
-                         {
-                            new_focus = cur;
-                            weight = cur_weight;
-                         }
+                       elm_widget_focus_steal(cur);
+                       return EINA_TRUE;
+                    }
+                  cur_weight = 1.0 / cur_weight;
+                  if (cur_weight > weight)
+                    {
+                       new_focus = cur;
+                       weight = cur_weight;
                     }
-               }
-             if (new_focus)
-               {
-                  elm_widget_focus_steal(new_focus);
-                  ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
-                  return EINA_TRUE;
                }
           }
-        else
+        if (new_focus)
           {
-             Eina_Bool r = EINA_FALSE;
-
-             if ((!strcmp(ev->key, "Left")) ||
-                 (!strcmp(ev->key, "KP_Left")))
-               r = elm_widget_focus_next_get(obj, ELM_FOCUS_LEFT, &new_focus);
-             else if ((!strcmp(ev->key, "Right")) ||
-                      (!strcmp(ev->key, "KP_Right")))
-               r = elm_widget_focus_next_get(obj, ELM_FOCUS_RIGHT, &new_focus);
-             else if ((!strcmp(ev->key, "Up")) ||
-                      (!strcmp(ev->key, "KP_Up")))
-               r = elm_widget_focus_next_get(obj, ELM_FOCUS_UP, &new_focus);
-             else if ((!strcmp(ev->key, "Down")) ||
-                      (!strcmp(ev->key, "KP_Down")))
-               r = elm_widget_focus_next_get(obj, ELM_FOCUS_DOWN, &new_focus);
-
-             if (r && new_focus)
+             elm_widget_focus_steal(new_focus);
+             return EINA_TRUE;
+          }
+     }
+   else
+     {
+        Eina_Bool r = EINA_FALSE;
+
+        if (!strcmp(dir, "left"))
+          r = elm_widget_focus_next_get(obj, ELM_FOCUS_LEFT, &new_focus);
+        else if (!strcmp(dir, "right"))
+          r = elm_widget_focus_next_get(obj, ELM_FOCUS_RIGHT, &new_focus);
+        else if (!strcmp(dir, "up"))
+          r = elm_widget_focus_next_get(obj, ELM_FOCUS_UP, &new_focus);
+        else if (!strcmp(dir, "down"))
+          r = elm_widget_focus_next_get(obj, ELM_FOCUS_DOWN, &new_focus);
+
+        if (r && new_focus)
+          {
+             Evas_Coord l_x = 0;
+             Evas_Coord l_y = 0;
+             Evas_Coord l_w = 0;
+             Evas_Coord l_h = 0;
+
+             evas_object_geometry_get(new_focus, &f_x, &f_y, &f_w, &f_h);
+             l_x = f_x - c_x - step_x;
+             l_y = f_y - c_y - step_y;
+             l_w = f_w + (step_x * 2);
+             l_h = f_h + (step_y * 2);
+
+             if (ELM_RECTS_INTERSECT(x, y, v_w, v_h, l_x, l_y, l_w, l_h))
                {
-                  Evas_Coord l_x = 0;
-                  Evas_Coord l_y = 0;
-                  Evas_Coord l_w = 0;
-                  Evas_Coord l_h = 0;
-
-                  evas_object_geometry_get(new_focus, &f_x, &f_y, &f_w, &f_h);
-                  l_x = f_x - c_x - step_x;
-                  l_y = f_y - c_y - step_y;
-                  l_w = f_w + (step_x * 2);
-                  l_h = f_h + (step_y * 2);
-
-                  if (ELM_RECTS_INTERSECT(x, y, v_w, v_h, l_x, l_y, l_w, l_h))
-                    {
-                       elm_widget_focus_steal(new_focus);
-                       ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
-                       return EINA_TRUE;
-                    }
+                  elm_widget_focus_steal(new_focus);
+                  return EINA_TRUE;
                }
           }
      }
-   if ((!strcmp(ev->key, "Left")) ||
-       ((!strcmp(ev->key, "KP_Left")) && (!ev->string)))
+   if (!strcmp(dir, "left"))
      {
         if (x <= 0) return EINA_FALSE;
         x -= step_x;
      }
-   else if ((!strcmp(ev->key, "Right")) ||
-            ((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
+   else if (!strcmp(dir, "right"))
      {
         if (x >= (max_x - v_w)) return EINA_FALSE;
         x += step_x;
      }
-   else if ((!strcmp(ev->key, "Up")) ||
-            ((!strcmp(ev->key, "KP_Up")) && (!ev->string)))
+   else if (!strcmp(dir, "up"))
      {
         if (y == 0) return EINA_FALSE;
         y -= step_y;
      }
-   else if ((!strcmp(ev->key, "Down")) ||
-            ((!strcmp(ev->key, "KP_Down")) && (!ev->string)))
+   else if (!strcmp(dir, "down"))
      {
         if (y >= (max_y - v_h)) return EINA_FALSE;
         y += step_y;
      }
-   else if ((!strcmp(ev->key, "Home")) ||
-            ((!strcmp(ev->key, "KP_Home")) && (!ev->string)))
+   else if (!strcmp(dir, "first"))
      {
         y = 0;
      }
-   else if ((!strcmp(ev->key, "End")) ||
-            ((!strcmp(ev->key, "KP_End")) && (!ev->string)))
+   else if (!strcmp(dir, "last"))
      {
         y = max_y - v_h;
      }
-   else if ((!strcmp(ev->key, "Prior")) ||
-            ((!strcmp(ev->key, "KP_Prior")) && (!ev->string)))
+   else if (!strcmp(dir, "prior"))
      {
         if (page_y < 0)
           y -= -(page_y * v_h) / 100;
         else
           y -= page_y;
      }
-   else if ((!strcmp(ev->key, "Next")) ||
-            ((!strcmp(ev->key, "KP_Next")) && (!ev->string)))
+   else if (!strcmp(dir, "next"))
      {
         if (page_y < 0)
           y += -(page_y * v_h) / 100;
@@ -230,9 +207,24 @@ _elm_scroller_elm_widget_event(Eo *obj, Elm_Scroller_Data *sd, Evas_Object *src,
      }
    else return EINA_FALSE;
 
-   ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
    eo_do(obj, elm_interface_scrollable_content_pos_set(x, y, EINA_TRUE));
+   return EINA_TRUE;
+}
 
+EOLIAN static Eina_Bool
+_elm_scroller_elm_widget_event(Eo *obj, Elm_Scroller_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
+{
+   (void) src;
+   Evas_Event_Key_Down *ev = event_info;
+
+   if (elm_widget_disabled_get(obj)) return EINA_FALSE;
+   if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
+   if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
+
+   if (!_elm_config_key_binding_call(obj, ev, key_actions))
+     return EINA_FALSE;
+
+   ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
    return EINA_TRUE;
 }