-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: hackvr
action: commit
revision:
path_from:
revision_from: 028f2d5d467582afc666c761718940fb6b722916:
path_to:
revision_to:

git.thebackupbox.net

hackvr

git://git.thebackupbox.net/hackvr

commit 028f2d5d467582afc666c761718940fb6b722916
Author: epoch <epoch@enzo.thebackupbox.net>
Date:   Tue Jan 5 09:40:08 2021 -0600

    put version into a global and use it to not do mouseover effect for svg output

diff --git a/src/common.h b/src/common.h

index 99ac1fac46befd4581a974e70d923b946268a6b7..

index ..77ad6194e676abeee4b44f470ac7965513b96594 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 65d139f19d0a76b8910012df0f5ad743b3723cc8..

index ..c4c9193d7f5623883b44366ead1a1c6851b7184f 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 1e3672ec5de557cbf7221d80f5d1d79a05ccbdc3..

index ..9321dc1f9fb594e528bcd29edfd590b0751f1e2b 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,"<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" stroke=\"%s\" />\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,"<polygon points=\"");
     for(i=0;i<s.len+(s.len==1);i++) {//this shape is closed!
@@ -114,6 +117,9 @@ void draw_cs_filled_shape(cs_s_t s) {
   switch(s.len) {
    case 1:
     break;
+   case 2:
+    draw_cs_line(s.p[0],s.p[1]);
+    break;
    default:
     strcat(svg_global.backbuffer,"<polygon points=\"");
     for(i=0;i<s.len+(s.len==1);i++) {//this shape is closed!
@@ -121,6 +127,9 @@ void draw_cs_filled_shape(cs_s_t s) {
       strcat(svg_global.backbuffer,tmp);
       if(i != s.len-1) strcat(svg_global.backbuffer," ");//only print space after points that have a point after them.
     }
+    if(svg_global.foreground_color == 0) {
+      svg_global.foreground_color="green";
+    }
     snprintf(tmp,sizeof(tmp)-1,"\" fill=\"%s\" stroke=\"%s\" />\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 1a7289601f675b0544720aa24d9331ce89dc9dc6..

index ..4668e9080220467660c44839b9dfbcea386a7eb4 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) {

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 19:04:18 2024