hoversel: add key binding for widget activation
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 29 Jul 2015 20:23:00 +0000 (22:23 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 4 Aug 2015 13:21:39 +0000 (15:21 +0200)
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 <cedric@osg.samsung.com>
config/default/base.src.in
config/mobile/base.src.in
config/standard/base.src.in
src/lib/elc_hoversel.c
src/lib/elm_config.c
src/lib/elm_priv.h

index 40550d8fe0051fa71e7024410d60a3f640d55bad..10257ee6bcdbd6805e645ab64be54255c61622a2 100644 (file)
@@ -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 {
index 772aca06ad581dc8a0a8f93d658834129f9f013f..c18e2db234df8e866b45959baae40ed25aefbbaf 100644 (file)
@@ -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 {
index af5ab67488b01c181a3e074a02ddd8662bf9d3e0..3f4c0a5262c53ecd926d8b3152a59ba883fee182 100644 (file)
@@ -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 {
index d49dce2b11baf3147adbf36c55ab3e5a3dfb3af0..9be75c2dc204f7c9a60d81e6d582bf59865fca8b 100644 (file)
@@ -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},
index 7349a3c6490e0792a52e7c424f3a269a3428763f..8a355aa3380ff78e4ae47fcb5cf3b7aa0bd0de5e 100644 (file)
@@ -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.
     **/
index 04ba3062c90d1ea4753a7b22dd8d3adaf0b2f35f..c9a641b21a89c1c4c020384393560d94d001d38a 100644 (file)
@@ -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)