summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAharon Hillel <a.hillel@partner.samsung.com>2011-09-08 10:10:34 +0000
committerTom Hacohen <tom@stosb.com>2011-09-08 10:10:34 +0000
commit66fa5293eb84f1de036801901ab2cbade3919780 (patch)
tree680e19140f674c0bf9bc5a3cb80d972d4041a359
parent38245de52f8a468b039c693886cd6a5c63d9be13 (diff)
Elm glayer: Added glayer_continues_enable setting to elm-config-file.
Signed-off-by: Aharon Hillel <a.hillel@partner.samsung.com> SVN revision: 63287
-rw-r--r--config/default/base.src1
-rw-r--r--config/standard/base.src1
-rw-r--r--src/lib/elm_config.c2
-rw-r--r--src/lib/elm_gesture_layer.c84
-rw-r--r--src/lib/elm_priv.h1
5 files changed, 50 insertions, 39 deletions
diff --git a/config/default/base.src b/config/default/base.src
index 593cd84b5..ed11da866 100644
--- a/config/default/base.src
+++ b/config/default/base.src
@@ -48,4 +48,5 @@ group "Elm_Config" struct {
48 value "glayer_line_angular_tolerance" double: 0.34906585; /* Represents 20 DEG */ 48 value "glayer_line_angular_tolerance" double: 0.34906585; /* Represents 20 DEG */
49 value "glayer_flick_time_limit_ms" uint: 60; /* 60 ms to finish flick */ 49 value "glayer_flick_time_limit_ms" uint: 60; /* 60 ms to finish flick */
50 value "glayer_long_tap_start_timeout" double: 1.2; /* 1.2 sec to start long-tap */ 50 value "glayer_long_tap_start_timeout" double: 1.2; /* 1.2 sec to start long-tap */
51 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
51} 52}
diff --git a/config/standard/base.src b/config/standard/base.src
index eceeb7b2b..eaa84da47 100644
--- a/config/standard/base.src
+++ b/config/standard/base.src
@@ -52,4 +52,5 @@ group "Elm_Config" struct {
52 value "glayer_line_angular_tolerance" double: 0.34906585; /* Represents 20 DEG */ 52 value "glayer_line_angular_tolerance" double: 0.34906585; /* Represents 20 DEG */
53 value "glayer_flick_time_limit_ms" uint: 60; /* 60 ms to finish flick */ 53 value "glayer_flick_time_limit_ms" uint: 60; /* 60 ms to finish flick */
54 value "glayer_long_tap_start_timeout" double: 1.2; /* 1.2 sec to start long-tap */ 54 value "glayer_long_tap_start_timeout" double: 1.2; /* 1.2 sec to start long-tap */
55 value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
55} 56}
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 4955b15df..3be17fa5a 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -612,6 +612,7 @@ _desc_init(void)
612 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT); 612 ELM_CONFIG_VAL(D, T, glayer_flick_time_limit_ms, T_INT);
613 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE); 613 ELM_CONFIG_VAL(D, T, glayer_long_tap_start_timeout, T_DOUBLE);
614 ELM_CONFIG_VAL(D, T, access_mode, T_INT); 614 ELM_CONFIG_VAL(D, T, access_mode, T_INT);
615 ELM_CONFIG_VAL(D, T, glayer_continues_enable, T_UCHAR);
615#undef T 616#undef T
616#undef D 617#undef D
617#undef T_INT 618#undef T_INT
@@ -1179,6 +1180,7 @@ _config_load(void)
1179 _elm_config->glayer_line_angular_tolerance = 0.34906585; /* Represents 20 DEG */ 1180 _elm_config->glayer_line_angular_tolerance = 0.34906585; /* Represents 20 DEG */
1180 _elm_config->glayer_flick_time_limit_ms = 60; /* 60 ms to finish flick */ 1181 _elm_config->glayer_flick_time_limit_ms = 60; /* 60 ms to finish flick */
1181 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */ 1182 _elm_config->glayer_long_tap_start_timeout = 1.2; /* 1.2 second to start long-tap */
1183 _elm_config->glayer_continues_enable = EINA_TRUE; /* Continue gestures default */
1182} 1184}
1183 1185
1184static const char * 1186static const char *
diff --git a/src/lib/elm_gesture_layer.c b/src/lib/elm_gesture_layer.c
index f88cf012f..8ef568f22 100644
--- a/src/lib/elm_gesture_layer.c
+++ b/src/lib/elm_gesture_layer.c
@@ -239,6 +239,7 @@ struct _Widget_Data
239 double rotate_angular_tolerance; 239 double rotate_angular_tolerance;
240 unsigned int flick_time_limit_ms; 240 unsigned int flick_time_limit_ms;
241 double long_tap_start_timeout; 241 double long_tap_start_timeout;
242 Eina_Bool glayer_continues_enable;
242 243
243 double zoom_step; 244 double zoom_step;
244 double rotate_step; 245 double rotate_step;
@@ -2026,15 +2027,16 @@ _n_line_test(Evas_Object *obj, Pointer_Event *pe, void *event_info,
2026 return; 2027 return;
2027 } 2028 }
2028 2029
2029 /* We may finish line if momentum is zero */ 2030 if (wd->glayer_continues_enable)
2030 /* This is for continues-gesture */ 2031 { /* We may finish line if momentum is zero */
2031 if ((!st->info.momentum.mx) && (!st->info.momentum.my)) 2032 /* This is for continues-gesture */
2032 { /* Finish line on zero momentum for continues gesture */ 2033 if ((!st->info.momentum.mx) && (!st->info.momentum.my))
2033 line->line_end.x = pe->x; 2034 { /* Finish line on zero momentum for continues gesture */
2034 line->line_end.y = pe->y; 2035 line->line_end.x = pe->x;
2035 line->t_end = pe->timestamp; 2036 line->line_end.y = pe->y;
2037 line->t_end = pe->timestamp;
2038 }
2036 } 2039 }
2037
2038 } 2040 }
2039 else 2041 else
2040 { /* Record the line angle as it broke minimum length for line */ 2042 { /* Record the line angle as it broke minimum length for line */
@@ -2169,7 +2171,7 @@ _n_line_test(Evas_Object *obj, Pointer_Event *pe, void *event_info,
2169 case EVAS_CALLBACK_MULTI_MOVE: 2171 case EVAS_CALLBACK_MULTI_MOVE:
2170 if (started) 2172 if (started)
2171 { 2173 {
2172 if (started == ended) 2174 if (wd->glayer_continues_enable && started == ended)
2173 { /* For continues gesture */ 2175 { /* For continues gesture */
2174 ev_flag = _set_state(gesture, ELM_GESTURE_STATE_END, 2176 ev_flag = _set_state(gesture, ELM_GESTURE_STATE_END,
2175 &st->info, EINA_FALSE); 2177 &st->info, EINA_FALSE);
@@ -2661,22 +2663,23 @@ _zoom_test(Evas_Object *obj, Pointer_Event *pe, void *event_info,
2661 if (d < 0.0) 2663 if (d < 0.0)
2662 d = (-d); 2664 d = (-d);
2663 2665
2664 /* START For contiunues gesture: compute momentum */ 2666 if (wd->glayer_continues_enable)
2665 _set_momentum(&st->momentum1, st->zoom_st.x, st->zoom_st.y, 2667 { /* START For contiunues gesture: compute momentum */
2666 st->zoom_mv.x, st->zoom_mv.y,st->zoom_st.timestamp, st->zoom_st.timestamp, 2668 _set_momentum(&st->momentum1, st->zoom_st.x, st->zoom_st.y,
2667 st->zoom_mv.timestamp); 2669 st->zoom_mv.x, st->zoom_mv.y,st->zoom_st.timestamp, st->zoom_st.timestamp,
2670 st->zoom_mv.timestamp);
2668 2671
2669 _set_momentum(&st->momentum2, st->zoom_st1.x, st->zoom_st1.y, 2672 _set_momentum(&st->momentum2, st->zoom_st1.x, st->zoom_st1.y,
2670 st->zoom_mv1.x, st->zoom_mv1.y,st->zoom_st1.timestamp, st->zoom_st1.timestamp, 2673 st->zoom_mv1.x, st->zoom_mv1.y,st->zoom_st1.timestamp, st->zoom_st1.timestamp,
2671 st->zoom_mv1.timestamp); 2674 st->zoom_mv1.timestamp);
2672 2675
2673 if (!(st->momentum1.mx + st->momentum1.my + st->momentum2.mx + st->momentum2.my)) 2676 if (!(st->momentum1.mx + st->momentum1.my + st->momentum2.mx + st->momentum2.my))
2674 { 2677 {
2675 ev_flag = _set_state(gesture_zoom, ELM_GESTURE_STATE_END, 2678 ev_flag = _set_state(gesture_zoom, ELM_GESTURE_STATE_END,
2676 &st->info, EINA_FALSE); 2679 &st->info, EINA_FALSE);
2677 return; 2680 return;
2678 } 2681 }
2679 /* END For contiunues gesture: compute momentum */ 2682 } /* END For contiunues gesture: compute momentum */
2680 2683
2681 2684
2682 if (d >= wd->zoom_step) 2685 if (d >= wd->zoom_step)
@@ -2907,22 +2910,23 @@ _rotate_test(Evas_Object *obj, Pointer_Event *pe, void *event_info,
2907 if (d < 0.0) 2910 if (d < 0.0)
2908 d = (-d); 2911 d = (-d);
2909 2912
2910 /* START For contiunues gesture: compute momentum */ 2913 if (wd->glayer_continues_enable)
2911 _set_momentum(&st->momentum1, st->rotate_st.x, st->rotate_st.y, 2914 { /* START For contiunues gesture: compute momentum */
2912 st->rotate_mv.x, st->rotate_mv.y,st->rotate_st.timestamp, st->rotate_st.timestamp, 2915 _set_momentum(&st->momentum1, st->rotate_st.x, st->rotate_st.y,
2913 st->rotate_mv.timestamp); 2916 st->rotate_mv.x, st->rotate_mv.y,st->rotate_st.timestamp, st->rotate_st.timestamp,
2917 st->rotate_mv.timestamp);
2914 2918
2915 _set_momentum(&st->momentum2, st->rotate_st1.x, st->rotate_st1.y, 2919 _set_momentum(&st->momentum2, st->rotate_st1.x, st->rotate_st1.y,
2916 st->rotate_mv1.x, st->rotate_mv1.y,st->rotate_st1.timestamp, st->rotate_st1.timestamp, 2920 st->rotate_mv1.x, st->rotate_mv1.y,st->rotate_st1.timestamp, st->rotate_st1.timestamp,
2917 st->rotate_mv1.timestamp); 2921 st->rotate_mv1.timestamp);
2918 2922
2919 if (!(st->momentum1.mx + st->momentum1.my + st->momentum2.mx + st->momentum2.my)) 2923 if (!(st->momentum1.mx + st->momentum1.my + st->momentum2.mx + st->momentum2.my))
2920 { 2924 {
2921 ev_flag = _set_state(gesture, ELM_GESTURE_STATE_END, 2925 ev_flag = _set_state(gesture, ELM_GESTURE_STATE_END,
2922 &st->info, EINA_FALSE); 2926 &st->info, EINA_FALSE);
2923 return; 2927 return;
2924 } 2928 }
2925 /* END For contiunues gesture: compute momentum */ 2929 } /* END For contiunues gesture: compute momentum */
2926 2930
2927 if (d >= wd->rotate_step) 2931 if (d >= wd->rotate_step)
2928 { /* Report move in steps */ 2932 { /* Report move in steps */
@@ -3234,7 +3238,8 @@ _event_process(void *data, Evas_Object *obj __UNUSED__,
3234 3238
3235 /* Report current states and clear history if needed */ 3239 /* Report current states and clear history if needed */
3236 Eina_Bool states_reset = _clear_if_finished(data); 3240 Eina_Bool states_reset = _clear_if_finished(data);
3237 continues_gestures_restart(data, states_reset); 3241 if (wd->glayer_continues_enable)
3242 continues_gestures_restart(data, states_reset);
3238} 3243}
3239 3244
3240 3245
@@ -3464,10 +3469,11 @@ elm_gesture_layer_add(Evas_Object *parent)
3464 wd->flick_time_limit_ms = _elm_config->glayer_flick_time_limit_ms; 3469 wd->flick_time_limit_ms = _elm_config->glayer_flick_time_limit_ms;
3465 wd->long_tap_start_timeout = _elm_config->glayer_long_tap_start_timeout; 3470 wd->long_tap_start_timeout = _elm_config->glayer_long_tap_start_timeout;
3466 wd->repeat_events = EINA_TRUE; 3471 wd->repeat_events = EINA_TRUE;
3472 wd->glayer_continues_enable = _elm_config->glayer_continues_enable;
3467 3473
3468#if defined(DEBUG_GESTURE_LAYER) 3474#if defined(DEBUG_GESTURE_LAYER)
3469 printf("size of Gestures = <%d>\n", sizeof(wd->gesture)); 3475 printf("size of Gestures = <%d>\n", sizeof(wd->gesture));
3470 printf("initial values:\n\tzoom_finger_factor=<%f>\n\tzoom_distance_tolerance=<%d>\n\tline_min_length=<%d>\n\tline_distance_tolerance=<%d>\n\tzoom_wheel_factor=<%f>\n\trotate_angular_tolerance=<%f>\n\twd->line_angular_tolerance=<%f>\n\twd->flick_time_limit_ms=<%d>\n\twd->long_tap_start_timeout=<%f>\n\twd->zoom_step=<%f>\n\twd->rotate_step=<%f>\n", wd->zoom_finger_factor, wd->zoom_distance_tolerance, wd->line_min_length, wd->line_distance_tolerance, wd->zoom_wheel_factor, wd->rotate_angular_tolerance, wd->line_angular_tolerance, wd->flick_time_limit_ms, wd->long_tap_start_timeout, wd->zoom_step, wd->rotate_step); 3476 printf("initial values:\n\tzoom_finger_factor=<%f>\n\tzoom_distance_tolerance=<%d>\n\tline_min_length=<%d>\n\tline_distance_tolerance=<%d>\n\tzoom_wheel_factor=<%f>\n\trotate_angular_tolerance=<%f>\n\twd->line_angular_tolerance=<%f>\n\twd->flick_time_limit_ms=<%d>\n\twd->long_tap_start_timeout=<%f>\n\twd->zoom_step=<%f>\n\twd->rotate_step=<%f>\n\twd->glayer_continues_enable=<%d>\n ", wd->zoom_finger_factor, wd->zoom_distance_tolerance, wd->line_min_length, wd->line_distance_tolerance, wd->zoom_wheel_factor, wd->rotate_angular_tolerance, wd->line_angular_tolerance, wd->flick_time_limit_ms, wd->long_tap_start_timeout, wd->zoom_step, wd->rotate_step, wd->glayer_continues_enable);
3471#endif 3477#endif
3472 memset(wd->gesture, 0, sizeof(wd->gesture)); 3478 memset(wd->gesture, 0, sizeof(wd->gesture));
3473 3479
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 42ae2dd37..06c84c42a 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -144,6 +144,7 @@ struct _Elm_Config
144 unsigned int glayer_flick_time_limit_ms; 144 unsigned int glayer_flick_time_limit_ms;
145 double glayer_long_tap_start_timeout; 145 double glayer_long_tap_start_timeout;
146 int access_mode; 146 int access_mode;
147 Eina_Bool glayer_continues_enable;
147}; 148};
148 149
149struct _Elm_Module 150struct _Elm_Module