Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7203/src Modified Files: mswindow.c Log Message: Add clickDelay functionality. As with any continuous mouse event, only while the mouse is moving, is mouse input processed. Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- mswindow.c 22 Mar 2007 06:40:18 -0000 1.52 +++ mswindow.c 26 Mar 2007 02:47:18 -0000 1.53 @@ -1870,6 +1870,7 @@ #if defined(MOTION_MOUSE) || defined(XTRA_MESSAGE_UI) static POINTS prev_pos; static HWND LastPressHwnd; + static int delaytime = 0; #endif switch (msg) @@ -2046,6 +2047,7 @@ #ifdef MOTION_MOUSE prev_pos = MAKEPOINTS (lParam); + delaytime = udcounter; #endif EventQueue[EventTail].type = W_EV_BUTTON; return (0); @@ -2078,6 +2080,7 @@ #ifdef MOTION_MOUSE prev_pos = MAKEPOINTS (lParam); + delaytime = udcounter; #endif EventQueue[EventTail].type = W_EV_BUTTON; return (0); @@ -2109,6 +2112,7 @@ #ifdef MOTION_MOUSE prev_pos = MAKEPOINTS (lParam); + delaytime = udcounter; #endif EventQueue[EventTail].type = W_EV_BUTTON; return (0); @@ -2167,6 +2171,7 @@ #ifdef MOTION_MOUSE prev_pos = MAKEPOINTS (lParam); + delaytime = udcounter; #endif EventQueue[EventTail].type = W_EV_BUTTON; return (TRUE); /* MSDN says you SHOULD return TRUE if processing WM_XBUTTONDOWN */ @@ -2343,6 +2348,18 @@ if (thresh < motionThresh) return (0); + //Check to see if click delay in effect. If so, return. If not, reset timer. + //Only works if mouse is moving, but that is true for all continuous mouse events, + //i.e. holding down torp button without moving the mouse will not release a continuous + //stream of torps. This problem is due to a design flaw in the Windows event loop. + if (clickDelay) + { + if (delaytime + clickDelay > udcounter) + return (0); + else + delaytime = udcounter; + } + prev_pos = MAKEPOINTS (lParam); #ifdef SHIFTED_MOUSE