summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochan Lee <wc0917.lee@samsung.com>2018-04-09 10:27:57 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-04-09 10:36:43 -0700
commit0088189eee8baf87070f1924a1e657164f9b2962 (patch)
treee330ede912237430f30a134dea84db1965ba0105
parentf9fa8bfcb002cba71d182c40824a225c40d162bc (diff)
elementary: add new config value to handle tap finger size.
Summary: The tap_finger_size value of the concept is different from the finger_size value used in the past. We need a minimum value for recognize the gesture as a tap or not. Since the actual screen has different screen sizes, there is a problem that the recognition rate of tap is lowered when using the existing value(finger_size) Test Plan: elementary_test -> gesture sample. Reviewers: cedric, woohyun, Jaehyun_Cho, herb, id213sin Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5842 Reviewed-by: Cedric BAIL <cedric@osg.samsung.com> Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--config/default/base.src.in1
-rw-r--r--config/mobile/base.src.in1
-rw-r--r--config/standard/base.src.in1
-rw-r--r--src/lib/elementary/elm_config.c6
-rw-r--r--src/lib/elementary/elm_gesture_layer.c32
-rw-r--r--src/lib/elementary/elm_priv.h2
6 files changed, 26 insertions, 17 deletions
diff --git a/config/default/base.src.in b/config/default/base.src.in
index 7e9444c10c..853625d3b4 100644
--- a/config/default/base.src.in
+++ b/config/default/base.src.in
@@ -72,6 +72,7 @@ group "Elm_Config" struct {
72 value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */ 72 value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
73 value "glayer_double_tap_timeout" double: 0.25; /* Timeout between two mouse dows when doing double click (and more). */ 73 value "glayer_double_tap_timeout" double: 0.25; /* Timeout between two mouse dows when doing double click (and more). */
74 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */ 74 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
75 value "glayer_tap_finger_size" int: 10;
75 value "week_start" int: 1; 76 value "week_start" int: 1;
76 value "weekend_start" int: 6; 77 value "weekend_start" int: 6;
77 value "weekend_len" int: 2; 78 value "weekend_len" int: 2;
diff --git a/config/mobile/base.src.in b/config/mobile/base.src.in
index 18d3612548..0fdb4f47ad 100644
--- a/config/mobile/base.src.in
+++ b/config/mobile/base.src.in
@@ -72,6 +72,7 @@ group "Elm_Config" struct {
72 value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */ 72 value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
73 value "glayer_double_tap_timeout" double: 0.25; /* Timeout between two mouse dows when doing double click (and more). */ 73 value "glayer_double_tap_timeout" double: 0.25; /* Timeout between two mouse dows when doing double click (and more). */
74 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */ 74 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
75 value "glayer_tap_finger_size" int: 10;
75 value "week_start" int: 1; 76 value "week_start" int: 1;
76 value "weekend_start" int: 6; 77 value "weekend_start" int: 6;
77 value "weekend_len" int: 2; 78 value "weekend_len" int: 2;
diff --git a/config/standard/base.src.in b/config/standard/base.src.in
index 9781512539..a79b07ba04 100644
--- a/config/standard/base.src.in
+++ b/config/standard/base.src.in
@@ -73,6 +73,7 @@ group "Elm_Config" struct {
73 value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */ 73 value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
74 value "glayer_double_tap_timeout" double: 0.25; /* Timeout between two mouse dows when doing double click (and more). */ 74 value "glayer_double_tap_timeout" double: 0.25; /* Timeout between two mouse dows when doing double click (and more). */
75 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */ 75 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
76 value "glayer_tap_finger_size" int: 10;
76 value "week_start" int: 1; 77 value "week_start" int: 1;
77 value "weekend_start" int: 6; 78 value "weekend_start" int: 6;
78 value "weekend_len" int: 2; 79 value "weekend_len" int: 2;
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index b2cbf99601..da29ddf0e7 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -461,6 +461,7 @@ _desc_init(void)
461 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT); 461 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
462 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE); 462 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
463 ELM_CONFIG_VAL(D, T, glayer_double_tap_timeout, T_DOUBLE); 463 ELM_CONFIG_VAL(D, T, glayer_double_tap_timeout, T_DOUBLE);
464 ELM_CONFIG_VAL(D, T, glayer_tap_finger_size, T_INT);
464 ELM_CONFIG_VAL(D, T, access_mode, T_UCHAR); 465 ELM_CONFIG_VAL(D, T, access_mode, T_UCHAR);
465 ELM_CONFIG_VAL(D, T, selection_clear_enable, T_UCHAR); 466 ELM_CONFIG_VAL(D, T, selection_clear_enable, T_UCHAR);
466 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR); 467 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
@@ -1796,6 +1797,7 @@ _config_load(void)
1796 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */ 1797 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
1797 _elm_config->glayer_double_tap_timeout = 0.25; /* 0.25 seconds between 2 mouse downs of a tap. */ 1798 _elm_config->glayer_double_tap_timeout = 0.25; /* 0.25 seconds between 2 mouse downs of a tap. */
1798 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */ 1799 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
1800 _elm_config->glayer_tap_finger_size = 10;
1799 _elm_config->access_mode = ELM_ACCESS_MODE_OFF; 1801 _elm_config->access_mode = ELM_ACCESS_MODE_OFF;
1800 _elm_config->selection_clear_enable = EINA_FALSE; 1802 _elm_config->selection_clear_enable = EINA_FALSE;
1801 _elm_config->week_start = 1; /* monday */ 1803 _elm_config->week_start = 1; /* monday */
@@ -1955,6 +1957,7 @@ _elm_config_reload_do(void)
1955 KEEP_VAL(glayer_flick_time_limit_ms); 1957 KEEP_VAL(glayer_flick_time_limit_ms);
1956 KEEP_VAL(glayer_long_tap_start_timeout); 1958 KEEP_VAL(glayer_long_tap_start_timeout);
1957 KEEP_VAL(glayer_double_tap_timeout); 1959 KEEP_VAL(glayer_double_tap_timeout);
1960 KEEP_VAL(glayer_tap_finger_size);
1958 KEEP_VAL(access_mode); 1961 KEEP_VAL(access_mode);
1959 KEEP_VAL(glayer_continues_enable); 1962 KEEP_VAL(glayer_continues_enable);
1960 KEEP_VAL(week_start); 1963 KEEP_VAL(week_start);
@@ -2813,6 +2816,9 @@ _env_get(void)
2813 s = getenv("ELM_POPUP_SCROLLABLE"); 2816 s = getenv("ELM_POPUP_SCROLLABLE");
2814 if (s) _elm_config->popup_scrollable = atoi(s); 2817 if (s) _elm_config->popup_scrollable = atoi(s);
2815 2818
2819 s = getenv("ELM_GLAYER_TAP_FINGER_SIZE");
2820 if (s) _elm_config->glayer_tap_finger_size = atoi(s);
2821
2816 s = getenv("EFL_UI_DND_DRAG_ANIM_DURATION"); 2822 s = getenv("EFL_UI_DND_DRAG_ANIM_DURATION");
2817 if (s) _elm_config->drag_anim_duration = _elm_atof(s); 2823 if (s) _elm_config->drag_anim_duration = _elm_atof(s);
2818} 2824}
diff --git a/src/lib/elementary/elm_gesture_layer.c b/src/lib/elementary/elm_gesture_layer.c
index 0dec106de9..143ae645ca 100644
--- a/src/lib/elementary/elm_gesture_layer.c
+++ b/src/lib/elementary/elm_gesture_layer.c
@@ -1657,7 +1657,7 @@ _taps_rect_get(Eina_List *taps, int idx, Eina_Rectangle *r)
1657 * @ingroup Elm_Gesture_Layer 1657 * @ingroup Elm_Gesture_Layer
1658 */ 1658 */
1659static Eina_Bool 1659static Eina_Bool
1660_tap_gesture_check_finish(Gesture_Info *gesture, Evas_Coord tap_finger_size) 1660_tap_gesture_check_finish(Gesture_Info *gesture)
1661{ 1661{
1662 /* Here we check if taps-gesture was completed successfully */ 1662 /* Here we check if taps-gesture was completed successfully */
1663 /* Count how many taps were received on each device then */ 1663 /* Count how many taps were received on each device then */
@@ -1668,8 +1668,8 @@ _tap_gesture_check_finish(Gesture_Info *gesture, Evas_Coord tap_finger_size)
1668 Eina_List *pe_list; 1668 Eina_List *pe_list;
1669 Eina_Rectangle base = {0, 0, 0, 0}; 1669 Eina_Rectangle base = {0, 0, 0, 0};
1670 Eina_Rectangle tmp = {0, 0, 0, 0}; 1670 Eina_Rectangle tmp = {0, 0, 0, 0};
1671 if (!tap_finger_size) /* Use system default if not set by user */ 1671
1672 tap_finger_size = elm_config_finger_size_get(); 1672 ELM_GESTURE_LAYER_DATA_GET(gesture->obj, sd);
1673 1673
1674 if (!st->l) return EINA_FALSE; 1674 if (!st->l) return EINA_FALSE;
1675 EINA_LIST_FOREACH(st->l, l, pe_list) 1675 EINA_LIST_FOREACH(st->l, l, pe_list)
@@ -1690,16 +1690,16 @@ _tap_gesture_check_finish(Gesture_Info *gesture, Evas_Coord tap_finger_size)
1690 { /* Compare all other rects to base, tolerance is finger size */ 1690 { /* Compare all other rects to base, tolerance is finger size */
1691 if (_taps_rect_get(st->l, i, &tmp)) 1691 if (_taps_rect_get(st->l, i, &tmp))
1692 { 1692 {
1693 if (abs(tmp.x - base.x) > tap_finger_size) 1693 if (abs(tmp.x - base.x) > sd->tap_finger_size)
1694 return EINA_FALSE; 1694 return EINA_FALSE;
1695 1695
1696 if (abs(tmp.y - base.y) > tap_finger_size) 1696 if (abs(tmp.y - base.y) > sd->tap_finger_size)
1697 return EINA_FALSE; 1697 return EINA_FALSE;
1698 1698
1699 if (abs((tmp.x + tmp.w) - (base.x + base.w)) > tap_finger_size) 1699 if (abs((tmp.x + tmp.w) - (base.x + base.w)) > sd->tap_finger_size)
1700 return EINA_FALSE; 1700 return EINA_FALSE;
1701 1701
1702 if (abs((tmp.y + tmp.h) - (base.y + base.h)) > tap_finger_size) 1702 if (abs((tmp.y + tmp.h) - (base.y + base.h)) > sd->tap_finger_size)
1703 return EINA_FALSE; 1703 return EINA_FALSE;
1704 } 1704 }
1705 } 1705 }
@@ -1717,14 +1717,14 @@ _tap_gesture_check_finish(Gesture_Info *gesture, Evas_Coord tap_finger_size)
1717 * @ingroup Elm_Gesture_Layer 1717 * @ingroup Elm_Gesture_Layer
1718 */ 1718 */
1719static void 1719static void
1720_tap_gesture_finish(void *data, Evas_Coord tap_finger_size) 1720_tap_gesture_finish(void *data)
1721{ 1721{
1722 /* This function will test each tap gesture when timer expires */ 1722 /* This function will test each tap gesture when timer expires */
1723 Elm_Gesture_State s = ELM_GESTURE_STATE_ABORT; 1723 Elm_Gesture_State s = ELM_GESTURE_STATE_ABORT;
1724 Gesture_Info *gesture = data; 1724 Gesture_Info *gesture = data;
1725 Taps_Type *st = gesture->data; 1725 Taps_Type *st = gesture->data;
1726 1726
1727 if (_tap_gesture_check_finish(gesture, tap_finger_size)) 1727 if (_tap_gesture_check_finish(gesture))
1728 { 1728 {
1729 s = ELM_GESTURE_STATE_END; 1729 s = ELM_GESTURE_STATE_END;
1730 } 1730 }
@@ -1750,16 +1750,13 @@ _multi_tap_timeout(void *data)
1750 ELM_GESTURE_LAYER_DATA_GET(data, sd); 1750 ELM_GESTURE_LAYER_DATA_GET(data, sd);
1751 1751
1752 if (IS_TESTED(ELM_GESTURE_N_TAPS)) 1752 if (IS_TESTED(ELM_GESTURE_N_TAPS))
1753 _tap_gesture_finish(sd->gesture[ELM_GESTURE_N_TAPS], 1753 _tap_gesture_finish(sd->gesture[ELM_GESTURE_N_TAPS]);
1754 sd->tap_finger_size);
1755 1754
1756 if (IS_TESTED(ELM_GESTURE_N_DOUBLE_TAPS)) 1755 if (IS_TESTED(ELM_GESTURE_N_DOUBLE_TAPS))
1757 _tap_gesture_finish(sd->gesture[ELM_GESTURE_N_DOUBLE_TAPS], 1756 _tap_gesture_finish(sd->gesture[ELM_GESTURE_N_DOUBLE_TAPS]);
1758 sd->tap_finger_size);
1759 1757
1760 if (IS_TESTED(ELM_GESTURE_N_TRIPLE_TAPS)) 1758 if (IS_TESTED(ELM_GESTURE_N_TRIPLE_TAPS))
1761 _tap_gesture_finish(sd->gesture[ELM_GESTURE_N_TRIPLE_TAPS], 1759 _tap_gesture_finish(sd->gesture[ELM_GESTURE_N_TRIPLE_TAPS]);
1762 sd->tap_finger_size);
1763 1760
1764 _clear_if_finished(data); 1761 _clear_if_finished(data);
1765 sd->gest_taps_timeout = NULL; 1762 sd->gest_taps_timeout = NULL;
@@ -1950,9 +1947,9 @@ _tap_gesture_test(Evas_Object *obj,
1950 ((gesture->g_type == ELM_GESTURE_N_DOUBLE_TAPS) && 1947 ((gesture->g_type == ELM_GESTURE_N_DOUBLE_TAPS) &&
1951 !IS_TESTED(ELM_GESTURE_N_TRIPLE_TAPS))) 1948 !IS_TESTED(ELM_GESTURE_N_TRIPLE_TAPS)))
1952 { /* Test for finish immediately, not waiting for timeout */ 1949 { /* Test for finish immediately, not waiting for timeout */
1953 if (_tap_gesture_check_finish(gesture, sd->tap_finger_size)) 1950 if (_tap_gesture_check_finish(gesture))
1954 { 1951 {
1955 _tap_gesture_finish(gesture, sd->tap_finger_size); 1952 _tap_gesture_finish(gesture);
1956 return; 1953 return;
1957 } 1954 }
1958 } 1955 }
@@ -3772,6 +3769,7 @@ _elm_gesture_layer_efl_canvas_group_group_add(Eo *obj, Elm_Gesture_Layer_Data *p
3772 priv->long_tap_start_timeout = _elm_config->glayer_long_tap_start_timeout; 3769 priv->long_tap_start_timeout = _elm_config->glayer_long_tap_start_timeout;
3773 priv->repeat_events = EINA_TRUE; 3770 priv->repeat_events = EINA_TRUE;
3774 priv->glayer_continues_enable = _elm_config->glayer_continues_enable; 3771 priv->glayer_continues_enable = _elm_config->glayer_continues_enable;
3772 priv->tap_finger_size = _elm_config->glayer_tap_finger_size;
3775 3773
3776 /* FIXME: Hack to get around old configs - if too small, enlarge. */ 3774 /* FIXME: Hack to get around old configs - if too small, enlarge. */
3777 if (_elm_config->glayer_double_tap_timeout < 0.00001) 3775 if (_elm_config->glayer_double_tap_timeout < 0.00001)
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index fc67a74fc7..883833a1f6 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -290,6 +290,7 @@ struct _Elm_Config_Flags
290 Eina_Bool glayer_flick_time_limit_ms : 1; // unused 290 Eina_Bool glayer_flick_time_limit_ms : 1; // unused
291 Eina_Bool glayer_long_tap_start_timeout : 1; 291 Eina_Bool glayer_long_tap_start_timeout : 1;
292 Eina_Bool glayer_double_tap_timeout : 1; 292 Eina_Bool glayer_double_tap_timeout : 1;
293 Eina_Bool glayer_tap_finger_size : 1;
293 Eina_Bool access_mode : 1; 294 Eina_Bool access_mode : 1;
294 Eina_Bool glayer_continues_enable : 1; // unused 295 Eina_Bool glayer_continues_enable : 1; // unused
295 Eina_Bool week_start : 1; // unused 296 Eina_Bool week_start : 1; // unused
@@ -425,6 +426,7 @@ struct _Elm_Config
425 unsigned int glayer_flick_time_limit_ms; 426 unsigned int glayer_flick_time_limit_ms;
426 double glayer_long_tap_start_timeout; 427 double glayer_long_tap_start_timeout;
427 double glayer_double_tap_timeout; 428 double glayer_double_tap_timeout;
429 int glayer_tap_finger_size;
428 Eina_Bool access_mode; 430 Eina_Bool access_mode;
429 unsigned char glayer_continues_enable; 431 unsigned char glayer_continues_enable;
430 int week_start; 432 int week_start;