Bela, Tom,

I've added this function based on HTAlert.c etc. And used that in
LYMainLoop.c (disregard my previous patch).

The SEC2SEC macro is indeed confusing. Can't we use millisec for all 
timeouts and use LYmsec_delay() instead?

BTW. I spent some time figuring out why the djgpp/S-Lang version didn't
work with the mouse under Win-XP. The cause was I had 
DJGPP_KEYHANDLER defined. I suggest this patch/message:

--- orig/src/lycurses.c      Thu Jul  1 01:55:04 2004
+++ src/lycurses.c   Sat Sep 18 15:08:56 2004
@@ -58,6 +58,10 @@
 #define COLOR_BKGD ((COLOR_PAIRS >= 9) ? get_color_pair(9) : A_NORMAL)
 #endif

+#if defined(DJGPP_KEYHANDLER) && defined(USE_SLANG) && defined(USE_MOUSE)
+#error Cannot use DJGPP_KEYHANDLER with USE_SLANG/USE_MOUSE
+#endif
+
 #ifdef USE_CURSES_PADS
 WINDOW *LYwin = 0;
 int LYshiftWin = 0;

-------

--gv
--- orig/src/LYUtils.c  Thu Jul  1 01:55:04 2004
+++ src/LYUtils.c       Sat Sep 18 15:31:16 2004
@@ -7460,6 +7460,30 @@
 
 #endif /* __EMX__ */
 
+/*
+ * Sleep for a number of milli-sec.
+ */
+void LYmsec_delay(unsigned msec)
+{
+#if defined(_WINDOWS)
+    Sleep(msec);
+
+#elif defined(HAVE_NAPMS)
+    napms(msec);
+
+#elif defined(DJGPP) || defined(HAVE_USLEEP)
+    usleep(1000 * msec);
+
+#else
+    struct timeval tv;
+    unsigned long usec = 1000UL * msec;
+
+    tv.tv_sec  = usec / 1000000UL;
+    tv.tv_usec = usec % 1000000UL;
+    select (0, NULL, NULL, NULL, &tv);
+#endif
+}
+
 #if defined(WIN_EX)            /* 1997/10/16 (Thu) 20:13:28 */
 
 int put_clip(char *szBuffer)
--- orig/src/LYUtils.h  Mon May 24 00:59:56 2004
+++ src/LYUtils.h       Sat Sep 18 15:23:18 2004
@@ -182,6 +182,7 @@
 extern void LYTrimRelFromAbsPath(char *path);
 extern void LYhighlight(int flag, int cur, char *target);
 extern void LYsetXDisplay(char *new_display);
+extern void LYmsec_delay(unsigned msec);
 extern void change_sug_filename(char *fname);
 extern void convert_to_spaces(char *string, BOOL condense);
 extern void free_and_clear(char **obj);
--- orig/src/LYMainLoop.c Thu Jul  1 01:55:04 2004
+++ src/LYMainLoop.c      Sat Sep 18 15:32:12 2004
@@ -506,15 +506,23 @@
 }
 #endif /* DISP_PARTIAL */
 
-static void set_curdoc_link(int nextlink)
+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);
+              LYmsec_delay(20);
+            }
+#endif
+        }
        curdoc.link = nextlink;
     }
+    (void) by_mouse;
 }
 
 static int do_change_link(void)
@@ -535,7 +543,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 +2192,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 +2686,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 +2755,7 @@
        }
     }
     if (samepage) {
-       set_curdoc_link(nextlink);
+       set_curdoc_link(nextlink, FALSE);
        return;                 /* and we are done. */
 
        /*
@@ -2755,7 +2763,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 +2786,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 +3430,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 +3440,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 +3794,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 +3811,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 +3844,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 +3852,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 +3992,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 +4143,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 +4360,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 +4524,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 +4859,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

Reply via email to