hermet pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=305966c08da8ac95922b2672a8adbe30db1d835b

commit 305966c08da8ac95922b2672a8adbe30db1d835b
Author: Jaeun Choi <jaeun12.c...@samsung.com>
Date:   Tue Apr 15 14:49:35 2014 +0900

    image: apply key binding
    
    Summary: This patch applies key binding to elm_image.
    
    Test Plan: None
    
    Reviewers: Hermet, raster
    
    Reviewed By: Hermet
    
    Differential Revision: https://phab.enlightenment.org/D732
---
 config/default/base.src  | 23 +++++++++++++++++++++++
 config/mobile/base.src   | 23 +++++++++++++++++++++++
 config/standard/base.src | 23 +++++++++++++++++++++++
 src/lib/elm_image.c      | 24 ++++++++++++++----------
 4 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/config/default/base.src b/config/default/base.src
index f3729f4..0de169c 100644
--- a/config/default/base.src
+++ b/config/default/base.src
@@ -655,6 +655,29 @@ group "Elm_Config" struct {
         }
      }
      group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Elm_Image";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+        }
+     }
+     group "Elm_Config_Bindings_Widget" struct {
         value "name" string: "Elm_List";
         group "key_bindings" list {
            group "Elm_Config_Binding_Key" struct {
diff --git a/config/mobile/base.src b/config/mobile/base.src
index b3c7c62..a308a28 100644
--- a/config/mobile/base.src
+++ b/config/mobile/base.src
@@ -659,6 +659,29 @@ group "Elm_Config" struct {
         }
      }
      group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Elm_Image";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+        }
+     }
+     group "Elm_Config_Bindings_Widget" struct {
         value "name" string: "Elm_List";
         group "key_bindings" list {
            group "Elm_Config_Binding_Key" struct {
diff --git a/config/standard/base.src b/config/standard/base.src
index 0c7d55e..d44ebf4 100644
--- a/config/standard/base.src
+++ b/config/standard/base.src
@@ -656,6 +656,29 @@ group "Elm_Config" struct {
         }
      }
      group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Elm_Image";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "activate";
+              value "params" string: "";
+           }
+        }
+     }
+     group "Elm_Config_Bindings_Widget" struct {
         value "name" string: "Elm_List";
         group "key_bindings" list {
            group "Elm_Config_Binding_Key" struct {
diff --git a/src/lib/elm_image.c b/src/lib/elm_image.c
index e6bf021..5681f49 100644
--- a/src/lib/elm_image.c
+++ b/src/lib/elm_image.c
@@ -29,11 +29,12 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = 
{
    {NULL, NULL}
 };
 
-static void
-_activate(Evas_Object *obj)
-{
-   evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
-}
+static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
+
+static const Elm_Action key_actions[] = {
+   {"activate", _key_action_activate},
+   {NULL, NULL}
+};
 
 static void
 _on_image_preloaded(void *data,
@@ -560,6 +561,13 @@ _elm_image_elm_widget_theme_apply(Eo *obj, Elm_Image_Data 
*sd EINA_UNUSED)
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
+{
+   evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
+   return EINA_TRUE;
+}
+
 EOLIAN static Eina_Bool
 _elm_image_elm_widget_event(Eo *obj, Elm_Image_Data *_pd EINA_UNUSED, 
Evas_Object *src, Evas_Callback_Type type, void *event_info)
 {
@@ -570,13 +578,9 @@ _elm_image_elm_widget_event(Eo *obj, Elm_Image_Data *_pd 
EINA_UNUSED, Evas_Objec
    if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
 
-   if ((strcmp(ev->key, "Return")) &&
-       (strcmp(ev->key, "KP_Enter")) &&
-       (strcmp(ev->key, "space")))
+   if (!_elm_config_key_binding_call(obj, ev, key_actions))
      return EINA_FALSE;
 
-   _activate(obj);
-
    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
    return EINA_TRUE;
 }

-- 


Reply via email to