elc_popup: add escape key binding

Summary:
There are no methods to close the popup with key down.
So I added the escape key binding to close the popup with escape key.

Test Plan:
1. patch this code
2. delete /home/{user}/.elementary to refresh the config value
3. launch elementary_test -to "popup"
4. click one example of the list and press escape key
5. see closing the popup

Reviewers: cedric, raster, jpeg, Jaehyun_Cho, Hermet

Reviewed By: Hermet

Differential Revision: https://phab.enlightenment.org/D3876

Conflicts:
	src/lib/elementary/elm_priv.h
This commit is contained in:
Taehyub Kim 2016-05-18 21:55:35 +09:00 committed by Hermet Park
parent 96624b9725
commit 55a6bd7fbb
5 changed files with 33 additions and 4 deletions

View File

@ -1,5 +1,5 @@
group "Elm_Config" struct {
value "config_version" int: 131079;
value "config_version" int: 131083;
value "engine" string: "";
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 1;
@ -597,6 +597,12 @@ 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: "Escape";
value "action" string: "esc";
value "params" string: "";
}
}
}
group "Elm_Config_Bindings_Widget" struct {

View File

@ -1,5 +1,5 @@
group "Elm_Config" struct {
value "config_version" int: 131079;
value "config_version" int: 131083;
value "engine" string: "";
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 1;
@ -601,6 +601,12 @@ 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: "Escape";
value "action" string: "escape";
value "params" string: "";
}
}
}
group "Elm_Config_Bindings_Widget" struct {

View File

@ -1,5 +1,5 @@
group "Elm_Config" struct {
value "config_version" int: 131079;
value "config_version" int: 131083;
value "engine" string: "";
value "vsync" uchar: 0;
value "thumbscroll_enable" uchar: 0;
@ -598,6 +598,12 @@ 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: "Escape";
value "action" string: "escape";
value "params" string: "esc";
}
}
}
group "Elm_Config_Bindings_Widget" struct {

View File

@ -44,6 +44,7 @@ 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_escape(Evas_Object *obj, const char *params);
static void _parent_geom_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED);
static Eina_Bool
_block_clicked_cb(void *data, const Eo_Event *event);
@ -55,6 +56,7 @@ _hide_effect_finished_cb(void *data, const Eo_Event *event);
static const Elm_Action key_actions[] = {
{"move", _key_action_move},
{"escape", _key_action_escape},
{NULL, NULL}
};
@ -1476,6 +1478,15 @@ _key_action_move(Evas_Object *obj, const char *params)
}
static Eina_Bool
_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
{
ELM_POPUP_DATA_GET(obj, pd);
elm_layout_signal_emit(pd->main_layout, "elm,state,hide", "elm");
elm_notify_dismiss(pd->notify);
return EINA_TRUE;
}
EOLIAN static Eina_Bool
_elm_popup_elm_widget_event(Eo *obj, Elm_Popup_Data *_pd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
{

View File

@ -134,7 +134,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 0x000a
#define ELM_CONFIG_FILE_GENERATION 0x000B
#define ELM_CONFIG_VERSION_EPOCH_OFFSET 16
#define ELM_CONFIG_VERSION ((ELM_CONFIG_EPOCH << ELM_CONFIG_VERSION_EPOCH_OFFSET) | \
ELM_CONFIG_FILE_GENERATION)