File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11#include "../mouse.h"
22#include "../screen.h"
33#include "../microsleep.h"
4+ #include "../deadbeef_rand.h"
45
56#include <math.h> /* For floor() */
67
1617 */
1718 #define ABSOLUTE_COORD_CONST 65536
1819
19-
2020#define MMMouseToMEventF (down , button ) \
2121 (down ? MMMouseDownToMEventF(button) : MMMouseUpToMEventF(button))
2222
3030 : ((button) == RIGHT_BUTTON ? MOUSEEVENTF_RIGHTDOWN \
3131 : MOUSEEVENTF_MIDDLEDOWN))
3232
33+ static int32_t DEFAULT_DOUBLE_CLICK_INTERVAL_MS = 200 ;
34+
3335MMPoint CalculateAbsoluteCoordinates (MMPoint point ) {
3436 MMSize displaySize = getMainDisplaySize ();
3537 return MMPointMake (((float ) point .x / displaySize .width ) * ABSOLUTE_COORD_CONST , ((float ) point .y / displaySize .height ) * ABSOLUTE_COORD_CONST );
@@ -95,9 +97,14 @@ void clickMouse(MMMouseButton button)
9597 */
9698void doubleClick (MMMouseButton button )
9799{
100+ UINT maxDoubleClickTime = GetDoubleClickTime ();
98101 /* Double click for everything else. */
99102 clickMouse (button );
100- microsleep (200 );
103+ if (maxDoubleClickTime > DEFAULT_DOUBLE_CLICK_INTERVAL_MS ) {
104+ microsleep (DEFAULT_DOUBLE_CLICK_INTERVAL_MS );
105+ } else {
106+ microsleep (DEADBEEF_RANDRANGE (1 , maxDoubleClickTime ));
107+ }
101108 clickMouse (button );
102109}
103110
You can’t perform that action at this time.
0 commit comments