summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-01-30 11:46:59 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 09:20:30 +0100
commit151ec0748a5398ccdf6a802c913b2ed3876238a0 (patch)
treec680bdb964513f212bb7032bdfc71cbcdef6cb1b
parent23678b3695c4e0976afb3949dff19c85878e213b (diff)
efl/config: merge all gesture manager config code into efl.config
this is all just duplicated code, so we can deduplicate it with minimal effort to clean up the api Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11251
-rw-r--r--src/lib/efl/interfaces/efl_config.eo3
-rw-r--r--src/lib/elementary/efl_ui_win.c22
-rw-r--r--src/lib/elementary/elm_config.c5
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.c15
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.eo3
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer.c2
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo4
-rw-r--r--src/tests/elementary/efl_ui_test_gesture.c2
8 files changed, 37 insertions, 19 deletions
diff --git a/src/lib/efl/interfaces/efl_config.eo b/src/lib/efl/interfaces/efl_config.eo
index afbe38e..4494564 100644
--- a/src/lib/efl/interfaces/efl_config.eo
+++ b/src/lib/efl/interfaces/efl_config.eo
@@ -27,6 +27,9 @@ interface @beta Efl.Config
27 } 27 }
28 } 28 }
29 } 29 }
30 events {
31 config,changed: string; [[Called when a config value has been changed for the manager object. Passed string is the name of the value or NULL if all values were changed.]]
32 }
30} 33}
31 34
32/* NOTES: 35/* NOTES:
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index a926bdc..d7a6439 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -5148,43 +5148,43 @@ static void
5148_gesture_manager_config_load(Eo *obj) 5148_gesture_manager_config_load(Eo *obj)
5149{ 5149{
5150 Eina_Value val; 5150 Eina_Value val;
5151 Efl_Canvas_Gesture_Manager *gm = efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS); 5151 Eo *gm = efl_provider_find(obj, EFL_CONFIG_INTERFACE);
5152 5152
5153 eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE); 5153 eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
5154 eina_value_set(&val, _elm_config->glayer_long_tap_start_timeout); 5154 eina_value_set(&val, _elm_config->glayer_long_tap_start_timeout);
5155 efl_gesture_manager_config_set(gm, "glayer_long_tap_start_timeout", &val); 5155 efl_config_set(gm, "glayer_long_tap_start_timeout", &val);
5156 5156
5157 eina_value_set(&val, _elm_config->glayer_double_tap_timeout); 5157 eina_value_set(&val, _elm_config->glayer_double_tap_timeout);
5158 efl_gesture_manager_config_set(gm, "glayer_double_tap_timeout", &val); 5158 efl_config_set(gm, "glayer_double_tap_timeout", &val);
5159 5159
5160 elm_config_scroll_thumbscroll_friction_set(_elm_config->thumbscroll_friction); 5160 elm_config_scroll_thumbscroll_friction_set(_elm_config->thumbscroll_friction);
5161 elm_config_scroll_thumbscroll_momentum_threshold_set(_elm_config->thumbscroll_momentum_threshold); 5161 elm_config_scroll_thumbscroll_momentum_threshold_set(_elm_config->thumbscroll_momentum_threshold);
5162 5162
5163 eina_value_set(&val, _elm_config->glayer_line_min_length); 5163 eina_value_set(&val, _elm_config->glayer_line_min_length);
5164 efl_gesture_manager_config_set(gm, "glayer_line_min_length", &val); 5164 efl_config_set(gm, "glayer_line_min_length", &val);
5165 5165
5166 eina_value_set(&val, _elm_config->glayer_line_distance_tolerance); 5166 eina_value_set(&val, _elm_config->glayer_line_distance_tolerance);
5167 efl_gesture_manager_config_set(gm, "glayer_line_distance_tolerance", &val); 5167 efl_config_set(gm, "glayer_line_distance_tolerance", &val);
5168 5168
5169 eina_value_set(&val, _elm_config->glayer_line_angular_tolerance); 5169 eina_value_set(&val, _elm_config->glayer_line_angular_tolerance);
5170 efl_gesture_manager_config_set(gm, "glayer_line_angular_tolerance", &val); 5170 efl_config_set(gm, "glayer_line_angular_tolerance", &val);
5171 5171
5172 eina_value_set(&val, _elm_config->glayer_zoom_finger_factor); 5172 eina_value_set(&val, _elm_config->glayer_zoom_finger_factor);
5173 efl_gesture_manager_config_set(gm, "glayer_zoom_finger_factor", &val); 5173 efl_config_set(gm, "glayer_zoom_finger_factor", &val);
5174 5174
5175 eina_value_set(&val, _elm_config->glayer_zoom_distance_tolerance); 5175 eina_value_set(&val, _elm_config->glayer_zoom_distance_tolerance);
5176 efl_gesture_manager_config_set(gm, "glayer_zoom_distance_tolerance", &val); 5176 efl_config_set(gm, "glayer_zoom_distance_tolerance", &val);
5177 5177
5178 eina_value_setup(&val, EINA_VALUE_TYPE_UINT); 5178 eina_value_setup(&val, EINA_VALUE_TYPE_UINT);
5179 eina_value_set(&val, _elm_config->glayer_flick_time_limit_ms); 5179 eina_value_set(&val, _elm_config->glayer_flick_time_limit_ms);
5180 efl_gesture_manager_config_set(gm, "glayer_flick_time_limit_ms", &val); 5180 efl_config_set(gm, "glayer_flick_time_limit_ms", &val);
5181 5181
5182 eina_value_setup(&val, EINA_VALUE_TYPE_UCHAR); 5182 eina_value_setup(&val, EINA_VALUE_TYPE_UCHAR);
5183 eina_value_set(&val, _elm_config->glayer_continues_enable); 5183 eina_value_set(&val, _elm_config->glayer_continues_enable);
5184 efl_gesture_manager_config_set(gm, "glayer_continues_enable", &val); 5184 efl_config_set(gm, "glayer_continues_enable", &val);
5185 5185
5186 eina_value_set(&val, _elm_config->glayer_zoom_finger_enable); 5186 eina_value_set(&val, _elm_config->glayer_zoom_finger_enable);
5187 efl_gesture_manager_config_set(gm, "glayer_zoom_finger_enable", &val); 5187 efl_config_set(gm, "glayer_zoom_finger_enable", &val);
5188} 5188}
5189 5189
5190static Eo * 5190static Eo *
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index f6ff33c..a78f9b0 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -2053,6 +2053,7 @@ _config_flush_get(void)
2053 _elm_config_key_binding_hash(); 2053 _elm_config_key_binding_hash();
2054 _elm_win_access(_elm_config->access_mode); 2054 _elm_win_access(_elm_config->access_mode);
2055 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); 2055 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
2056 efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, NULL);
2056} 2057}
2057 2058
2058static const char * 2059static const char *
@@ -4509,6 +4510,7 @@ _elm_config_reload(void)
4509 _elm_old_clouseau_reload(); 4510 _elm_old_clouseau_reload();
4510 _elm_config_key_binding_hash(); 4511 _elm_config_key_binding_hash();
4511 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); 4512 ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
4513 efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, NULL);
4512 if (ptheme) eina_stringshare_del(ptheme); 4514 if (ptheme) eina_stringshare_del(ptheme);
4513 if (pmodules) eina_stringshare_del(pmodules); 4515 if (pmodules) eina_stringshare_del(pmodules);
4514 if (picon_theme) eina_stringshare_del(picon_theme); 4516 if (picon_theme) eina_stringshare_del(picon_theme);
@@ -4936,6 +4938,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
4936 return EINA_FALSE; \ 4938 return EINA_FALSE; \
4937 } \ 4939 } \
4938 elm_config_ ## opt ## _set(v); \ 4940 elm_config_ ## opt ## _set(v); \
4941 efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); \
4939 return EINA_TRUE; \ 4942 return EINA_TRUE; \
4940 } \ 4943 } \
4941 } while (0) 4944 } while (0)
@@ -4972,6 +4975,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
4972 return EINA_FALSE; \ 4975 return EINA_FALSE; \
4973 } \ 4976 } \
4974 elm_config_ ## opt ## _set(v); \ 4977 elm_config_ ## opt ## _set(v); \
4978 efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); \
4975 return EINA_TRUE; \ 4979 return EINA_TRUE; \
4976 } \ 4980 } \
4977 } while (0) 4981 } while (0)
@@ -5073,6 +5077,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
5073 } 5077 }
5074 elm_config_audio_mute_set(chan, !!v); 5078 elm_config_audio_mute_set(chan, !!v);
5075#ifdef ENABLE_MULTISENSE 5079#ifdef ENABLE_MULTISENSE
5080 efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name);
5076 return EINA_TRUE; 5081 return EINA_TRUE;
5077#else 5082#else
5078 return EINA_FALSE; 5083 return EINA_FALSE;
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
index 6399227..9bed44d 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
@@ -97,6 +97,15 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size)
97 zd->finger_size = finger_size; 97 zd->finger_size = finger_size;
98} 98}
99 99
100static void
101_gesture_manager_config_changed(void *data, const Efl_Event *ev)
102{
103 Efl_Canvas_Gesture_Manager_Data *pd = data;
104
105 if ((!ev->info) || eina_streq(ev->info, "glayer_tap_finger_size"))
106 _update_finger_sizes(pd, efl_config_int_get(ev->object, "glayer_tap_finger_size"));
107}
108
100EOLIAN static Efl_Object * 109EOLIAN static Efl_Object *
101_efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd) 110_efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd)
102{ 111{
@@ -112,6 +121,7 @@ _efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_M
112 /* this needs to always be present */ 121 /* this needs to always be present */
113 config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE); 122 config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE);
114 efl_config_int_set(config, "glayer_tap_finger_size", EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE); 123 efl_config_int_set(config, "glayer_tap_finger_size", EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE);
124 efl_event_callback_add(config, EFL_CONFIG_EVENT_CONFIG_CHANGED, _gesture_manager_config_changed, pd);
115 125
116 //Register all types of recognizers at very first time. 126 //Register all types of recognizers at very first time.
117 efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS, obj)); 127 efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS, obj));
@@ -127,10 +137,13 @@ _efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_M
127} 137}
128 138
129EOLIAN static void 139EOLIAN static void
130_efl_canvas_gesture_manager_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd EINA_UNUSED) 140_efl_canvas_gesture_manager_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd)
131{ 141{
132 Efl_Canvas_Gesture_Recognizer *recognizer; 142 Efl_Canvas_Gesture_Recognizer *recognizer;
133 void *ptr; 143 void *ptr;
144 Eo *config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE);
145 if (config)
146 efl_event_callback_del(config, EFL_CONFIG_EVENT_CONFIG_CHANGED, _gesture_manager_config_changed, pd);
134 147
135 eina_hash_free(pd->m_recognizers); 148 eina_hash_free(pd->m_recognizers);
136 EINA_LIST_FREE(pd->custom_recognizers, recognizer) 149 EINA_LIST_FREE(pd->custom_recognizers, recognizer)
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
index 04e08f2..2dad839 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
@@ -30,9 +30,6 @@ class @beta Efl.Canvas.Gesture_Manager extends Efl.Object
30 } 30 }
31 } 31 }
32 } 32 }
33 events {
34 config,changed: string; [[Called when a config value has been changed for the manager object. Passed string is the name of the value.]]
35 }
36 implements { 33 implements {
37 Efl.Object.constructor; 34 Efl.Object.constructor;
38 Efl.Object.destructor; 35 Efl.Object.destructor;
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c
index 995217c..8369295 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c
@@ -7,7 +7,7 @@
7Eina_Value * 7Eina_Value *
8_recognizer_config_get(const Eo *obj, const char *name) 8_recognizer_config_get(const Eo *obj, const char *name)
9{ 9{
10 Eo *config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE); 10 Eo *config = efl_provider_find(obj, EFL_CONFIG_INTERFACE);
11 EINA_SAFETY_ON_NULL_RETURN_VAL(config, NULL); 11 EINA_SAFETY_ON_NULL_RETURN_VAL(config, NULL);
12 return efl_config_get(config, name); 12 return efl_config_get(config, name);
13} 13}
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo
index 17fb52a..4f5ee45 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo
@@ -7,8 +7,8 @@ abstract @beta Efl.Canvas.Gesture_Recognizer extends Efl.Object
7 Gesture recognizers listen to events that occur on a target object 7 Gesture recognizers listen to events that occur on a target object
8 to see if a particular gesture has occurred. 8 to see if a particular gesture has occurred.
9 9
10 Recognizer-specific configuration values can be modified through @Efl.Canvas.Gesture_Manager.config, 10 Recognizer-specific configuration values can be modified through @Efl.Config.config,
11 and the recognizer's manager can be found using @Efl.Object.provider_find. 11 and the global config object can be found using @Efl.Object.provider_find.
12 Default configuration values are taken from the system's configuration. 12 Default configuration values are taken from the system's configuration.
13 ]] 13 ]]
14 c_prefix: efl_gesture_recognizer; 14 c_prefix: efl_gesture_recognizer;
diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c
index fdd5f16..db730f7 100644
--- a/src/tests/elementary/efl_ui_test_gesture.c
+++ b/src/tests/elementary/efl_ui_test_gesture.c
@@ -202,7 +202,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap)
202 Eina_Value *val; 202 Eina_Value *val;
203 Eo *e = efl_provider_find(rect, EVAS_CANVAS_CLASS); 203 Eo *e = efl_provider_find(rect, EVAS_CANVAS_CLASS);
204 204
205 val = efl_gesture_manager_config_get(efl_provider_find(rect, EFL_CANVAS_GESTURE_MANAGER_CLASS), "glayer_long_tap_start_timeout"); 205 val = efl_config_get(efl_provider_find(rect, EFL_CONFIG_INTERFACE), "glayer_long_tap_start_timeout");
206 eina_value_get(val, &timeout); 206 eina_value_get(val, &timeout);
207 207
208 /* press */ 208 /* press */