config: extract optimization and isa flags to separate variables
[AROS.git] / rom / intuition / doubleclick.c
blobf10876be4fbdb6b70d133fb1cbcce3f94c18f5d7
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2013, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <clib/macros.h>
8 #include "intuition_intern.h"
10 #undef DoubleClick
11 #define DEBUG_DOUBLECLICK(x) ;
13 /*****************************************************************************
15 NAME */
16 #include <intuition/intuition.h>
17 #include <proto/intuition.h>
19 AROS_LH4(BOOL, DoubleClick,
21 /* SYNOPSIS */
22 AROS_LHA(ULONG, sSeconds, D0),
23 AROS_LHA(ULONG, sMicros, D1),
24 AROS_LHA(ULONG, cSeconds, D2),
25 AROS_LHA(ULONG, cMicros, D3),
27 /* LOCATION */
28 struct IntuitionBase *, IntuitionBase, 17, Intuition)
30 /* FUNCTION
31 Check if two times are within the doubleclick interval.
33 INPUTS
34 sSeconds, sMicros - Seconds and microseconds of the first event.
35 cSeconds, cMicros - Seconds and microseconds of the second event.
37 RESULT
38 TRUE if the times are within the doubleclick interval, FALSE
39 otherwise.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 BOOL ret = FALSE;
57 DEBUG_DOUBLECLICK(dprintf("DoubleClick: t1 %lu/%lu t2 %lu/%lu\n",
58 cSeconds, cMicros, sSeconds, sMicros));
60 if (ABS(cSeconds - sSeconds) <= 4)
62 ULONG base;
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));
77 return ret;
78 AROS_LIBFUNC_EXIT
79 } /* DoubleClick */