forked from enlightenment/efl
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
This commit is contained in:
parent
23678b3695
commit
151ec0748a
|
@ -27,6 +27,9 @@ interface @beta Efl.Config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
events {
|
||||||
|
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.]]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTES:
|
/* NOTES:
|
||||||
|
|
|
@ -5148,43 +5148,43 @@ static void
|
||||||
_gesture_manager_config_load(Eo *obj)
|
_gesture_manager_config_load(Eo *obj)
|
||||||
{
|
{
|
||||||
Eina_Value val;
|
Eina_Value val;
|
||||||
Efl_Canvas_Gesture_Manager *gm = efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS);
|
Eo *gm = efl_provider_find(obj, EFL_CONFIG_INTERFACE);
|
||||||
|
|
||||||
eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
|
eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
|
||||||
eina_value_set(&val, _elm_config->glayer_long_tap_start_timeout);
|
eina_value_set(&val, _elm_config->glayer_long_tap_start_timeout);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_long_tap_start_timeout", &val);
|
efl_config_set(gm, "glayer_long_tap_start_timeout", &val);
|
||||||
|
|
||||||
eina_value_set(&val, _elm_config->glayer_double_tap_timeout);
|
eina_value_set(&val, _elm_config->glayer_double_tap_timeout);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_double_tap_timeout", &val);
|
efl_config_set(gm, "glayer_double_tap_timeout", &val);
|
||||||
|
|
||||||
elm_config_scroll_thumbscroll_friction_set(_elm_config->thumbscroll_friction);
|
elm_config_scroll_thumbscroll_friction_set(_elm_config->thumbscroll_friction);
|
||||||
elm_config_scroll_thumbscroll_momentum_threshold_set(_elm_config->thumbscroll_momentum_threshold);
|
elm_config_scroll_thumbscroll_momentum_threshold_set(_elm_config->thumbscroll_momentum_threshold);
|
||||||
|
|
||||||
eina_value_set(&val, _elm_config->glayer_line_min_length);
|
eina_value_set(&val, _elm_config->glayer_line_min_length);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_line_min_length", &val);
|
efl_config_set(gm, "glayer_line_min_length", &val);
|
||||||
|
|
||||||
eina_value_set(&val, _elm_config->glayer_line_distance_tolerance);
|
eina_value_set(&val, _elm_config->glayer_line_distance_tolerance);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_line_distance_tolerance", &val);
|
efl_config_set(gm, "glayer_line_distance_tolerance", &val);
|
||||||
|
|
||||||
eina_value_set(&val, _elm_config->glayer_line_angular_tolerance);
|
eina_value_set(&val, _elm_config->glayer_line_angular_tolerance);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_line_angular_tolerance", &val);
|
efl_config_set(gm, "glayer_line_angular_tolerance", &val);
|
||||||
|
|
||||||
eina_value_set(&val, _elm_config->glayer_zoom_finger_factor);
|
eina_value_set(&val, _elm_config->glayer_zoom_finger_factor);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_zoom_finger_factor", &val);
|
efl_config_set(gm, "glayer_zoom_finger_factor", &val);
|
||||||
|
|
||||||
eina_value_set(&val, _elm_config->glayer_zoom_distance_tolerance);
|
eina_value_set(&val, _elm_config->glayer_zoom_distance_tolerance);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_zoom_distance_tolerance", &val);
|
efl_config_set(gm, "glayer_zoom_distance_tolerance", &val);
|
||||||
|
|
||||||
eina_value_setup(&val, EINA_VALUE_TYPE_UINT);
|
eina_value_setup(&val, EINA_VALUE_TYPE_UINT);
|
||||||
eina_value_set(&val, _elm_config->glayer_flick_time_limit_ms);
|
eina_value_set(&val, _elm_config->glayer_flick_time_limit_ms);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_flick_time_limit_ms", &val);
|
efl_config_set(gm, "glayer_flick_time_limit_ms", &val);
|
||||||
|
|
||||||
eina_value_setup(&val, EINA_VALUE_TYPE_UCHAR);
|
eina_value_setup(&val, EINA_VALUE_TYPE_UCHAR);
|
||||||
eina_value_set(&val, _elm_config->glayer_continues_enable);
|
eina_value_set(&val, _elm_config->glayer_continues_enable);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_continues_enable", &val);
|
efl_config_set(gm, "glayer_continues_enable", &val);
|
||||||
|
|
||||||
eina_value_set(&val, _elm_config->glayer_zoom_finger_enable);
|
eina_value_set(&val, _elm_config->glayer_zoom_finger_enable);
|
||||||
efl_gesture_manager_config_set(gm, "glayer_zoom_finger_enable", &val);
|
efl_config_set(gm, "glayer_zoom_finger_enable", &val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eo *
|
static Eo *
|
||||||
|
|
|
@ -2053,6 +2053,7 @@ _config_flush_get(void)
|
||||||
_elm_config_key_binding_hash();
|
_elm_config_key_binding_hash();
|
||||||
_elm_win_access(_elm_config->access_mode);
|
_elm_win_access(_elm_config->access_mode);
|
||||||
ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
|
ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
|
||||||
|
efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
|
@ -4509,6 +4510,7 @@ _elm_config_reload(void)
|
||||||
_elm_old_clouseau_reload();
|
_elm_old_clouseau_reload();
|
||||||
_elm_config_key_binding_hash();
|
_elm_config_key_binding_hash();
|
||||||
ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
|
ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL);
|
||||||
|
efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, NULL);
|
||||||
if (ptheme) eina_stringshare_del(ptheme);
|
if (ptheme) eina_stringshare_del(ptheme);
|
||||||
if (pmodules) eina_stringshare_del(pmodules);
|
if (pmodules) eina_stringshare_del(pmodules);
|
||||||
if (picon_theme) eina_stringshare_del(picon_theme);
|
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
|
||||||
return EINA_FALSE; \
|
return EINA_FALSE; \
|
||||||
} \
|
} \
|
||||||
elm_config_ ## opt ## _set(v); \
|
elm_config_ ## opt ## _set(v); \
|
||||||
|
efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); \
|
||||||
return EINA_TRUE; \
|
return EINA_TRUE; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -4972,6 +4975,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
|
||||||
return EINA_FALSE; \
|
return EINA_FALSE; \
|
||||||
} \
|
} \
|
||||||
elm_config_ ## opt ## _set(v); \
|
elm_config_ ## opt ## _set(v); \
|
||||||
|
efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name); \
|
||||||
return EINA_TRUE; \
|
return EINA_TRUE; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -5073,6 +5077,7 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
|
||||||
}
|
}
|
||||||
elm_config_audio_mute_set(chan, !!v);
|
elm_config_audio_mute_set(chan, !!v);
|
||||||
#ifdef ENABLE_MULTISENSE
|
#ifdef ENABLE_MULTISENSE
|
||||||
|
efl_event_callback_call(_efl_config_obj, EFL_CONFIG_EVENT_CONFIG_CHANGED, (void*)name);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
#else
|
#else
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
|
@ -97,6 +97,15 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size)
|
||||||
zd->finger_size = finger_size;
|
zd->finger_size = finger_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gesture_manager_config_changed(void *data, const Efl_Event *ev)
|
||||||
|
{
|
||||||
|
Efl_Canvas_Gesture_Manager_Data *pd = data;
|
||||||
|
|
||||||
|
if ((!ev->info) || eina_streq(ev->info, "glayer_tap_finger_size"))
|
||||||
|
_update_finger_sizes(pd, efl_config_int_get(ev->object, "glayer_tap_finger_size"));
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Object *
|
EOLIAN static Efl_Object *
|
||||||
_efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd)
|
_efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd)
|
||||||
{
|
{
|
||||||
|
@ -112,6 +121,7 @@ _efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_M
|
||||||
/* this needs to always be present */
|
/* this needs to always be present */
|
||||||
config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE);
|
config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE);
|
||||||
efl_config_int_set(config, "glayer_tap_finger_size", EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE);
|
efl_config_int_set(config, "glayer_tap_finger_size", EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE);
|
||||||
|
efl_event_callback_add(config, EFL_CONFIG_EVENT_CONFIG_CHANGED, _gesture_manager_config_changed, pd);
|
||||||
|
|
||||||
//Register all types of recognizers at very first time.
|
//Register all types of recognizers at very first time.
|
||||||
efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS, obj));
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_gesture_manager_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd EINA_UNUSED)
|
_efl_canvas_gesture_manager_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Manager_Data *pd)
|
||||||
{
|
{
|
||||||
Efl_Canvas_Gesture_Recognizer *recognizer;
|
Efl_Canvas_Gesture_Recognizer *recognizer;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
Eo *config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE);
|
||||||
|
if (config)
|
||||||
|
efl_event_callback_del(config, EFL_CONFIG_EVENT_CONFIG_CHANGED, _gesture_manager_config_changed, pd);
|
||||||
|
|
||||||
eina_hash_free(pd->m_recognizers);
|
eina_hash_free(pd->m_recognizers);
|
||||||
EINA_LIST_FREE(pd->custom_recognizers, recognizer)
|
EINA_LIST_FREE(pd->custom_recognizers, recognizer)
|
||||||
|
|
|
@ -30,9 +30,6 @@ class @beta Efl.Canvas.Gesture_Manager extends Efl.Object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
events {
|
|
||||||
config,changed: string; [[Called when a config value has been changed for the manager object. Passed string is the name of the value.]]
|
|
||||||
}
|
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
Eina_Value *
|
Eina_Value *
|
||||||
_recognizer_config_get(const Eo *obj, const char *name)
|
_recognizer_config_get(const Eo *obj, const char *name)
|
||||||
{
|
{
|
||||||
Eo *config = efl_provider_find(efl_main_loop_get(), EFL_CONFIG_INTERFACE);
|
Eo *config = efl_provider_find(obj, EFL_CONFIG_INTERFACE);
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(config, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(config, NULL);
|
||||||
return efl_config_get(config, name);
|
return efl_config_get(config, name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ abstract @beta Efl.Canvas.Gesture_Recognizer extends Efl.Object
|
||||||
Gesture recognizers listen to events that occur on a target object
|
Gesture recognizers listen to events that occur on a target object
|
||||||
to see if a particular gesture has occurred.
|
to see if a particular gesture has occurred.
|
||||||
|
|
||||||
Recognizer-specific configuration values can be modified through @Efl.Canvas.Gesture_Manager.config,
|
Recognizer-specific configuration values can be modified through @Efl.Config.config,
|
||||||
and the recognizer's manager can be found using @Efl.Object.provider_find.
|
and the global config object can be found using @Efl.Object.provider_find.
|
||||||
Default configuration values are taken from the system's configuration.
|
Default configuration values are taken from the system's configuration.
|
||||||
]]
|
]]
|
||||||
c_prefix: efl_gesture_recognizer;
|
c_prefix: efl_gesture_recognizer;
|
||||||
|
|
|
@ -202,7 +202,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap)
|
||||||
Eina_Value *val;
|
Eina_Value *val;
|
||||||
Eo *e = efl_provider_find(rect, EVAS_CANVAS_CLASS);
|
Eo *e = efl_provider_find(rect, EVAS_CANVAS_CLASS);
|
||||||
|
|
||||||
val = efl_gesture_manager_config_get(efl_provider_find(rect, EFL_CANVAS_GESTURE_MANAGER_CLASS), "glayer_long_tap_start_timeout");
|
val = efl_config_get(efl_provider_find(rect, EFL_CONFIG_INTERFACE), "glayer_long_tap_start_timeout");
|
||||||
eina_value_get(val, &timeout);
|
eina_value_get(val, &timeout);
|
||||||
|
|
||||||
/* press */
|
/* press */
|
||||||
|
|
Loading…
Reference in New Issue