-
Notifications
You must be signed in to change notification settings - Fork 0
/
mtif-ffi.lisp
73 lines (58 loc) · 1.51 KB
/
mtif-ffi.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
;;;; MTIF
;;;; [email protected]
;;;;
;;;; CFFI definitions
(in-package :mtif)
(define-foreign-library multitouch-support
(:darwin "/System/Library/PrivateFrameworks/MultitouchSupport.framework/MultitouchSupport"))
(use-foreign-library multitouch-support)
(defctype MTDeviceRef :pointer)
(defctype MTContactCallbackFunction :pointer)
(defcstruct mtPoint
"Point coordinates on the trackpad"
(x :float)
(y :float))
(defcstruct mtReadout
"Other trackpad readout?"
(position (:struct mtPoint))
(velocity (:struct mtPoint)))
(defcenum mtState
"Finger state"
:not-tracking
:start-in-range
:hover-in-range
:make-touch
:touching
:break-touch
:linger-in-range
:out-of-range)
(defcstruct (Finger :class c-finger)
"One of these for every finger on the trackpad"
(frame :int)
(timestamp :double)
(path-id :int)
(state mtState)
(finger-id :int)
(hand-id :int) ; always 1?
(normalized (:struct mtReadout))
(size :float)
(zero1 :int)
(angle :float)
(major-axis :float)
(minor-axis :float)
(absolute (:struct mtReadout))
(zero2 :int)
(zero3 :int)
(unknown2 :float))
(defcfun "MTDeviceCreateDefault" MTDeviceRef)
(defcfun "MTRegisterContactFrameCallback" :void
(device MTDeviceRef)
(callback MTContactCallbackFunction))
(defcfun "MTUnregisterContactFrameCallback" :void
(device MTDeviceRef)
(callback MTContactCallbackFunction))
(defcfun "MTDeviceStart" :void
(device MTDeviceRef)
(unused :int))
(defcfun "MTDeviceStop" :void
(device MTDeviceRef))