Minor fixes to comments.
[AROS.git] / rom / intuition / doubleclick.c
blobe38bf49810dbf58db2b9bb4650a9c209a441fdc0
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, 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 HISTORY
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 BOOL ret = FALSE;
59 DEBUG_DOUBLECLICK(dprintf("DoubleClick: t1 %lu/%lu t2 %lu/%lu\n",
60 cSeconds, cMicros, sSeconds, sMicros));
62 if (ABS(cSeconds - sSeconds) <= 4)
64 ULONG base;
66 base = MIN(cSeconds, sSeconds);
68 sMicros += 1000000 * (sSeconds - base);
69 cMicros += 1000000 * (cSeconds - base);
71 base = ABS((LONG)(sMicros - cMicros));
73 ret = (base <= GetPrivIBase(IntuitionBase)->ActivePreferences->DoubleClick.tv_micro +
74 1000000 * GetPrivIBase(IntuitionBase)->ActivePreferences->DoubleClick.tv_secs);
77 DEBUG_DOUBLECLICK(dprintf("DoubleClick: return %d\n", ret));
79 return ret;
80 AROS_LIBFUNC_EXIT
81 } /* DoubleClick */