aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--etc.c8
-rw-r--r--image.c4
-rw-r--r--map.c44
-rw-r--r--search.c4
4 files changed, 51 insertions, 9 deletions
diff --git a/etc.c b/etc.c
index 10ad4a6..33a01c6 100644
--- a/etc.c
+++ b/etc.c
@@ -1,4 +1,4 @@
-/* $Id: etc.c,v 1.35 2002/11/06 03:50:49 ukai Exp $ */
+/* $Id: etc.c,v 1.36 2002/11/06 15:05:34 ukai Exp $ */
#include "fm.h"
#include <pwd.h>
#include "myctype.h"
@@ -1050,9 +1050,9 @@ openSecretFile(char *fname)
*
* XXX: disable_secret_security_check will introduce some
* security issues, but on some platform such as Windows
- * it's not possible (or feasible) to disable group|other
+ * it's not possible (or feasible) to disable group|other
* readable and writable.
- * [w3m-dev 03368][w3m-dev 03369][w3m-dev 03370]
+ * [w3m-dev 03368][w3m-dev 03369][w3m-dev 03370]
*/
if (disable_secret_security_check)
/* do nothing */ ;
@@ -1315,7 +1315,7 @@ mySystem(char *command, int background)
dup2(open("/dev/null", O_WRONLY), 1);
dup2(open("/dev/null", O_WRONLY), 2);
#ifndef FOPEN_MAX
-#define FOPEN_MAX 1024 /* XXX */
+#define FOPEN_MAX 1024 /* XXX */
#endif
/* close all other file descriptors (socket, ...) */
for (i = 3; i < FOPEN_MAX; i++)
diff --git a/image.c b/image.c
index cf37eb8..c41a1ef 100644
--- a/image.c
+++ b/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.14 2002/11/06 03:50:49 ukai Exp $ */
+/* $Id: image.c,v 1.15 2002/11/06 15:05:35 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
@@ -121,7 +121,7 @@ openImgdisplay()
dup2(fdr[1], 1);
dup2(open("/dev/null", O_WRONLY), 2);
#ifndef FOPEN_MAX
-#define FOPEN_MAX 1024 /* XXX */
+#define FOPEN_MAX 1024 /* XXX */
#endif
/* close all other file descriptors (socket, ...) */
for (i = 3; i < FOPEN_MAX; i++)
diff --git a/map.c b/map.c
index 5ce0121..bc1b1f6 100644
--- a/map.c
+++ b/map.c
@@ -1,4 +1,4 @@
-/* $Id: map.c,v 1.10 2002/11/05 17:12:02 ukai Exp $ */
+/* $Id: map.c,v 1.12 2002/11/06 15:08:06 ukai Exp $ */
/*
* client-side image maps
*/
@@ -57,6 +57,30 @@ inMapArea(MapArea * a, int x, int y)
}
return FALSE;
}
+
+static int
+nearestMapArea(MapList *ml, int x, int y)
+{
+ ListItem *al;
+ MapArea *a;
+ int i, l, n = 0, min = -1, limit = pixel_per_char * pixel_per_char
+ + pixel_per_line * pixel_per_line;
+
+ if (!ml || !ml->area)
+ return n;
+ for (i = 0, al = ml->area->first; al != NULL; i++, al = al->next) {
+ a = (MapArea *) al->ptr;
+ if (a) {
+ l = (a->center_x - x) * (a->center_x - x)
+ + (a->center_y - y) * (a->center_y - y);
+ if ((min < 0 || l < min) && l < limit) {
+ n = i;
+ min = l;
+ }
+ }
+ }
+ return n;
+}
#endif
MapArea *
@@ -113,7 +137,11 @@ follow_map_menu(Buffer *buf, struct parsed_tagarg * arg, Anchor *a_img, int x,
}
label[n] = NULL;
if (initial == -n)
+#ifdef USE_IMAGE
+ initial = map ? nearestMapArea(ml, px, py) : 0;
+#else
initial = 0;
+#endif
else if (initial < 0)
initial *= -1;
@@ -223,6 +251,8 @@ newMapArea(char *url, char *target, char *alt, char *shape, char *coords)
}
a->coords = NULL;
a->ncoords = 0;
+ a->center_x = 0;
+ a->center_y = 0;
if (a->shape == SHAPE_UNKNOWN || a->shape == SHAPE_DEFAULT)
return a;
if (!coords) {
@@ -271,6 +301,18 @@ newMapArea(char *url, char *target, char *alt, char *shape, char *coords)
a->coords[a->ncoords] = a->coords[0];
a->coords[a->ncoords + 1] = a->coords[1];
}
+ if (a->shape == SHAPE_CIRCLE) {
+ a->center_x = a->coords[0];
+ a->center_y = a->coords[1];
+ }
+ else {
+ for (i = 0; i < a->ncoords / 2; i++) {
+ a->center_x += a->coords[2 * i];
+ a->center_y += a->coords[2 * i + 1];
+ }
+ a->center_x /= a->ncoords / 2;
+ a->center_y /= a->ncoords / 2;
+ }
#endif
#endif
return a;
diff --git a/search.c b/search.c
index e7c4834..9b3d424 100644
--- a/search.c
+++ b/search.c
@@ -1,4 +1,4 @@
-/* $Id: search.c,v 1.20 2002/11/06 03:50:49 ukai Exp $ */
+/* $Id: search.c,v 1.21 2002/11/06 15:05:35 ukai Exp $ */
#include "fm.h"
#include "regex.h"
#include <signal.h>
@@ -62,7 +62,7 @@ open_migemo(char *migemo_command)
dup2(fdr[1], 1);
dup2(open("/dev/null", O_WRONLY), 2);
#ifndef FOPEN_MAX
-#define FOPEN_MAX 1024 /* XXX */
+#define FOPEN_MAX 1024 /* XXX */
#endif
/* close all other file descriptors (socket, ...) */
for (i = 3; i < FOPEN_MAX; i++)