From 5e70628daedd001a98200abc3da556e9e1bfda04 Mon Sep 17 00:00:00 2001 From: "Jason L. Cook" Date: Fri, 11 Apr 2014 20:20:47 +0200 Subject: [PATCH] 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 --- src/bin/config.c | 5 +++++ src/bin/config.h | 1 + src/bin/main.c | 1 + src/bin/options_behavior.c | 19 +++++++++++++++++++ src/bin/termio.c | 4 ++++ 5 files changed, 30 insertions(+) diff --git a/src/bin/config.c b/src/bin/config.c index 8c1036e0..03e43e91 100644 --- a/src/bin/config.c +++ b/src/bin/config.c @@ -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); diff --git a/src/bin/config.h b/src/bin/config.h index ee5dca8f..027e0e4d 100644 --- a/src/bin/config.h +++ b/src/bin/config.h @@ -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; diff --git a/src/bin/main.c b/src/bin/main.c index 787f9076..4cda584d 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -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; diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c index 17115fea..03f753f4 100644 --- a/src/bin/options_behavior.c +++ b/src/bin/options_behavior.c @@ -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); diff --git a/src/bin/termio.c b/src/bin/termio.c index c10a1156..e8b8ef01 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -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))) {