elc_popup: add escape key binding
authorTaehyub Kim <taehyub.kim@samsung.com>
Wed, 18 May 2016 12:55:35 +0000 (21:55 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Wed, 18 May 2016 13:15:08 +0000 (22:15 +0900)
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

config/default/base.src.in
config/mobile/base.src.in
config/standard/base.src.in
src/lib/elementary/elc_popup.c
src/lib/elementary/elm_priv.h

index bd2ec06..eed391c 100644 (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 {
index d753de5..2622b89 100644 (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 {
index cf0d773..e8ca1d0 100644 (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 {
index db93b01..c5c57e5 100644 (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)
 {
index b3e24a0..162915a 100644 (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)