cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=6cff30bcae1e76ea3bf69428c7cc1c6054275aa8

commit 6cff30bcae1e76ea3bf69428c7cc1c6054275aa8
Author: Lukasz Stanislawski <l.stanisl...@samsung.com>
Date:   Wed Jul 29 22:23:00 2015 +0200

    hoversel: add key binding for widget activation
    
    Test Plan:
    1. Install previous version of elementary
    2. Remove config from homedir
    3. Build new config with elemetnary_config app
    4. Install patched version of elementary
    5. run elementary_test Hoversel test
    6. Space end Enter should open hovesel
    
    Reviewers: seoz, jaehwan, singh.amitesh, cedric
    
    Reviewed By: cedric
    
    Subscribers: seoz
    
    Differential Revision: https://phab.enlightenment.org/D2787
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 config/default/base.src.in  | 20 +++++++++++++++++++-
 config/mobile/base.src.in   | 20 +++++++++++++++++++-
 config/standard/base.src.in | 20 +++++++++++++++++++-
 src/lib/elc_hoversel.c      | 10 ++++++++++
 src/lib/elm_config.c        | 27 +++++++++++++++++++++++++++
 src/lib/elm_priv.h          |  2 +-
 6 files changed, 95 insertions(+), 4 deletions(-)

diff --git a/config/default/base.src.in b/config/default/base.src.in
index 40550d8..10257ee 100644
--- a/config/default/base.src.in
+++ b/config/default/base.src.in
@@ -1,5 +1,5 @@
 group "Elm_Config" struct {
-  value "config_version" int: 131075;
+  value "config_version" int: 131076;
   value "engine" string: "";
   value "vsync" uchar: 0;
   value "thumbscroll_enable" uchar: 1;
@@ -411,6 +411,24 @@ group "Elm_Config" struct {
               value "action" string: "move";
               value "params" string: "down";
            }
+           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: "Return";
+              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 {
diff --git a/config/mobile/base.src.in b/config/mobile/base.src.in
index 772aca0..c18e2db 100644
--- a/config/mobile/base.src.in
+++ b/config/mobile/base.src.in
@@ -1,5 +1,5 @@
 group "Elm_Config" struct {
-  value "config_version" int: 131075;
+  value "config_version" int: 131076;
   value "engine" string: "";
   value "vsync" uchar: 0;
   value "thumbscroll_enable" uchar: 1;
@@ -415,6 +415,24 @@ group "Elm_Config" struct {
               value "action" string: "move";
               value "params" string: "down";
            }
+           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: "Return";
+              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 {
diff --git a/config/standard/base.src.in b/config/standard/base.src.in
index af5ab67..3f4c0a5 100644
--- a/config/standard/base.src.in
+++ b/config/standard/base.src.in
@@ -1,5 +1,5 @@
 group "Elm_Config" struct {
-  value "config_version" int: 131075;
+  value "config_version" int: 131076;
   value "engine" string: "";
   value "vsync" uchar: 0;
   value "thumbscroll_enable" uchar: 0;
@@ -412,6 +412,24 @@ group "Elm_Config" struct {
               value "action" string: "move";
               value "params" string: "down";
            }
+           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: "Return";
+              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 {
diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c
index d49dce2..9be75c2 100644
--- a/src/lib/elc_hoversel.c
+++ b/src/lib/elc_hoversel.c
@@ -34,9 +34,11 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
 };
 
 static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
+static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
 
 static const Elm_Action key_actions[] = {
    {"move", _key_action_move},
+   {"activate", _key_action_activate},
    {NULL, NULL}
 };
 
@@ -602,6 +604,13 @@ _key_action_move(Evas_Object *obj, const char *params)
    else return EINA_FALSE;
 }
 
+static Eina_Bool
+_key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
+{
+   _activate(obj);
+   return EINA_TRUE;
+}
+
 EOLIAN static Eina_Bool
 _elm_hoversel_elm_widget_event(Eo *obj, Elm_Hoversel_Data *sd, Evas_Object 
*src, Evas_Callback_Type type, void *event_info)
 {
@@ -633,6 +642,7 @@ EOLIAN const Elm_Atspi_Action *
 _elm_hoversel_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj 
EINA_UNUSED, Elm_Hoversel_Data *pd EINA_UNUSED)
 {
    static Elm_Atspi_Action atspi_actions[] = {
+          { "activate", "activate", NULL, _key_action_activate},
           { "move,up", "move", "up", _key_action_move},
           { "move,down", "move", "down", _key_action_move},
           { "move,left", "move", "left", _key_action_move},
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 7349a3c..8a355aa 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -1752,6 +1752,33 @@ _config_update(void)
    _elm_config->transition_duration_factor = tcfg->transition_duration_factor;
    IFCFGEND
 
+   IFCFG(0x0004)
+   Elm_Config_Bindings_Widget *wb, *twb = NULL;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(tcfg->bindings, l, wb)
+     {
+        if (wb->name && !strcmp(wb->name, "Elm_Hoversel"))
+          {
+             twb = wb;
+             break;
+          }
+     }
+   if (twb)
+     {
+        EINA_LIST_FOREACH(_elm_config->bindings, l, wb)
+           {
+              if (wb->name && !strcmp(wb->name, "Elm_Hoversel"))
+                {
+                   // simply swap bindngs for Elm_Hoversel with system ones
+                   Eina_List *tmp = wb->key_bindings;
+                   wb->key_bindings = twb->key_bindings;
+                   twb->key_bindings = tmp;
+                   break;
+                }
+           }
+     }
+   IFCFGEND
    /**
     * Fix user config for current ELM_CONFIG_EPOCH here.
     **/
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 04ba306..c9a641b 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -123,7 +123,7 @@ struct _Elm_Theme
  * the users config doesn't need to be wiped - simply new values need
  * to be put in
  */
-#define ELM_CONFIG_FILE_GENERATION 0x0003
+#define ELM_CONFIG_FILE_GENERATION 0x0004
 #define ELM_CONFIG_VERSION_EPOCH_OFFSET 16
 #define ELM_CONFIG_VERSION         ((ELM_CONFIG_EPOCH << 
ELM_CONFIG_VERSION_EPOCH_OFFSET) | \
                                     ELM_CONFIG_FILE_GENERATION)

-- 


Reply via email to