[w3m-dev 03938] Re: clear image

Hiroyuki Ito <[email protected]>
Newsgroups gmane.comp.web.w3m.devel
Message-ID <[email protected]>

> 
> rxvt(aterm,Eterm,etc) mlterm  CVS
> 

gnome-terminal (version 1.4.0.4) 


 w_op->clear(w_op, x + offset_x - 2, y + offset_y - 2, w + 4, h + 4);


w3mimgdisplay -margin n




diff -ru w3m/w3mimg/fb/fb.c w3m-patch/w3mimg/fb/fb.c
--- w3m/w3mimg/fb/fb.c	2003-07-11 19:34:22.000000000 +0900
+++ w3m-patch/w3mimg/fb/fb.c	2003-07-11 19:38:35.000000000 +0900
@@ -357,6 +357,12 @@
 
     if (is_open != TRUE || x > fb_width() || y > fb_height())
 	return 1;
+
+    if (x < 0)
+	x = 0;
+    if (y < 0)
+	y = 0;
+
     if (x + w > fb_width())
 	w = fb_width() - x;
     if (y + h > fb_height())
diff -ru w3m/w3mimg/w3mimg.h w3m-patch/w3mimg/w3mimg.h
--- w3m/w3mimg/w3mimg.h	2003-07-11 19:34:20.000000000 +0900
+++ w3m-patch/w3mimg/w3mimg.h	2003-07-11 19:38:37.000000000 +0900
@@ -16,6 +16,7 @@
     void *priv;			/* driver specific data */
     int width, height;		/* window width, height */
     int offset_x, offset_y;	/* offset */
+    int clear_margin;
     int max_anim;
 
     int (*init) (struct _w3mimg_op * self);
diff -ru w3m/w3mimg/x11/x11_w3mimg.c w3m-patch/w3mimg/x11/x11_w3mimg.c
--- w3m/w3mimg/x11/x11_w3mimg.c	2003-07-11 19:34:22.000000000 +0900
+++ w3m-patch/w3mimg/x11/x11_w3mimg.c	2003-07-11 19:38:35.000000000 +0900
@@ -131,6 +131,12 @@
     xi = (struct x11_info *)self->priv;
     if (xi == NULL)
 	return 0;
+
+    if (x < 0)
+	x = 0;
+    if (y < 0)
+	y = 0;
+
     XClearArea(xi->display, xi->window, x, y, w, h, False);
     return 1;
 }
diff -ru w3m/w3mimgdisplay.c w3m-patch/w3mimgdisplay.c
--- w3m/w3mimgdisplay.c	2003-07-10 17:57:02.000000000 +0900
+++ w3m-patch/w3mimgdisplay.c	2003-07-11 20:06:43.000000000 +0900
@@ -17,7 +17,7 @@
 
 #define MAX_IMAGE 1000
 static W3MImage *imageBuf = NULL;
-static int maxImage = 0, maxAnim = 100;
+static int maxImage = 0, maxAnim = 100, clearMargin = 0;
 
 static void GetOption(int argc, char **argv);
 static void DrawImage(char *buf, int redraw);
@@ -58,7 +58,9 @@
 	w_op->offset_x = offset_x;
     if (defined_y)
 	w_op->offset_y = offset_y;
+
     w_op->max_anim = maxAnim;
+    w_op->clear_margin = clearMargin;
 
     if (defined_test) {
 	printf("%d %d\n", w_op->width - w_op->offset_x,
@@ -192,6 +194,13 @@
 		exit(1);
 	    maxAnim = atoi(argv[i]);
 	}
+	else if (!strcmp("-margin", argv[i])) {
+	    if (++i >= argc)
+		exit(1);
+	    clearMargin = atoi(argv[i]);
+	    if (clearMargin < 0)
+		clearMargin = 0;
+	}
 	else if (!strcmp("-size", argv[i])) {
 	    if (++i >= argc)
 		exit(1);
@@ -324,5 +333,9 @@
     for (; isdigit(*p); p++)
 	h = 10 * h + (*p - '0');
 
-    w_op->clear(w_op, x + offset_x, y + offset_y, w, h);
+    w_op->clear(w_op,
+		x + offset_x - w_op->clear_margin,
+		y + offset_y - w_op->clear_margin,
+		w + w_op->clear_margin * 2,
+		h + w_op->clear_margin * 2);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.