aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--image.c28
-rw-r--r--w3mimgdisplay.c18
3 files changed, 39 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index d478722..524cc0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2002-11-28 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03497] incorrect image size
+ * image.c (getImageSize): invoke w3mimgdiplay -size instead of "5;..."
+ * w3mimgdisplay.c (defined_size): added
+ (main): if defined_size get_image_size()
+ (GetOption): -size
+
+2002-11-28 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03496] parse <!-- ... --> in <script>
* etc.c (read_token): check <pre>
* file.c (HTMLlineproc0): remove comment processing
@@ -5234,4 +5242,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.569 2002/11/27 16:39:13 ukai Exp $
+$Id: ChangeLog,v 1.570 2002/11/27 16:46:30 ukai Exp $
diff --git a/image.c b/image.c
index e2aaeaa..c2873a8 100644
--- a/image.c
+++ b/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.20 2002/11/24 16:02:22 ukai Exp $ */
+/* $Id: image.c,v 1.21 2002/11/27 16:46:34 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
@@ -589,6 +589,7 @@ int
getImageSize(ImageCache * cache)
{
Str tmp;
+ FILE *f;
int w = 0, h = 0;
if (!activeImage)
@@ -597,21 +598,18 @@ getImageSize(ImageCache * cache)
(cache->width > 0 && cache->height > 0))
return FALSE;
tmp = Strnew();
- if (!(Imgdisplay_rf && Imgdisplay_wf)) {
- if (!openImgdisplay())
- return FALSE;
- }
- fputs("5;", Imgdisplay_wf); /* Get Size */
- fputs(cache->file, Imgdisplay_wf);
- fputs("\n", Imgdisplay_wf);
- fflush(Imgdisplay_wf);
- {
- char buf[1024];
- fgets(buf, sizeof(buf), Imgdisplay_rf);
- if (sscanf(buf, "%d %d", &w, &h) != 2) {
- return FALSE;
- }
+ if (!strchr(Imgdisplay, '/'))
+ Strcat_m_charp(tmp, w3m_auxbin_dir(), "/", NULL);
+ Strcat_m_charp(tmp, Imgdisplay, " -size ", shell_quote(cache->file),
+ " 2> /dev/null", NULL);
+ f = popen(tmp->ptr, "r");
+ if (!f)
+ return FALSE;
+ while (fscanf(f, "%d %d", &w, &h) < 0) {
+ if (feof(f))
+ break;
}
+ pclose(f);
if (!(w > 0 && h > 0))
return FALSE;
diff --git a/w3mimgdisplay.c b/w3mimgdisplay.c
index 8df2e5c..ad52671 100644
--- a/w3mimgdisplay.c
+++ b/w3mimgdisplay.c
@@ -1,4 +1,4 @@
-/* $Id: w3mimgdisplay.c,v 1.9 2002/11/06 03:50:49 ukai Exp $ */
+/* $Id: w3mimgdisplay.c,v 1.10 2002/11/27 16:46:34 ukai Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -13,6 +13,7 @@ static char *background = NULL;
static int offset_x = 0, offset_y = 0;
static int defined_bg = 0, defined_x = 0, defined_y = 0, defined_test = 0;
static int defined_debug = 0;
+static char *defined_size = NULL;
#define MAX_IMAGE 1000
static W3MImage *imageBuf = NULL;
@@ -63,6 +64,16 @@ main(int argc, char **argv)
exit(0);
}
+ if (defined_size) {
+ if (w_op->init(w_op)) {
+ W3MImage img;
+ int w, h;
+ if (w_op->get_image_size(w_op, &img, defined_size, &w, &h))
+ printf("%d %d\n", w, h);
+ }
+ exit(0);
+ }
+
w_op->set_background(w_op, background);
while (fgets(buf, sizeof(buf), stdin) != NULL) {
@@ -166,6 +177,11 @@ GetOption(int argc, char **argv)
else if (!strcmp("-test", argv[i])) {
defined_test = 1;
}
+ else if (!strcmp("-size", argv[i])) {
+ if (++i >= argc)
+ exit(1);
+ defined_size = argv[i];
+ }
else if (!strcmp("-debug", argv[i])) {
defined_debug = 1;
}