From 028f2d5d467582afc666c761718940fb6b722916 Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 5 Jan 2021 09:40:08 -0600 Subject: put version into a global and use it to not do mouseover effect for svg output --- src/common.h | 1 + src/graphics_c2.c | 3 +++ src/graphics_cs_svg.c | 13 ++++++++++++- src/hackvr.c | 3 ++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/common.h b/src/common.h index 99ac1fa..77ad619 100644 --- a/src/common.h +++ b/src/common.h @@ -120,6 +120,7 @@ struct hvr_global { real split; char localecho; int selfpipe[2]; + char *version; }; int selfcommand(char *); diff --git a/src/graphics_c2.c b/src/graphics_c2.c index 65d139f..c4c9193 100644 --- a/src/graphics_c2.c +++ b/src/graphics_c2.c @@ -33,6 +33,9 @@ void draw_c2_shape(c2_s_t s) { ss.p[i]=c2_to_cs(s.p[i]); } draw_cs_shape(ss); + if(!strcmp(global.version,"svg")) { + return;//disable mouseover for svg + } // if(cn_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline. if(epoch_PnPoly(gra_global.mouse,s.p,s.len+(s.len==1))) {//if the mouse is inside the shape, we're going to draw a different outline. set_ansi_color(7); diff --git a/src/graphics_cs_svg.c b/src/graphics_cs_svg.c index 1e3672e..9321dc1 100644 --- a/src/graphics_cs_svg.c +++ b/src/graphics_cs_svg.c @@ -47,7 +47,7 @@ void set_luminosity_color(int lum) { void draw_cs_line(cs_t p1,cs_t p2) { char tmp[1024]; snprintf(tmp,sizeof(tmp)-1,"\n" - ,p1.x ,p1.y ,p2.x ,p2.y ,svg_global.foreground_color); + ,p1.x ,p1.y ,p2.x ,p2.y ,svg_global.foreground_color?svg_global.foreground_color:"green"); strcat(svg_global.backbuffer,tmp); } @@ -80,6 +80,9 @@ void draw_cs_shape(cs_s_t s) {//this is implemented as draw_cs_line... hrm. it c switch(s.len) { case 1: break; + case 2: + draw_cs_line(s.p[0],s.p[1]); + break; default: strcat(svg_global.backbuffer,"\n",svg_global.foreground_color,svg_global.foreground_color); strcat(svg_global.backbuffer,tmp); break; @@ -186,6 +195,7 @@ void set_color_snow() { } void set_ansi_color(int i) { + if(i < 0 || i > 7) i=0; svg_global.foreground_color=svg_global.ansi_color[i]; } @@ -248,6 +258,7 @@ int graphics_sub_init() {//this returns an fd we need to keep an eye one? :/ svg_global.ansi_color[6]="yellow"; svg_global.ansi_color[7]="white"; svg_global.ansi_color[8]=0; + set_ansi_color(0); /* x11_global.fd=ConnectionNumber(x11_global.dpy);//we need to to pass to libidc x11_global.color_map=DefaultColormap(x11_global.dpy, DefaultScreen(x11_global.dpy)); fprintf(stderr,"# generating colors...\n"); diff --git a/src/hackvr.c b/src/hackvr.c index 1a72896..4668e90 100644 --- a/src/hackvr.c +++ b/src/hackvr.c @@ -128,7 +128,7 @@ int glob_match(char *a,char *b) { } void hvr_version() { - fprintf(stderr,"# hackvr version: %s\n",HVR_VERSION); + fprintf(stderr,"# hackvr version: %s\n",global.version); } int hackvr_handler(char *line); @@ -763,6 +763,7 @@ void alarm_handler(int sig) { } int main(int argc,char *argv[]) { + global.version=HVR_VERSION; int i; int fd=0;//stdin if(argc == 2) { -- cgit v1.2.3