forked from enlightenment/efl
Entry: Context Menu is now configurable
Summary: Added a config variable Context_Menu_Disabled to make the appearance of the context menu configurable. @feature Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com> Reviewers: Hermet, SanghyeonLee, raster, singh.amitesh Subscribers: stefan_schmidt, alok25, cedric, thiepha, sachin.dev Differential Revision: https://phab.enlightenment.org/D2463
This commit is contained in:
parent
5a3ca38701
commit
394a7e1d4d
|
@ -54,6 +54,7 @@ group "Elm_Config" struct {
|
|||
value "longpress_timeout" double: 1.0;
|
||||
value "effect_enable" uchar: 1;
|
||||
value "desktop_entry" uchar: 0;
|
||||
value "context_menu_disabled" uchar: 0;
|
||||
value "password_show_last" uchar: 0;
|
||||
value "password_show_last_timeout" double: 2.0;
|
||||
value "glayer_zoom_finger_enable" uchar: 1;
|
||||
|
|
|
@ -54,6 +54,7 @@ group "Elm_Config" struct {
|
|||
value "longpress_timeout" double: 1.0;
|
||||
value "effect_enable" uchar: 1;
|
||||
value "desktop_entry" uchar: 0;
|
||||
value "context_menu_disabled" uchar: 0;
|
||||
value "password_show_last" uchar: 1;
|
||||
value "password_show_last_timeout" double: 2.0;
|
||||
value "glayer_zoom_finger_enable" uchar: 1;
|
||||
|
|
|
@ -55,6 +55,7 @@ group "Elm_Config" struct {
|
|||
value "longpress_timeout" double: 1.0;
|
||||
value "effect_enable" uchar: 1;
|
||||
value "desktop_entry" uchar: 1;
|
||||
value "context_menu_disabled" uchar: 1;
|
||||
value "password_show_last" uchar: 0;
|
||||
value "password_show_last_timeout" double: 2.0;
|
||||
value "glayer_zoom_finger_enable" uchar: 1;
|
||||
|
|
|
@ -82,10 +82,19 @@ my_entry_bt_7(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UN
|
|||
elm_entry_editable_set(en, !elm_entry_editable_get(en));
|
||||
}
|
||||
|
||||
static void
|
||||
changed_cb1(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *ck = data;
|
||||
printf("ck %p to %i\n", obj, elm_check_state_get(obj));
|
||||
elm_config_context_menu_disabled_set(elm_check_state_get(obj));
|
||||
printf("ck2 %p is now %i\n", ck, elm_check_state_get(ck));
|
||||
}
|
||||
|
||||
void
|
||||
test_entry(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *win, *bx, *bx2, *bt, *en;
|
||||
Evas_Object *win, *bx, *bx2, *bt, *en, *ck;
|
||||
char buf[4096];
|
||||
|
||||
win = elm_win_util_standard_add("entry", "Entry");
|
||||
|
@ -204,6 +213,12 @@ test_entry(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
|
|||
elm_object_focus_allow_set(bt, EINA_FALSE);
|
||||
evas_object_show(bt);
|
||||
|
||||
ck = elm_check_add(win);
|
||||
elm_object_text_set(ck, "Context Menu Disable");
|
||||
evas_object_smart_callback_add(ck, "changed", changed_cb1, ck);
|
||||
elm_box_pack_end(bx, ck);
|
||||
evas_object_show(ck);
|
||||
|
||||
elm_box_pack_end(bx, bx2);
|
||||
evas_object_show(bx2);
|
||||
|
||||
|
|
|
@ -375,6 +375,7 @@ _desc_init(void)
|
|||
ELM_CONFIG_VAL(D, T, focus_highlight_clip_disable, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, focus_autoscroll_mode, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, context_menu_disabled, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, slider_indicator_visible_mode, T_INT);
|
||||
ELM_CONFIG_VAL(D, T, item_select_on_focus_disable, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, first_item_focus_on_first_focus_in, T_UCHAR);
|
||||
|
@ -1416,6 +1417,7 @@ _config_load(void)
|
|||
_elm_config->longpress_timeout = 1.0;
|
||||
_elm_config->effect_enable = EINA_TRUE;
|
||||
_elm_config->desktop_entry = EINA_FALSE;
|
||||
_elm_config->context_menu_disabled = EINA_FALSE;
|
||||
_elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
|
||||
_elm_config->password_show_last = EINA_FALSE;
|
||||
_elm_config->password_show_last_timeout = 2.0;
|
||||
|
@ -2099,6 +2101,9 @@ _env_get(void)
|
|||
s = getenv("ELM_ICON_SIZE");
|
||||
if (s) _elm_config->icon_size = atoi(s);
|
||||
|
||||
s = getenv("ELM_CONTEXT_MENU_DISABLED");
|
||||
if (s) _elm_config->context_menu_disabled = !!atoi(s);
|
||||
|
||||
s = getenv("ELM_LONGPRESS_TIMEOUT");
|
||||
if (s) _elm_config->longpress_timeout = _elm_atof(s);
|
||||
if (_elm_config->longpress_timeout < 0.0)
|
||||
|
@ -2895,6 +2900,18 @@ elm_config_scroll_thumbscroll_sensitivity_friction_get(void)
|
|||
return _elm_config->thumbscroll_sensitivity_friction;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_config_context_menu_disabled_get(void)
|
||||
{
|
||||
return _elm_config->context_menu_disabled;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_config_context_menu_disabled_set(Eina_Bool enabled)
|
||||
{
|
||||
_elm_config->context_menu_disabled = !!enabled;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_config_scroll_thumbscroll_sensitivity_friction_set(double friction)
|
||||
{
|
||||
|
|
|
@ -215,6 +215,26 @@ EAPI double elm_config_scroll_page_scroll_friction_get(void);
|
|||
*/
|
||||
EAPI void elm_config_scroll_page_scroll_friction_set(double friction);
|
||||
|
||||
/**
|
||||
* Get enable status of context menu disabled.
|
||||
*
|
||||
* @see elm_config_context_menu_disabled_set()
|
||||
* @ingroup Entry
|
||||
* @since 1.17
|
||||
*/
|
||||
EAPI Eina_Bool elm_config_context_menu_disabled_get(void);
|
||||
|
||||
/**
|
||||
* Set enable status of context menu disabled.
|
||||
*
|
||||
* @param enabled enable context menu if @c EINA_TRUE, disable otherwise
|
||||
*
|
||||
* @see elm_config_focus_auto_scroll_bring_in_enabled_get()
|
||||
* @ingroup Entry
|
||||
* @since 1.17
|
||||
*/
|
||||
EAPI void elm_config_context_menu_disabled_set(Eina_Bool enabled);
|
||||
|
||||
/**
|
||||
* Get the amount of inertia a scroller will impose at region bring
|
||||
* animations.
|
||||
|
|
|
@ -1776,7 +1776,10 @@ _long_press_cb(void *data)
|
|||
_magnifier_show(data);
|
||||
_magnifier_move(data, sd->downx, sd->downy);
|
||||
}
|
||||
else if (!_elm_config->desktop_entry)
|
||||
/* Context menu will not appear if context menu disabled is set
|
||||
* as false on a long press callback */
|
||||
else if (!_elm_config->context_menu_disabled &&
|
||||
(!_elm_config->desktop_entry))
|
||||
_menu_call(data);
|
||||
|
||||
sd->long_pressed = EINA_TRUE;
|
||||
|
@ -1795,8 +1798,9 @@ _key_down_cb(void *data,
|
|||
void *event_info)
|
||||
{
|
||||
Evas_Event_Key_Down *ev = event_info;
|
||||
|
||||
if (!strcmp(ev->key, "Menu"))
|
||||
/* First check if context menu disabled is false or not, and
|
||||
* then check for key id */
|
||||
if ((!_elm_config->context_menu_disabled) && !strcmp(ev->key, "Menu"))
|
||||
_menu_call(data);
|
||||
}
|
||||
|
||||
|
@ -1822,7 +1826,9 @@ _mouse_down_cb(void *data,
|
|||
sd->longpress_timer = ecore_timer_add
|
||||
(_elm_config->longpress_timeout, _long_press_cb, data);
|
||||
}
|
||||
else if (ev->button == 3)
|
||||
/* If right button is pressed and context menu disabled is true,
|
||||
* then only context menu will appear */
|
||||
else if (ev->button == 3 && (!_elm_config->context_menu_disabled))
|
||||
{
|
||||
if (_elm_config->desktop_entry)
|
||||
{
|
||||
|
@ -1848,7 +1854,11 @@ _mouse_up_cb(void *data,
|
|||
if (ev->button == 1)
|
||||
{
|
||||
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
||||
if ((sd->long_pressed) && (_elm_config->magnifier_enable))
|
||||
/* Since context menu disabled flag was checked at long press start while mouse
|
||||
* down, hence the same should be checked at mouse up from a long press
|
||||
* as well */
|
||||
if ((sd->long_pressed) && (!_elm_config->context_menu_disabled) &&
|
||||
(_elm_config->magnifier_enable))
|
||||
{
|
||||
_magnifier_hide(data);
|
||||
_menu_call(data);
|
||||
|
@ -1867,10 +1877,13 @@ _mouse_up_cb(void *data,
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ((ev->button == 3) && (!_elm_config->desktop_entry))
|
||||
/* Since context menu disabled flag was checked at mouse right key down,
|
||||
* hence the same should be stopped at mouse up of right key as well */
|
||||
else if ((ev->button == 3) && (!_elm_config->context_menu_disabled) &&
|
||||
(!_elm_config->desktop_entry))
|
||||
{
|
||||
sd->use_down = 1;
|
||||
_menu_call(data);
|
||||
sd->use_down = 1;
|
||||
_menu_call(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3254,7 +3267,10 @@ _start_handler_mouse_up_cb(void *data,
|
|||
sd->start_handler_down = EINA_FALSE;
|
||||
if (_elm_config->magnifier_enable)
|
||||
_magnifier_hide(data);
|
||||
if ((!_elm_config->desktop_entry) && (sd->long_pressed))
|
||||
/* Context menu should not appear, even in case of selector mode, if the
|
||||
* flag is false (disabled) */
|
||||
if ((!_elm_config->context_menu_disabled) &&
|
||||
(!_elm_config->desktop_entry) && (sd->long_pressed))
|
||||
_menu_call(data);
|
||||
}
|
||||
|
||||
|
@ -3353,7 +3369,10 @@ _end_handler_mouse_up_cb(void *data,
|
|||
sd->end_handler_down = EINA_FALSE;
|
||||
if (_elm_config->magnifier_enable)
|
||||
_magnifier_hide(data);
|
||||
if ((!_elm_config->desktop_entry) && (sd->long_pressed))
|
||||
/* Context menu appear was checked in case of selector start, and hence
|
||||
* the same should be checked at selector end as well */
|
||||
if ((!_elm_config->context_menu_disabled) &&
|
||||
(!_elm_config->desktop_entry) && (sd->long_pressed))
|
||||
_menu_call(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ struct _Elm_Config
|
|||
double longpress_timeout;
|
||||
unsigned char effect_enable;
|
||||
unsigned char desktop_entry;
|
||||
unsigned char context_menu_disabled;
|
||||
unsigned char password_show_last;
|
||||
double password_show_last_timeout;
|
||||
unsigned char glayer_zoom_finger_enable;
|
||||
|
|
Loading…
Reference in New Issue