eunue pushed a commit to branch elementary-1.13.

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

commit a207d2fda8a789d8fcf572a1afa7069fe2a331e7
Author: Jaeun Choi <jaeun12.c...@samsung.com>
Date:   Thu Feb 12 19:15:57 2015 +0900

    gengrid: select the focused item on enter key input
    
    there was no way to select an item with key input on 
ELM_ITEM_SELECT_ON_FOCUS_DISABLE mode.
    this patch enables select and multi select with enter/space key input.
    
    @fix
---
 config/default/base.src.in  | 54 +++++++++++++++++++++++++++++++++++++++++++++
 config/mobile/base.src.in   | 54 +++++++++++++++++++++++++++++++++++++++++++++
 config/standard/base.src.in | 54 +++++++++++++++++++++++++++++++++++++++++++++
 src/lib/elm_gengrid.c       | 51 +++++++++++++++++++++++++++++++++++-------
 4 files changed, 205 insertions(+), 8 deletions(-)

diff --git a/config/default/base.src.in b/config/default/base.src.in
index 78b3873..9208ed3 100644
--- a/config/default/base.src.in
+++ b/config/default/base.src.in
@@ -1046,18 +1046,72 @@ group "Elm_Config" struct {
               value "key" string: "Return";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
               value "key" string: "KP_Enter";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
               value "key" string: "space";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "select";
+              value "params" string: "multi";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "select";
+              value "params" string: "multi";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "select";
+              value "params" string: "multi";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
diff --git a/config/mobile/base.src.in b/config/mobile/base.src.in
index 127c8a9..fa15499 100644
--- a/config/mobile/base.src.in
+++ b/config/mobile/base.src.in
@@ -1050,18 +1050,72 @@ group "Elm_Config" struct {
               value "key" string: "Return";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
               value "key" string: "KP_Enter";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
               value "key" string: "space";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "select";
+              value "params" string: "multi";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "multi_select";
+              value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "multi_select";
+              value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
diff --git a/config/standard/base.src.in b/config/standard/base.src.in
index b7f9a4b..c4b05d9 100644
--- a/config/standard/base.src.in
+++ b/config/standard/base.src.in
@@ -1047,18 +1047,72 @@ group "Elm_Config" struct {
               value "key" string: "Return";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
               value "key" string: "KP_Enter";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
               value "key" string: "space";
               value "action" string: "select";
               value "params" string: "";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 0;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "select";
+              value "params" string: "multi";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "select";
+              value "params" string: "multi";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "select";
+              value "params" string: "multi";
+              group "modifiers" list {
+                 group "Elm_Config_Binding_Modifier" struct {
+                    value "mod" string: "Control";
+                    value "flag" uchar: 1;
+                 }
+              }
            }
            group "Elm_Config_Binding_Key" struct {
               value "context" int: 0;
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 5c01ee7..0fcf37f 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -2964,19 +2964,53 @@ _key_action_move(Evas_Object *obj, const char *params)
 }
 
 static Eina_Bool
-_key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
+_key_action_select(Evas_Object *obj, const char *params)
 {
    ELM_GENGRID_DATA_GET(obj, sd);
-   Elm_Object_Item *eo_it = NULL;
+   Elm_Object_Item *eo_it = elm_object_focused_item_get(obj);
+   ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
 
-   if (!sd->multi)
+   if (sd->multi &&
+       ((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
+        (!strcmp(params, "multi"))))
      {
-        eo_it = elm_object_focused_item_get(obj);
-        ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
-        evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, eo_it);
-        return EINA_TRUE;
+        if (!it->selected)
+          {
+             it->highlight_cb(it);
+             it->sel_cb(it);
+          }
+        else it->unsel_cb(it);
      }
-   return EINA_FALSE;
+   else
+     {
+        if (!it->selected)
+          {
+             while (sd->selected)
+               {
+                  Elm_Object_Item *eo_sel = sd->selected->data;
+                  Elm_Gen_Item *sel = eo_data_scope_get(eo_sel, 
ELM_GENGRID_ITEM_CLASS);
+                  it->unsel_cb(sel);
+               }
+          }
+        else
+          {
+             const Eina_List *l, *l_next;
+             Elm_Object_Item *eo_item2;
+
+             EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_item2)
+               {
+                  ELM_GENGRID_ITEM_DATA_GET(eo_item2, item2);
+                  if (item2 != it) it->unsel_cb(item2);
+               }
+          }
+        it->highlight_cb(it);
+        it->sel_cb(it);
+     }
+
+   if (!sd->multi)
+     evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, eo_it);
+
+   return EINA_TRUE;
 }
 
 static Eina_Bool
@@ -4944,6 +4978,7 @@ 
_elm_gengrid_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUS
           { "move,first", "move", "first", _key_action_move},
           { "move,last", "move", "last", _key_action_move},
           { "select", "select", NULL, _key_action_select},
+          { "select,multi", "select", "multi", _key_action_select},
           { "escape", "escape", NULL, _key_action_escape},
           { NULL, NULL, NULL, NULL }
    };

-- 


Reply via email to