File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
#include "../mouse.h"
2
2
#include "../screen.h"
3
3
#include "../microsleep.h"
4
+ #include "../deadbeef_rand.h"
4
5
5
6
#include <math.h> /* For floor() */
6
7
16
17
*/
17
18
#define ABSOLUTE_COORD_CONST 65536
18
19
19
-
20
20
#define MMMouseToMEventF (down , button ) \
21
21
(down ? MMMouseDownToMEventF(button) : MMMouseUpToMEventF(button))
22
22
30
30
: ((button) == RIGHT_BUTTON ? MOUSEEVENTF_RIGHTDOWN \
31
31
: MOUSEEVENTF_MIDDLEDOWN))
32
32
33
+ static int32_t DEFAULT_DOUBLE_CLICK_INTERVAL_MS = 200 ;
34
+
33
35
MMPoint CalculateAbsoluteCoordinates (MMPoint point ) {
34
36
MMSize displaySize = getMainDisplaySize ();
35
37
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)
95
97
*/
96
98
void doubleClick (MMMouseButton button )
97
99
{
100
+ UINT maxDoubleClickTime = GetDoubleClickTime ();
98
101
/* Double click for everything else. */
99
102
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
+ }
101
108
clickMouse (button );
102
109
}
103
110
You can’t perform that action at this time.
0 commit comments