summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-09-26 18:28:10 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-09-26 18:28:10 +0200
commit2b7330765aeb322017516ef50f9343cbdda07a95 (patch)
treef925e0017b26b434155f11ae187dfcf0296ac405 /sys/src/cmd/mothra
parent03f2668d68ddce6966fdc3f13bd085bced5ff48d (diff)
mothra: dont make all images into links (only in mothmode)
Diffstat (limited to 'sys/src/cmd/mothra')
-rw-r--r--sys/src/cmd/mothra/mothra.c27
-rw-r--r--sys/src/cmd/mothra/rdhtml.c2
2 files changed, 19 insertions, 10 deletions
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c
index 17306d550..f7206bfd7 100644
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -718,17 +718,19 @@ void dolink(Panel *p, int buttons, Rtext *word){
Action *a;
a=word->user;
- if(a == nil || a->image == nil && a->link == nil)
+ if(a == nil || (a->link == nil && a->image == nil))
return;
if(mothmode)
hiturl(buttons, a->image ? a->image : a->link, 0);
- else if(a->ismap){
- yoffs=plgetpostextview(p);
- coord=subpt(subpt(mouse.xy, word->r.min), p->r.min);
- snprint(mapurl, sizeof(mapurl), "%s?%d,%d", a->link, coord.x, coord.y+yoffs);
- hiturl(buttons, mapurl, 1);
- } else
- hiturl(buttons, a->link ? a->link : a->image, 0);
+ else if(a->link){
+ if(a->ismap){
+ yoffs=plgetpostextview(p);
+ coord=subpt(subpt(mouse.xy, word->r.min), p->r.min);
+ snprint(mapurl, sizeof(mapurl), "%s?%d,%d", a->link, coord.x, coord.y+yoffs);
+ hiturl(buttons, mapurl, 1);
+ } else
+ hiturl(buttons, a->link, 0);
+ }
}
void filter(char *cmd, int fd){
@@ -982,8 +984,15 @@ mothon(Www *w, int on)
*/
for(t=w->text;t;t=t->next){
a=t->user;
- if(a == nil || a->image == nil || a->link == nil)
+ if(a == nil || a->image == nil)
+ continue;
+ if(a->link == nil){
+ if(on)
+ t->flags |= PL_HOT;
+ else
+ t->flags &= ~PL_HOT;
continue;
+ }
x = t->next;
if(on){
t->next = nil;
diff --git a/sys/src/cmd/mothra/rdhtml.c b/sys/src/cmd/mothra/rdhtml.c
index 8405244a1..bf7a5ee00 100644
--- a/sys/src/cmd/mothra/rdhtml.c
+++ b/sys/src/cmd/mothra/rdhtml.c
@@ -144,7 +144,7 @@ void pl_htmloutput(Hglob *g, int nsp, char *s, Field *field){
}
}
plrtstr(&g->dst->text, space, indent, f->font, strdup(s),
- (g->state->link[0] || g->state->image[0]) ? PL_HOT : 0, ap);
+ g->state->link[0] ? PL_HOT : 0, ap);
g->para=0;
g->linebrk=0;
g->dst->changed=1;