Added config directive for Active Links, defaulting to true

Summary:
Added element ot config struct to support toggling of Active Links

Added boolean to support Active Links config directive

Added configuration directive for Active Links

Return from appropriate functions if Active Links is disabled

Test Plan: Reviewers

Reviewers: billiob, raster

CC: billiob, raster

Differential Revision: https://phab.enlightenment.org/D689
This commit is contained in:
Jason L. Cook 2014-04-11 20:20:47 +02:00 committed by Boris Faure
parent 09d8cc4c7e
commit 5e70628dae
5 changed files with 30 additions and 0 deletions

View File

@ -96,6 +96,8 @@ config_init(void)
(edd_base, Config, "disable_cursor_blink", disable_cursor_blink, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "disable_visual_bell", disable_visual_bell, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "active_links", active_links, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "translucent", translucent, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
@ -210,6 +212,7 @@ config_sync(const Config *config_src, Config *config)
config->flicker_on_key = config_src->flicker_on_key;
config->disable_cursor_blink = config_src->disable_cursor_blink;
config->disable_visual_bell = config_src->disable_visual_bell;
config->active_links = config_src->active_links;
config->mute = config_src->mute;
config->urg_bell = config_src->urg_bell;
config->multi_instance = config_src->multi_instance;
@ -499,6 +502,7 @@ config_load(const char *key)
config->flicker_on_key = EINA_FALSE;
config->disable_cursor_blink = EINA_FALSE;
config->disable_visual_bell = EINA_FALSE;
config->active_links = EINA_TRUE;
s = eina_unicode_unicode_to_utf8(sep, &slen);
if (s)
{
@ -579,6 +583,7 @@ config_fork(Config *config)
CPY(flicker_on_key);
CPY(disable_cursor_blink);
CPY(disable_visual_bell);
CPY(active_links);
CPY(translucent);
CPY(mute);
CPY(urg_bell);

View File

@ -42,6 +42,7 @@ struct _Config
Eina_Bool flicker_on_key;
Eina_Bool disable_cursor_blink;
Eina_Bool disable_visual_bell;
Eina_Bool active_links;
Eina_Bool translucent;
Eina_Bool mute;
Eina_Bool urg_bell;

View File

@ -2652,6 +2652,7 @@ elm_main(int argc, char **argv)
Eina_Bool video_mute = 0xff; /* unset */
Eina_Bool cursor_blink = 0xff; /* unset */
Eina_Bool visual_bell = 0xff; /* unset */
Eina_Bool active_links = 0xff; /* unset */
Eina_Bool fullscreen = EINA_FALSE;
Eina_Bool iconic = EINA_FALSE;
Eina_Bool borderless = EINA_FALSE;

View File

@ -76,6 +76,15 @@ _cb_op_behavior_urg_bell_chg(void *data, Evas_Object *obj, void *event EINA_UNUS
config_save(config, NULL);
}
static void
_cb_op_behavior_active_links_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *term = data;
Config *config = termio_config_get(term);
config->active_links = elm_check_state_get(obj);
config_save(config, NULL);
}
static void
_cb_op_behavior_multi_instance_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
@ -360,6 +369,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_urg_bell_chg, term);
o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, "Active Links");
elm_check_state_set(o, config->active_links);
elm_box_pack_end(bx, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_active_links_chg, term);
o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);

View File

@ -147,6 +147,7 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
EINA_SAFETY_ON_NULL_RETURN(sd);
if (!config) return;
if (!config->active_links) return;
if (!sd->link.string) return;
if (link_is_url(sd->link.string))
{
@ -666,8 +667,11 @@ _smart_mouseover_apply(Evas_Object *obj)
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
Eina_Bool same_link = EINA_FALSE, same_geom = EINA_FALSE;
Termio *sd = evas_object_smart_data_get(obj);
Config *config = termio_config_get(obj);
EINA_SAFETY_ON_NULL_RETURN(sd);
if (!config->active_links) return;
if ((sd->mouse.cx < 0) || (sd->mouse.cy < 0) ||
(sd->link.suspend) || (!evas_object_focus_get(obj)))
{