config: add "active_links_color"

This commit is contained in:
Boris Faure 2020-06-14 22:00:25 +02:00
parent d84304fc2e
commit c011c48720
Signed by untrusted user who does not match committer: borisfaure
GPG Key ID: 35C0410516166BE8
3 changed files with 19 additions and 4 deletions

View File

@ -7,7 +7,7 @@
#include "col.h"
#include "utils.h"
#define CONF_VER 24
#define CONF_VER 25
#define CONFIG_KEY "config"
#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
@ -133,6 +133,8 @@ config_init(void)
(edd_base, Config, "active_links_url", active_links_url, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "active_links_escape", active_links_escape, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "active_links_color", active_links_color, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "translucent", translucent, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
@ -296,6 +298,7 @@ config_sync(const Config *config_src, Config *config)
config->active_links_file = config_src->active_links_file;
config->active_links_url = config_src->active_links_url;
config->active_links_escape = config_src->active_links_escape;
config->active_links_color = config_src->active_links_color;
config->mute = config_src->mute;
config->visualize = config_src->visualize;
config->urg_bell = config_src->urg_bell;
@ -563,6 +566,7 @@ config_new(void)
config->active_links_file = EINA_TRUE;
config->active_links_url = EINA_TRUE;
config->active_links_escape = EINA_TRUE;
config->active_links_color = EINA_TRUE;
config->translucent = EINA_FALSE;
config->mute = EINA_FALSE;
config->visualize = EINA_TRUE;
@ -736,7 +740,15 @@ config_load(void)
config->group_all = EINA_FALSE;
EINA_FALLTHROUGH;
/*pass through*/
case CONF_VER: /* 24 */
case 24:
config->active_links_color = (
config->active_links_email ||
config->active_links_file ||
config->active_links_url ||
config->active_links_escape);
EINA_FALLTHROUGH;
/*pass through*/
case CONF_VER: /* 25 */
config->version = CONF_VER;
break;
default:

View File

@ -75,6 +75,7 @@ struct _Config
Eina_Bool active_links_file;
Eina_Bool active_links_url;
Eina_Bool active_links_escape;
Eina_Bool active_links_color;
Eina_Bool translucent;
Eina_Bool mute;
Eina_Bool visualize;

View File

@ -2474,10 +2474,10 @@ _smart_mouseover_apply(Termio *sd)
s = termio_link_find(sd->self, sd->mouse.cx, sd->mouse.cy,
&x1, &y1, &x2, &y2);
if (!s)
if (!s && config->active_links_color)
{
uint8_t r = 0, g = 0, b = 0, a = 0;
/* TODO: boris: check config */
if (termio_color_find(sd->self, sd->mouse.cx, sd->mouse.cy,
&x1, &y1, &x2, &y2, &r, &g, &b, &a))
{
@ -2491,6 +2491,8 @@ _smart_mouseover_apply(Termio *sd)
termio_remove_links(sd);
return;
}
if (!s)
return;
if (link_is_url(s))
{