aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/lib/elm_win.c
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2014-04-16 10:38:34 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-04-16 10:38:34 +0900
commit40704d6d438aafd65e2c24915345710033c93452 (patch)
treee18afaece4f041e33c8194e177308fd7d232a8bf /legacy/elementary/src/lib/elm_win.c
parenttheme - improve efm icons provided by ApB (diff)
downloadefl-40704d6d438aafd65e2c24915345710033c93452.tar.gz
win: apply key binding
Summary: This patch applies key binding to elm_win. Test Plan: None Reviewers: Hermet Reviewed By: Hermet Differential Revision: https://phab.enlightenment.org/D741
Diffstat (limited to 'legacy/elementary/src/lib/elm_win.c')
-rw-r--r--legacy/elementary/src/lib/elm_win.c83
1 files changed, 39 insertions, 44 deletions
diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c
index d379daf973..ba4b451f8f 100644
--- a/legacy/elementary/src/lib/elm_win.c
+++ b/legacy/elementary/src/lib/elm_win.c
@@ -253,6 +253,15 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{NULL, NULL}
};
+static Eina_Bool _key_action_return(Evas_Object *obj, const char *params);
+static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
+
+static const Elm_Action key_actions[] = {
+ {"return", _key_action_return},
+ {"move", _key_action_move},
+ {NULL, NULL}
+};
+
Eina_List *_elm_win_list = NULL;
int _elm_win_deferred_free = 0;
@@ -1216,6 +1225,34 @@ _elm_win_elm_widget_on_focus(Eo *obj, Elm_Win_Data *sd)
return EINA_TRUE;
}
+static Eina_Bool
+_key_action_return(Evas_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
+{
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+_key_action_move(Evas_Object *obj, const char *params)
+{
+ const char *dir = params;
+
+ if (!strcmp(dir, "previous"))
+ elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
+ else if (!strcmp(dir, "next"))
+ elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
+ else if (!strcmp(dir, "left"))
+ elm_widget_focus_cycle(obj, ELM_FOCUS_LEFT);
+ else if (!strcmp(dir, "right"))
+ elm_widget_focus_cycle(obj, ELM_FOCUS_RIGHT);
+ else if (!strcmp(dir, "up"))
+ elm_widget_focus_cycle(obj, ELM_FOCUS_UP);
+ else if (!strcmp(dir, "down"))
+ elm_widget_focus_cycle(obj, ELM_FOCUS_DOWN);
+ else return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
EOLIAN static Eina_Bool
_elm_win_elm_widget_event(Eo *obj, Elm_Win_Data *_pd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
{
@@ -1225,51 +1262,9 @@ _elm_win_elm_widget_event(Eo *obj, Elm_Win_Data *_pd EINA_UNUSED, Evas_Object *s
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
- if ((!strcmp(ev->key, "Tab")) ||
- (!strcmp(ev->key, "ISO_Left_Tab")))
- {
- if (evas_key_modifier_is_set(ev->modifiers, "Control") ||
- evas_key_modifier_is_set(ev->modifiers, "Alt"))
- return EINA_FALSE;
- if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
- elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
- else
- elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
-
- goto success;
- }
- else if ((!strcmp(ev->key, "Left")) ||
- ((!strcmp(ev->key, "KP_Left")) && (!ev->string)))
- {
- elm_widget_focus_cycle(obj, ELM_FOCUS_LEFT);
-
- goto success;
- }
- else if ((!strcmp(ev->key, "Right")) ||
- ((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
- {
- elm_widget_focus_cycle(obj, ELM_FOCUS_RIGHT);
-
- goto success;
- }
- else if ((!strcmp(ev->key, "Up")) ||
- ((!strcmp(ev->key, "KP_Up")) && (!ev->string)))
- {
- elm_widget_focus_cycle(obj, ELM_FOCUS_UP);
-
- goto success;
- }
- else if ((!strcmp(ev->key, "Down")) ||
- ((!strcmp(ev->key, "KP_Down")) && (!ev->string)))
- {
- elm_widget_focus_cycle(obj, ELM_FOCUS_DOWN);
-
- goto success;
- }
-
- return EINA_FALSE;
+ if (!_elm_config_key_binding_call(obj, ev, key_actions))
+ return EINA_FALSE;
-success:
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return EINA_TRUE;
}