w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit d95a6e2b225155f2efb727affcfe7c7356c34d2d
parent bcc6d38a2c4e57710ffd24d02cb14421050147e3
Author: ukai <ukai>
Date:   Wed,  6 Nov 2002 15:05:34 +0000

fix indent

Diffstat:
Metc.c | 6+++---
Mimage.c | 2+-
Mmap.c | 42++++++++++++++++++++++++++++++++++++++++++
Msearch.c | 2+-
4 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/etc.c b/etc.c @@ -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 @@ -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 @@ -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 @@ -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++)