> > And mouse-clicking on links works fine. Except the url should for
> > clarity be momentarily highlighted *before* entering the href.
>
> hmm - send a patch.
I finally took a dive into the lynx internals. It was not as difficult as I
feared. The attached patch makes mouse-browsing a bit nicer;
set_curdoc_link() sleeps for 20 msec if the link was selected using
the mouse.
I didn't see any sub-second sleeper, so I added one using select().
It's an error to use select() like this on Windows. Hope other targets
allow this (i.e. all fd_set to NULL).
--gv
--- orig/src/LYMainLoop.c Thu Jul 01 01:55:04 2004
+++ src/LYMainLoop.c Fri Sep 17 17:40:50 2004
@@ -506,15 +506,42 @@
}
#endif /* DISP_PARTIAL */
-static void set_curdoc_link(int nextlink)
+/*
+ * Sleep a short period after selecting the next link clicked by
+ * the mouse.
+ */
+#ifdef USE_MOUSE
+static void mouse_select_delay (int msec)
+{
+#ifdef _WINDOWS
+ Sleep (msec);
+#else
+ struct timeval tv;
+
+ tv.tv_sec = msec / 1000;
+ tv.tv_usec = msec % 1000;
+ (void) select (0, NULL, NULL, NULL, &tv);
+#endif
+}
+#endif
+
+static void set_curdoc_link(int nextlink, BOOLEAN by_mouse)
{
if (curdoc.link != nextlink
&& nextlink >= 0
&& nextlink < nlinks) {
- if (curdoc.link >= 0 && curdoc.link < nlinks)
+ if (curdoc.link >= 0 && curdoc.link < nlinks) {
LYhighlight(OFF, curdoc.link, prev_target);
+#ifdef USE_MOUSE
+ if (by_mouse) {
+ LYhighlight(ON, nextlink, prev_target);
+ mouse_select_delay (20);
+ }
+#endif
+ }
curdoc.link = nextlink;
}
+ (void) by_mouse;
}
static int do_change_link(void)
@@ -535,7 +562,7 @@
FREE(msgtmp);
return (-1); /* indicates unexpected error */
}
- set_curdoc_link(mouse_tmp);
+ set_curdoc_link(mouse_tmp, TRUE);
}
#endif /* USE_MOUSE */
return (0); /* indicates OK */
@@ -2184,7 +2211,7 @@
newlink = find_link_near_col(*follow_col, 1);
if (newlink > -1) {
- set_curdoc_link(newlink);
+ set_curdoc_link(newlink, FALSE);
} else if (more) { /* next page */
Newline += (display_lines);
} else if (*old_c != real_c) {
@@ -2678,7 +2705,7 @@
nextlink--;
}
}
- set_curdoc_link(nextlink);
+ set_curdoc_link(nextlink, FALSE);
return FALSE; /* and we are done. */
} else if (Newline > 1 && /* need a previous page */
@@ -2747,7 +2774,7 @@
}
}
if (samepage) {
- set_curdoc_link(nextlink);
+ set_curdoc_link(nextlink, FALSE);
return; /* and we are done. */
/*
@@ -2755,7 +2782,7 @@
* link on the page.
*/
} else if (!more && Newline == 1 && curdoc.link == nlinks - 1) {
- set_curdoc_link(0);
+ set_curdoc_link(0, FALSE);
} else if (more && /* need a later page */
HTGetLinkOrFieldStart(curdoc.link,
@@ -2778,7 +2805,7 @@
for (;;) {
if (--i < 0
|| links[i].ly != links[curdoc.link].ly) {
- set_curdoc_link(i + 1);
+ set_curdoc_link(i + 1, FALSE);
break;
}
}
@@ -3422,7 +3449,7 @@
for (;;) {
if (++i >= nlinks
|| links[i].ly != links[curdoc.link].ly) {
- set_curdoc_link(i - 1);
+ set_curdoc_link(i - 1, FALSE);
break;
}
}
@@ -3432,7 +3459,7 @@
{
if (curdoc.link > 0 &&
links[curdoc.link].ly == links[curdoc.link - 1].ly) {
- set_curdoc_link(curdoc.link - 1);
+ set_curdoc_link(curdoc.link - 1, FALSE);
}
}
@@ -3786,7 +3813,7 @@
* link on the page.
*/
} else if (!more && Newline == 1 && curdoc.link == nlinks - 1) {
- set_curdoc_link(0);
+ set_curdoc_link(0, FALSE);
} else if (more) { /* next page */
Newline += (display_lines);
@@ -3803,7 +3830,7 @@
if (more) {
Newline += display_lines;
} else if (curdoc.link < nlinks - 1) {
- set_curdoc_link(nlinks - 1);
+ set_curdoc_link(nlinks - 1, FALSE);
} else if (*old_c != real_c) {
*old_c = real_c;
HTInfoMsg(ALREADY_AT_END);
@@ -3836,7 +3863,7 @@
int real_c)
{
if (curdoc.link > 0) { /* previous link */
- set_curdoc_link(curdoc.link - 1);
+ set_curdoc_link(curdoc.link - 1, FALSE);
} else if (!more &&
curdoc.link == 0 && Newline == 1) { /* at the top of list */
@@ -3844,7 +3871,7 @@
* If there is only one page of data and the user goes off the top,
* just move the cursor to last link on the page.
*/
- set_curdoc_link(nlinks - 1);
+ set_curdoc_link(nlinks - 1, FALSE);
} else if (curdoc.line > 1) { /* previous page */
/*
@@ -3984,7 +4011,7 @@
if (Newline > 1) {
Newline -= display_lines;
} else if (curdoc.link > 0) {
- set_curdoc_link(0);
+ set_curdoc_link(0, FALSE);
} else if (*old_c != real_c) {
*old_c = real_c;
HTInfoMsg(ALREADY_AT_BEGIN);
@@ -4135,7 +4162,7 @@
{
if (curdoc.link < nlinks - 1 &&
links[curdoc.link].ly == links[curdoc.link + 1].ly) {
- set_curdoc_link(curdoc.link + 1);
+ set_curdoc_link(curdoc.link + 1, FALSE);
}
}
@@ -4352,9 +4379,9 @@
}
}
if (curdoc.link < nlinks - 1) {
- set_curdoc_link(curdoc.link + 1);
+ set_curdoc_link(curdoc.link + 1, FALSE);
} else if (!more && Newline == 1 && curdoc.link == nlinks - 1) {
- set_curdoc_link(0);
+ set_curdoc_link(0, FALSE);
} else if (more) { /* next page */
Newline += (display_lines);
}
@@ -4516,7 +4543,7 @@
newlink = find_link_near_col(*follow_col, -1);
if (newlink > -1) {
- set_curdoc_link(newlink);
+ set_curdoc_link(newlink, FALSE);
} else if (*old_c != real_c) {
*old_c = real_c;
HTUserMsg(NO_LINKS_ABOVE);
@@ -4851,7 +4878,7 @@
/*
* It's a different link on this page,
*/
- set_curdoc_link(newdoc.link);
+ set_curdoc_link(newdoc.link, FALSE);
newdoc.link = 0;
}
}
_______________________________________________
Lynx-dev mailing list
[EMAIL PROTECTED]
http://lists.nongnu.org/mailman/listinfo/lynx-dev