2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2013, The MorphOS Development Team. All Rights Reserved.
7 #include <clib/macros.h>
8 #include "intuition_intern.h"
11 #define DEBUG_DOUBLECLICK(x) ;
13 /*****************************************************************************
16 #include <intuition/intuition.h>
17 #include <proto/intuition.h>
19 AROS_LH4(BOOL
, DoubleClick
,
22 AROS_LHA(ULONG
, sSeconds
, D0
),
23 AROS_LHA(ULONG
, sMicros
, D1
),
24 AROS_LHA(ULONG
, cSeconds
, D2
),
25 AROS_LHA(ULONG
, cMicros
, D3
),
28 struct IntuitionBase
*, IntuitionBase
, 17, Intuition
)
31 Check if two times are within the doubleclick interval.
34 sSeconds, sMicros - Seconds and microseconds of the first event.
35 cSeconds, cMicros - Seconds and microseconds of the second event.
38 TRUE if the times are within the doubleclick interval, FALSE
51 *****************************************************************************/
57 DEBUG_DOUBLECLICK(dprintf("DoubleClick: t1 %lu/%lu t2 %lu/%lu\n",
58 cSeconds
, cMicros
, sSeconds
, sMicros
));
60 if (ABS(cSeconds
- sSeconds
) <= 4)
64 base
= MIN(cSeconds
, sSeconds
);
66 sMicros
+= 1000000 * (sSeconds
- base
);
67 cMicros
+= 1000000 * (cSeconds
- base
);
69 base
= ABS((LONG
)(sMicros
- cMicros
));
71 ret
= (base
<= GetPrivIBase(IntuitionBase
)->ActivePreferences
.DoubleClick
.tv_micro
+
72 1000000 * GetPrivIBase(IntuitionBase
)->ActivePreferences
.DoubleClick
.tv_secs
);
75 DEBUG_DOUBLECLICK(dprintf("DoubleClick: return %d\n", ret
));