From acce63af739b7ebcf5dde333314af633580892d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Iv=C3=A1n=20Briano?= Date: Wed, 24 Nov 2010 17:11:34 +0000 Subject: [PATCH] Longpress timeout is now configurable. Patch by WooHyun Jung SVN revision: 54939 --- config/default/base.src | 3 ++- config/illume/base.src | 3 ++- config/standard/base.src | 3 ++- src/lib/Elementary.h.in | 4 ++++ src/lib/elm_config.c | 15 +++++++++------ src/lib/elm_main.c | 25 +++++++++++++++++++++++++ src/lib/elm_priv.h | 3 ++- 7 files changed, 46 insertions(+), 10 deletions(-) diff --git a/config/default/base.src b/config/default/base.src index aec6857..1101c8f 100644 --- a/config/default/base.src +++ b/config/default/base.src @@ -1,5 +1,5 @@ group "Elm_Config" struct { - value "config_version" int: 65538; + value "config_version" int: 65539; value "engine" string: "software_x11"; value "thumbscroll_enable" uchar: 1; value "thumbscroll_threshold" int: 24; @@ -32,4 +32,5 @@ group "Elm_Config" struct { value "fileselector_expand_enable" uchar: 0; value "inwin_dialogs_enable" uchar: 1; value "icon_size" int: 32; + value "longpress_timeout" double: 1.0; } diff --git a/config/illume/base.src b/config/illume/base.src index aec6857..1101c8f 100644 --- a/config/illume/base.src +++ b/config/illume/base.src @@ -1,5 +1,5 @@ group "Elm_Config" struct { - value "config_version" int: 65538; + value "config_version" int: 65539; value "engine" string: "software_x11"; value "thumbscroll_enable" uchar: 1; value "thumbscroll_threshold" int: 24; @@ -32,4 +32,5 @@ group "Elm_Config" struct { value "fileselector_expand_enable" uchar: 0; value "inwin_dialogs_enable" uchar: 1; value "icon_size" int: 32; + value "longpress_timeout" double: 1.0; } diff --git a/config/standard/base.src b/config/standard/base.src index 8a2aae3..4e6be3b 100644 --- a/config/standard/base.src +++ b/config/standard/base.src @@ -1,5 +1,5 @@ group "Elm_Config" struct { - value "config_version" int: 65538; + value "config_version" int: 65539; value "engine" string: "software_x11"; value "thumbscroll_enable" uchar: 0; value "thumbscroll_threshold" int: 4; @@ -32,4 +32,5 @@ group "Elm_Config" struct { value "fileselector_expand_enable" uchar: 1; value "inwin_dialogs_enable" uchar: 0; value "icon_size" int: 32; + value "longpress_timeout" double: 1.0; } diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 63e18e2..5a7dc4f 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -370,12 +370,16 @@ extern "C" { EAPI void elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h); + EAPI double elm_longpress_timeout_get(void); + EAPI void elm_longpress_timeout_set(double longpress_timeout); + /* debug * don't use it unless you are sure */ EAPI void elm_object_tree_dump(const Evas_Object *top); EAPI void elm_object_tree_dot_dump(const Evas_Object *top, const char *file); + /* theme */ typedef struct _Elm_Theme Elm_Theme; diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c index c7d0f10..0a5ea69 100644 --- a/src/lib/elm_config.c +++ b/src/lib/elm_config.c @@ -426,6 +426,7 @@ _desc_init(void) ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR); ELM_CONFIG_VAL(D, T, inwin_dialogs_enable, T_UCHAR); ELM_CONFIG_VAL(D, T, icon_size, T_INT); + ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE); #undef T #undef D #undef T_INT @@ -955,6 +956,7 @@ _config_load(void) _elm_config->fileselector_expand_enable = EINA_FALSE; _elm_config->inwin_dialogs_enable = EINA_FALSE; _elm_config->icon_size = 32; + _elm_config->longpress_timeout = 1.0; } static const char * @@ -1156,12 +1158,9 @@ _config_update(void) * if needed, but that will be dependent on new properties added * with each version */ - /* nothing here, just an example */ - /* - IFCFG(0x0002); - COPYVAL(some_value); - IFCFGEND; - */ + IFCFG(0x0003); + COPYVAL(longpress_timeout); + IFCFGEND; #undef COPYSTR #undef COPYPTR @@ -1352,6 +1351,10 @@ _env_get(void) s = getenv("ELM_ICON_SIZE"); if (s) _elm_config->icon_size = atoi(s); + + s = getenv("ELM_LONGPRESS_TIMEOUT"); + if (s) _elm_config->longpress_timeout = atof(s); + if (_elm_config->longpress_timeout < 0.0) _elm_config->longpress_timeout = 0.0; } void diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index 0841932..1f27f82 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -2654,3 +2654,28 @@ elm_object_tree_dot_dump(const Evas_Object *top, const char *file) (void)file; #endif } + +/** + * Set the duration for occuring long press event. + * + * @param lonpress_timeout Timeout for long press event + * @ingroup Longpress + */ +EAPI void +elm_longpress_timeout_set(double longpress_timeout) +{ + _elm_config->longpress_timeout = longpress_timeout; +} + +/** + * Get the duration for occuring long press event. + * + * @return Timeout for long press event + * @ingroup Longpress + */ +EAPI double +elm_longpress_timeout_get(void) +{ + return _elm_config->longpress_timeout; +} + diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h index 53ee159..ce8f17d 100644 --- a/src/lib/elm_priv.h +++ b/src/lib/elm_priv.h @@ -48,7 +48,7 @@ struct _Elm_Theme /* increment this whenever a new set of config values are added but the users * config doesn't need to be wiped - simply new values need to be put in */ -#define ELM_CONFIG_FILE_GENERATION 0x0002 +#define ELM_CONFIG_FILE_GENERATION 0x0003 #define ELM_CONFIG_VERSION ((ELM_CONFIG_EPOCH << 16) | ELM_CONFIG_FILE_GENERATION) /* NB: profile configuration files (.src) must have their * "config_version" entry's value up-to-date with ELM_CONFIG_VERSION @@ -109,6 +109,7 @@ struct _Elm_Config Eina_Bool fileselector_expand_enable; Eina_Bool inwin_dialogs_enable; int icon_size; + double longpress_timeout; }; struct _Elm_Module -- 2.7.4