forked from enlightenment/efl
elm_button: apply key binding
Summary: This patch applies key binding to elm_button. Test Plan: elementary_test > Button > check key events Reviewers: Hermet, raster Reviewed By: Hermet Differential Revision: https://phab.enlightenment.org/D646
This commit is contained in:
parent
68b66830b4
commit
d6acf211cc
|
@ -246,6 +246,38 @@ group "Elm_Config" struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group "bindings" list {
|
group "bindings" list {
|
||||||
|
group "Elm_Config_Bindings_Widget" struct {
|
||||||
|
value "name" string: "Elm_Button";
|
||||||
|
group "key_bindings" list {
|
||||||
|
group "Elm_Config_Binding_Key" struct {
|
||||||
|
value "context" int: 0;
|
||||||
|
value "modifiers" string: "None";
|
||||||
|
value "key" string: "Return";
|
||||||
|
value "action" string: "activate";
|
||||||
|
value "params" string: "";
|
||||||
|
value "any_mod" uchar: 1;
|
||||||
|
value "no_string" uchar: 0;
|
||||||
|
}
|
||||||
|
group "Elm_Config_Binding_Key" struct {
|
||||||
|
value "context" int: 0;
|
||||||
|
value "modifiers" string: "None";
|
||||||
|
value "key" string: "KP_Enter";
|
||||||
|
value "action" string: "activate";
|
||||||
|
value "params" string: "";
|
||||||
|
value "any_mod" uchar: 1;
|
||||||
|
value "no_string" uchar: 0;
|
||||||
|
}
|
||||||
|
group "Elm_Config_Binding_Key" struct {
|
||||||
|
value "context" int: 0;
|
||||||
|
value "modifiers" string: "None";
|
||||||
|
value "key" string: "space";
|
||||||
|
value "action" string: "activate";
|
||||||
|
value "params" string: "";
|
||||||
|
value "any_mod" uchar: 1;
|
||||||
|
value "no_string" uchar: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
group "Elm_Config_Bindings_Widget" struct {
|
group "Elm_Config_Bindings_Widget" struct {
|
||||||
value "name" string: "Elm_Panel";
|
value "name" string: "Elm_Panel";
|
||||||
group "key_bindings" list {
|
group "key_bindings" list {
|
||||||
|
|
|
@ -247,6 +247,38 @@ group "Elm_Config" struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group "bindings" list {
|
group "bindings" list {
|
||||||
|
group "Elm_Config_Bindings_Widget" struct {
|
||||||
|
value "name" string: "Elm_Button";
|
||||||
|
group "key_bindings" list {
|
||||||
|
group "Elm_Config_Binding_Key" struct {
|
||||||
|
value "context" int: 0;
|
||||||
|
value "modifiers" string: "None";
|
||||||
|
value "key" string: "Return";
|
||||||
|
value "action" string: "activate";
|
||||||
|
value "params" string: "";
|
||||||
|
value "any_mod" uchar: 1;
|
||||||
|
value "no_string" uchar: 0;
|
||||||
|
}
|
||||||
|
group "Elm_Config_Binding_Key" struct {
|
||||||
|
value "context" int: 0;
|
||||||
|
value "modifiers" string: "None";
|
||||||
|
value "key" string: "KP_Enter";
|
||||||
|
value "action" string: "activate";
|
||||||
|
value "params" string: "";
|
||||||
|
value "any_mod" uchar: 1;
|
||||||
|
value "no_string" uchar: 0;
|
||||||
|
}
|
||||||
|
group "Elm_Config_Binding_Key" struct {
|
||||||
|
value "context" int: 0;
|
||||||
|
value "modifiers" string: "None";
|
||||||
|
value "key" string: "space";
|
||||||
|
value "action" string: "activate";
|
||||||
|
value "params" string: "";
|
||||||
|
value "any_mod" uchar: 1;
|
||||||
|
value "no_string" uchar: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
group "Elm_Config_Bindings_Widget" struct {
|
group "Elm_Config_Bindings_Widget" struct {
|
||||||
value "name" string: "Elm_Panel";
|
value "name" string: "Elm_Panel";
|
||||||
group "key_bindings" list {
|
group "key_bindings" list {
|
||||||
|
|
|
@ -41,6 +41,13 @@ static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void _key_action_activate(Evas_Object *obj, const char *params);
|
||||||
|
|
||||||
|
static const Elm_Action key_actions[] = {
|
||||||
|
{"activate", _key_action_activate},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_activate(Evas_Object *obj)
|
_activate(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -149,6 +156,12 @@ _elm_button_elm_container_content_set(Eo *obj, Elm_Button_Data *_pd EINA_UNUSED,
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
|
||||||
|
{
|
||||||
|
elm_layout_signal_emit(obj, "elm,anim,activate", "elm");
|
||||||
|
_activate(obj);
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_elm_button_elm_widget_event(Eo *obj, Elm_Button_Data *_pd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
_elm_button_elm_widget_event(Eo *obj, Elm_Button_Data *_pd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
||||||
{
|
{
|
||||||
|
@ -159,13 +172,7 @@ _elm_button_elm_widget_event(Eo *obj, Elm_Button_Data *_pd EINA_UNUSED, Evas_Obj
|
||||||
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
||||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
||||||
|
|
||||||
if ((strcmp(ev->key, "Return")) &&
|
_elm_config_key_binding_call(obj, ev, key_actions);
|
||||||
(strcmp(ev->key, "KP_Enter")) &&
|
|
||||||
(strcmp(ev->key, "space")))
|
|
||||||
return EINA_FALSE;
|
|
||||||
|
|
||||||
elm_layout_signal_emit(obj, "elm,anim,activate", "elm");
|
|
||||||
_activate(obj);
|
|
||||||
|
|
||||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
Loading…
Reference in New Issue