mouse 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.markdown CHANGED
@@ -1,3 +1,13 @@
1
+ # 2.0.0 - Gestures
2
+
3
+ * Add `Mouse.smart_magnify` to simulate two finger double taps
4
+ * Add `Mouse.two_finger_double_tap` as alias of `Mouse.smart_magnify`
5
+ * Add `Mouse.pinch` to simulate pinch-to-zoom and pinch-to-expand
6
+ * Add `Mouse.rotate` to simulate rotation gestures
7
+ * Add `Mouse.swipe` to simulate a swipe gesture
8
+ * Add `Mouse.horizontal_scroll` to scroll horizontally
9
+ * Add `Mouse.hscroll` as alias of `Mouse.horizontal_scroll`
10
+
1
11
  # 1.1.0 - A bit more granularity
2
12
 
3
13
  * Add `Mouse.secondary_click_down` and alias `Mouse.right_click_down`
data/README.markdown CHANGED
@@ -13,6 +13,8 @@ testing; this is the purpose of the
13
13
 
14
14
  [Documentation](http://rdoc.info/gems/mouse/frames)
15
15
 
16
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/AXElements/mouse)
17
+
16
18
 
17
19
  ## Examples
18
20
 
@@ -39,10 +41,39 @@ testing; this is the purpose of the
39
41
  Mouse.scroll 10
40
42
  Mouse.scroll -10
41
43
 
44
+ # perform horizontal scrolling as well
45
+ # positive number scrolls left, negative number scrolls right
46
+ Mouse.horizontal_scroll 10
47
+ Mouse.horizontal_scroll -10
48
+
42
49
  # optionally specify units for scroll amount, :pixel or :line
43
50
  Mouse.scroll 10, :pixels
44
51
  Mouse.scroll -10, :pixels
45
52
 
53
+ # just like a two finger double tap
54
+ Mouse.smart_magnify
55
+ Mouse.smart_magnify [600, 500]
56
+
57
+ # pinch-to-zoom
58
+ Mouse.pinch :zoom
59
+ Mouse.pinch :expand, 2
60
+
61
+ # pinch-to-unzoom
62
+ Mouse.pinch :unzoom, 2.0, 5.0
63
+ Mouse.pinch :contract, 1.0
64
+
65
+ # even perform rotation gestures!
66
+ Mouse.rotate :clockwise, 90
67
+ Mouse.rotate :counter_clockwise, 180
68
+ Mouse.rotate :cw, 360
69
+
70
+ # swipe, swipe, swipe
71
+ Mouse.swipe :up
72
+ Mouse.swipe :down
73
+ Mouse.swipe :left
74
+ Mouse.swipe :right
75
+
76
+
46
77
  See the [Mouse Documentation](http://rdoc.info/gems/mouse/Mouse) for
47
78
  more details.
48
79
 
@@ -0,0 +1,227 @@
1
+ /* @!group Additional CGEvent Definitions */
2
+
3
+ // This group of enumerations and typedefs were more or less copied from
4
+ // the AutomationKit framework that was once available from Panic Inc.
5
+ // on GitHub. It was made available under the same terms as the mouse
6
+ // gem with Panic Inc. substituted in place of Mark Rada.
7
+
8
+ #include "IOHIDEventTypes.h"
9
+
10
+
11
+ /* !!!
12
+ * Additions to the CGEvent API.
13
+ *
14
+ * Reverse engineered by listening to all events from CoreGraphics.
15
+ * Gesture types correlate to those defined in IOKit's IOHIDEvent.h (public open source).
16
+ *
17
+ * This API should be public, but Apple apparently doesn't want anyone else listening to
18
+ * and generating touch events. That's not going to stop us, though. :)
19
+ *
20
+ * These should never change, as it would break binary compatibility with existing system apps.
21
+ */
22
+
23
+
24
+ /*!
25
+ * @enum CGEventType additions
26
+ * @abstract Additional CGEvent types
27
+ *
28
+ * @constant kCGEventGesture Gesture event
29
+ */
30
+ enum {
31
+ kCGEventGesture = 29,
32
+ };
33
+
34
+
35
+ /*!
36
+ * @enum CGEventField additions
37
+ * @abstract Additional CGEvent fields
38
+ *
39
+ * @constant kCGEventGestureType Gesture type
40
+ *
41
+ * @constant kCGEventGestureRotationValue Rotation value
42
+ * @constant kCGEventGesturePinchValue Pinch value
43
+ *
44
+ * @constant kCGEventGestureScrollValueX Scroll x delta
45
+ * @constant kCGEventGestureScrollValueX Scroll y delta
46
+ *
47
+ * @constant kCGEventGestureSwipeMotion Swipe motion
48
+ * @constant kCGEventGestureSwipeProgress Swipe progress
49
+ * @constant kCGEventGestureSwipePositionX Swipe x position
50
+ * @constant kCGEventGestureSwipePositionY Swipe y position
51
+ */
52
+ enum {
53
+ kCGEventGestureType = 110,
54
+
55
+ kCGEventGestureRotationValue = 113,
56
+ kCGEventGesturePinchValue = 113,
57
+
58
+ kCGEventGestureScrollValueX = 113,
59
+ kCGEventGestureScrollValueY = 119,
60
+
61
+ kCGEventGestureSwipeDirection = 117,
62
+ kCGEventGestureSwipeMotion = 123,
63
+ kCGEventGestureSwipeProgress = 124,
64
+ kCGEventGestureSwipePositionX = 125,
65
+ kCGEventGestureSwipePositionY = 126,
66
+
67
+ kCGEventGesturePhase = 132,
68
+ };
69
+
70
+
71
+ /*!
72
+ * @enum CGGestureType
73
+ * @abstract Gesture types
74
+ *
75
+ * @constant kCGGestureTypeNone None (used for resting touches)
76
+ *
77
+ * @constant kCGGestureTypeRotation Rotation
78
+ * @constant kCGGestureTypeScroll Scroll (two-fingers)
79
+ * @constant kCGGestureTypeSwipe Swipe (three-fingers)
80
+ * @constant kCGGestureTypePinch Pinch
81
+ * @constant kCGGestureTypeSmartMagnify Smart magnify
82
+ *
83
+ * @constant kCGGestureTypeDockSwipe Swipes consumed by Dock (Mission Control)
84
+ *
85
+ * @constant kCGGestureTypeGestureStarted Gesture started
86
+ * @constant kCGGestureTypeGestureEnded Gesture ended
87
+ */
88
+ typedef uint16_t CGGestureType;
89
+ enum {
90
+ // Null type is used for resting touches
91
+ kCGGestureTypeNone = kIOHIDEventTypeNULL,
92
+
93
+ // Application-consumable gestures
94
+ kCGGestureTypeRotation = kIOHIDEventTypeRotation,
95
+ kCGGestureTypeScroll = kIOHIDEventTypeScroll,
96
+ kCGGestureTypeSwipe = kIOHIDEventTypeSwipe,
97
+ kCGGestureTypePinch = kIOHIDEventTypeZoom,
98
+ kCGGestureTypeSmartMagnify = kIOHIDEventTypeZoomToggle,
99
+
100
+ // Consumed by Dock (Mission Control gestures).
101
+ // These never make it to an app's event loop.
102
+ // As such, these events aren't recordable.
103
+ kCGGestureTypeDockSwipe = kIOHIDEventTypeDockSwipe,
104
+
105
+ // Gesture start/end types
106
+ // IOHIDEvent strangely has no reference to these.
107
+ kCGGestureTypeGestureStarted = 61,
108
+ kCGGestureTypeGestureEnded = 62,
109
+ };
110
+
111
+
112
+ /*!
113
+ * @enum CGGesturePhase
114
+ * @abstract Gesture phases
115
+ *
116
+ * @constant kCGGesturePhaseUndefined Undefined
117
+ * @constant kCGGesturePhaseBegan Gesture began
118
+ * @constant kCGGesturePhaseChanged Gesture changed
119
+ * @constant kCGGesturePhaseEnded Gesture ended
120
+ * @constant kCGGesturePhaseCancelled Gesture cancelled
121
+ */
122
+ typedef uint16_t CGGesturePhase;
123
+ enum {
124
+ kCGGesturePhaseUndefined = kIOHIDEventPhaseUndefined,
125
+ kCGGesturePhaseBegan = kIOHIDEventPhaseBegan,
126
+ kCGGesturePhaseChanged = kIOHIDEventPhaseChanged,
127
+ kCGGesturePhaseEnded = kIOHIDEventPhaseEnded,
128
+ kCGGesturePhaseCancelled = kIOHIDEventPhaseCancelled,
129
+ };
130
+
131
+
132
+ /*!
133
+ * @enum CGGestureMotion
134
+ * @abstract Gesture motions
135
+ *
136
+ * @constant kCGGestureMotionNone None
137
+ *
138
+ * @constant kCGGestureMotionHorizontal Horizontal
139
+ * @constant kCGGestureMotionVertical Vertical
140
+ *
141
+ * @constant kCGGestureMotionPinch Pinch
142
+ * @constant kCGGestureMotionRotate Rotation
143
+ *
144
+ * @constant kCGGestureMotionTap Tap
145
+ * @constant kCGGestureMotionDoubleTap Double tap
146
+ *
147
+ * @constant kCGGestureMotionFromLeftEdge From the left edge
148
+ * @constant kCGGestureMotionOffLeftEdge Off the left edge
149
+ * @constant kCGGestureMotionFromRightEdge From the right edge
150
+ * @constant kCGGestureMotionOffRightEdge Off the right edge
151
+ * @constant kCGGestureMotionFromTopEdge From the top edge
152
+ * @constant kCGGestureMotionOffTopEdge Off the top edge
153
+ * @constant kCGGestureMotionFromBottomEdge From the bottom edge
154
+ * @constant kCGGestureMotionOffBottomEdge Off the bottom edge
155
+ */
156
+ typedef uint16_t CGGestureMotion;
157
+ enum {
158
+ kCGGestureMotionNone = kIOHIDGestureMotionNone,
159
+
160
+ kCGGestureMotionHorizontal = kIOHIDGestureMotionHorizontalX,
161
+ kCGGestureMotionVertical = kIOHIDGestureMotionVerticalY,
162
+
163
+ kCGGestureMotionPinch = kIOHIDGestureMotionScale,
164
+ kCGGestureMotionRotate = kIOHIDGestureMotionRotate,
165
+
166
+ kCGGestureMotionTap = kIOHIDGestureMotionTap,
167
+ kCGGestureMotionDoubleTap = kIOHIDGestureMotionDoubleTap,
168
+
169
+ kCGGestureMotionFromLeftEdge = kIOHIDGestureMotionFromLeftEdge,
170
+ kCGGestureMotionOffLeftEdge = kIOHIDGestureMotionOffLeftEdge,
171
+ kCGGestureMotionFromRightEdge = kIOHIDGestureMotionFromRightEdge,
172
+ kCGGestureMotionOffRightEdge = kIOHIDGestureMotionOffRightEdge,
173
+ kCGGestureMotionFromTopEdge = kIOHIDGestureMotionFromTopEdge,
174
+ kCGGestureMotionOffTopEdge = kIOHIDGestureMotionOffTopEdge,
175
+ kCGGestureMotionFromBottomEdge = kIOHIDGestureMotionFromBottomEdge,
176
+ kCGGestureMotionOffBottomEdge = kIOHIDGestureMotionOffBottomEdge,
177
+ };
178
+
179
+
180
+ /*!
181
+ * @enum CGSwipeDirection
182
+ * @abstract Swipe directions
183
+ *
184
+ * @constant kCGSwipeDirectionNone None
185
+ * @constant kCGSwipeDirectionUp Up
186
+ * @constant kCGSwipeDirectionDown Down
187
+ * @constant kCGSwipeDirectionLeft Left
188
+ * @constant kCGSwipeDirectionRight Right
189
+ */
190
+ typedef uint16_t CGSwipeDirection;
191
+ enum {
192
+ kCGSwipeDirectionNone = kIOHIDSwipeNone,
193
+ kCGSwipeDirectionUp = kIOHIDSwipeUp,
194
+ kCGSwipeDirectionDown = kIOHIDSwipeDown,
195
+ kCGSwipeDirectionLeft = kIOHIDSwipeLeft,
196
+ kCGSwipeDirectionRight = kIOHIDSwipeRight,
197
+ };
198
+
199
+ /*!
200
+ * @enum CGPinchDirection
201
+ * @abstract Pinch directions
202
+ *
203
+ * @constant kCGPinchNone None
204
+ * @constant kCGPinchExpand Expand
205
+ * @constant kCGPinchContract Contract
206
+ */
207
+ typedef uint16_t CGPinchDirection;
208
+ enum {
209
+ kCGPinchNone = 0,
210
+ kCGPinchExpand,
211
+ kCGPinchContract,
212
+ };
213
+
214
+ /*!
215
+ * @enum CGRotateDirection
216
+ * @abstract Rotation directions
217
+ *
218
+ * @constant kCGRotateNone None
219
+ * @constant kCGRotateClockwise Clockwise
220
+ * @constant kCGRotateCounterClockwise Counter Clockwise
221
+ */
222
+ typedef uint16_t CGRotateDirection;
223
+ enum {
224
+ kCGRotateNone = 0,
225
+ kCGRotateClockwise,
226
+ kCGRotateCounterClockwise,
227
+ };
@@ -0,0 +1,617 @@
1
+ /*
2
+ *
3
+ * @APPLE_LICENSE_HEADER_START@
4
+ *
5
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
6
+ *
7
+ * This file contains Original Code and/or Modifications of Original Code
8
+ * as defined in and that are subject to the Apple Public Source License
9
+ * Version 2.0 (the 'License'). You may not use this file except in
10
+ * compliance with the License. Please obtain a copy of the License at
11
+ * http://www.opensource.apple.com/apsl/ and read it before using this
12
+ * file.
13
+ *
14
+ * The Original Code and all software distributed under the License are
15
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
19
+ * Please see the License for the specific language governing rights and
20
+ * limitations under the License.
21
+ *
22
+ * @APPLE_LICENSE_HEADER_END@
23
+ */
24
+
25
+ #ifndef _IOKIT_HID_IOHIDEVENTTYPES_H
26
+ #define _IOKIT_HID_IOHIDEVENTTYPES_H /* { */
27
+
28
+ #include <IOKit/IOTypes.h>
29
+
30
+ #define IOHIDEventTypeMask(type) (1<<type)
31
+ #define IOHIDEventFieldBase(type) (type << 16)
32
+ /*!
33
+ @typedef IOHIDEventType
34
+ @abstract The type of event represented by an IOHIDEventRef.
35
+ @discussion It is possible that a single IOHIDEventRef can conform to
36
+ multiple event types through the use of sub events. For futher information
37
+ as to how to determinte the type of event please reference IOHIDEventGetType
38
+ and IOHIDEventConformsTo.
39
+ @constant kIOHIDEventTypeNULL
40
+ @constant kIOHIDEventTypeVendorDefined
41
+ @constant kIOHIDEventTypeButton
42
+ @constant kIOHIDEventTypeTranslation
43
+ @constant kIOHIDEventTypeRotation
44
+ @constant kIOHIDEventTypeScroll
45
+ @constant kIOHIDEventTypeScale
46
+ @constant kIOHIDEventTypeVelocity
47
+ @constant kIOHIDEventTypeOrientation
48
+ @constant kIOHIDEventTypeKeyboard
49
+ @constant kIOHIDEventTypeDigitizer
50
+ @constant kIOHIDEventTypeAmbientLightSensor
51
+ @constant kIOHIDEventTypeAccelerometer
52
+ @constant kIOHIDEventTypeProximity
53
+ @constant kIOHIDEventTypeTemperature
54
+ @constant kIOHIDEventTypeMouse
55
+ @constant kIOHIDEventTypeProgress
56
+ @constant kIOHIDEventTypeNavigationSwipe
57
+ @constant kIOHIDEventTypeGyro
58
+ @constant kIOHIDEventTypeCompass
59
+ @constant kIOHIDEventTypeZoomToggle
60
+ @constant kIOHIDEventTypeDockSwipe
61
+ @constant kIOHIDEventTypePower
62
+ @constant kIOHIDEventTypeBrightness
63
+ @constant kIOHIDEventTypeFluidTouchGesture
64
+ @constant kIOHIDEventTypeBoundaryScroll
65
+ @constant kIOHIDEventTypeReset
66
+
67
+ */
68
+ enum {
69
+ kIOHIDEventTypeNULL, // 0
70
+ kIOHIDEventTypeVendorDefined,
71
+ kIOHIDEventTypeButton,
72
+ kIOHIDEventTypeKeyboard,
73
+ kIOHIDEventTypeTranslation,
74
+ kIOHIDEventTypeRotation, // 5
75
+ kIOHIDEventTypeScroll,
76
+ kIOHIDEventTypeScale,
77
+ kIOHIDEventTypeZoom,
78
+ kIOHIDEventTypeVelocity,
79
+ kIOHIDEventTypeOrientation, // 10
80
+ kIOHIDEventTypeDigitizer,
81
+ kIOHIDEventTypeAmbientLightSensor,
82
+ kIOHIDEventTypeAccelerometer,
83
+ kIOHIDEventTypeProximity,
84
+ kIOHIDEventTypeTemperature, // 15
85
+ kIOHIDEventTypeNavigationSwipe,
86
+ kIOHIDEventTypeSwipe = kIOHIDEventTypeNavigationSwipe,
87
+ kIOHIDEventTypeMouse,
88
+ kIOHIDEventTypeProgress,
89
+ kIOHIDEventTypeCount,
90
+ kIOHIDEventTypeGyro, // 20
91
+ kIOHIDEventTypeCompass,
92
+ kIOHIDEventTypeZoomToggle,
93
+ kIOHIDEventTypeDockSwipe, // just like kIOHIDEventTypeNavigationSwipe, but intended for consumption by Dock
94
+ kIOHIDEventTypeSymbolicHotKey,
95
+ kIOHIDEventTypePower, // 25
96
+ kIOHIDEventTypeBrightness,
97
+ kIOHIDEventTypeFluidTouchGesture, // This will eventually superseed Navagation and Dock swipes
98
+ kIOHIDEventTypeBoundaryScroll,
99
+ kIOHIDEventTypeReset,
100
+ };
101
+ typedef uint32_t IOHIDEventType;
102
+
103
+ /*
104
+ @typedef IOHIDEventField
105
+ @abstract Keys used to set and get individual event fields.
106
+ */
107
+ enum {
108
+ kIOHIDEventFieldIsRelative = IOHIDEventFieldBase(kIOHIDEventTypeNULL),
109
+ kIOHIDEventFieldIsCollection
110
+ };
111
+
112
+ enum {
113
+ kIOHIDEventFieldVendorDefinedUsagePage = IOHIDEventFieldBase(kIOHIDEventTypeVendorDefined),
114
+ kIOHIDEventFieldVendorDefinedUsage,
115
+ kIOHIDEventFieldVendorDefinedVersion,
116
+ kIOHIDEventFieldVendorDefinedDataLength,
117
+ kIOHIDEventFieldVendorDefinedData
118
+ };
119
+
120
+ enum {
121
+ kIOHIDEventFieldButtonMask = IOHIDEventFieldBase(kIOHIDEventTypeButton),
122
+ kIOHIDEventFieldButtonNumber,
123
+ kIOHIDEventFieldButtonClickCount,
124
+ kIOHIDEventFieldButtonPressure
125
+ };
126
+
127
+ enum {
128
+ kIOHIDEventFieldTranslationX = IOHIDEventFieldBase(kIOHIDEventTypeTranslation),
129
+ kIOHIDEventFieldTranslationY,
130
+ kIOHIDEventFieldTranslationZ
131
+ };
132
+
133
+ enum {
134
+ kIOHIDEventFieldRotationX = IOHIDEventFieldBase(kIOHIDEventTypeRotation),
135
+ kIOHIDEventFieldRotationY,
136
+ kIOHIDEventFieldRotationZ
137
+ };
138
+
139
+ enum {
140
+ kIOHIDEventFieldScrollX = IOHIDEventFieldBase(kIOHIDEventTypeScroll),
141
+ kIOHIDEventFieldScrollY,
142
+ kIOHIDEventFieldScrollZ,
143
+ kIOHIDEventFieldScrollIsPixels
144
+ };
145
+
146
+ enum {
147
+ kIOHIDEventFieldScaleX = IOHIDEventFieldBase(kIOHIDEventTypeScale),
148
+ kIOHIDEventFieldScaleY,
149
+ kIOHIDEventFieldScaleZ
150
+ };
151
+
152
+ enum {
153
+ kIOHIDEventFieldVelocityX = IOHIDEventFieldBase(kIOHIDEventTypeVelocity),
154
+ kIOHIDEventFieldVelocityY,
155
+ kIOHIDEventFieldVelocityZ
156
+ };
157
+
158
+ /*!
159
+ @typedef IOHIDMotionType
160
+ @abstract Type of Motion event triggered.
161
+ @discussion
162
+ @constant kIOHIDMotionStart
163
+ @constant kIOHIDMotionEnd
164
+ */
165
+ enum {
166
+ kIOHIDMotionStart = 0,
167
+ kIOHIDMotionEnd = 1,
168
+ };
169
+ typedef uint32_t IOHIDMotionType;
170
+
171
+
172
+ /*!
173
+ @typedef IOHIDAccelerometerType
174
+ @abstract Type of accelerometer event triggered.
175
+ @discussion
176
+ @constant kIOHIDAccelerometerTypeNormal
177
+ @constant kIOHIDAccelerometerTypeShake
178
+ */
179
+ enum {
180
+ kIOHIDAccelerometerTypeNormal = 0,
181
+ kIOHIDAccelerometerTypeShake = 1
182
+ };
183
+ typedef uint32_t IOHIDAccelerometerType;
184
+ typedef IOHIDMotionType IOHIDAccelerometerSubType;
185
+
186
+ enum {
187
+ kIOHIDEventFieldAccelerometerX = IOHIDEventFieldBase(kIOHIDEventTypeAccelerometer),
188
+ kIOHIDEventFieldAccelerometerY,
189
+ kIOHIDEventFieldAccelerometerZ,
190
+ kIOHIDEventFieldAccelerometerType,
191
+ kIOHIDEventFieldAccelerometerSubType
192
+ };
193
+
194
+ enum {
195
+ kIOHIDEventFieldMouseX = IOHIDEventFieldBase(kIOHIDEventTypeMouse),
196
+ kIOHIDEventFieldMouseY,
197
+ kIOHIDEventFieldMouseZ,
198
+ kIOHIDEventFieldMouseButtonMask,
199
+ kIOHIDEventFieldMouseNumber,
200
+ kIOHIDEventFieldMouseClickCount,
201
+ kIOHIDEventFieldMousePressure
202
+ };
203
+
204
+ /*!
205
+ @typedef IOHIDGyroType
206
+ @abstract Type of Gyro event triggered.
207
+ @discussion
208
+ @constant kIOHIDGyroTypeNormal
209
+ @constant kIOHIDGyroTypeShake
210
+ */
211
+ enum {
212
+ kIOHIDGyroTypeNormal = 0,
213
+ kIOHIDGyroTypeShake = 1,
214
+ kIOHIDGyroTypeMotion = 2
215
+ };
216
+ typedef uint32_t IOHIDGyroType;
217
+ typedef IOHIDMotionType IOHIDGyroSubType ;
218
+
219
+ enum {
220
+ kIOHIDEventFieldGyroX = IOHIDEventFieldBase(kIOHIDEventTypeGyro),
221
+ kIOHIDEventFieldGyroY,
222
+ kIOHIDEventFieldGyroZ,
223
+ kIOHIDEventFieldGyroType,
224
+ kIOHIDEventFieldGyroSubType,
225
+ };
226
+
227
+ typedef IOHIDMotionType IOHIDCompassType ;
228
+
229
+ enum {
230
+ kIOHIDEventFieldCompassX = IOHIDEventFieldBase(kIOHIDEventTypeCompass),
231
+ kIOHIDEventFieldCompassY,
232
+ kIOHIDEventFieldCompassZ,
233
+ kIOHIDEventFieldCompassType
234
+ };
235
+
236
+ enum {
237
+ kIOHIDEventFieldAmbientLightSensorLevel = IOHIDEventFieldBase(kIOHIDEventTypeAmbientLightSensor),
238
+ kIOHIDEventFieldAmbientLightSensorRawChannel0,
239
+ kIOHIDEventFieldAmbientLightSensorRawChannel1,
240
+ kIOHIDEventFieldAmbientLightSensorRawChannel2,
241
+ kIOHIDEventFieldAmbientLightSensorRawChannel3,
242
+ kIOHIDEventFieldAmbientLightDisplayBrightnessChanged
243
+ };
244
+
245
+ enum {
246
+ kIOHIDEventFieldTemperatureLevel = IOHIDEventFieldBase(kIOHIDEventTypeTemperature)
247
+ };
248
+
249
+ enum {
250
+ kIOHIDEventFieldProximityDetectionMask = IOHIDEventFieldBase(kIOHIDEventTypeProximity),
251
+ kIOHIDEventFieldProximityLevel
252
+ };
253
+
254
+
255
+ enum {
256
+ kIOHIDEventFieldOrientationRadius = IOHIDEventFieldBase(kIOHIDEventTypeOrientation),
257
+ kIOHIDEventFieldOrientationAzimuth,
258
+ kIOHIDEventFieldOrientationAltitude
259
+ };
260
+
261
+ enum {
262
+ kIOHIDEventFieldKeyboardUsagePage = IOHIDEventFieldBase(kIOHIDEventTypeKeyboard),
263
+ kIOHIDEventFieldKeyboardUsage,
264
+ kIOHIDEventFieldKeyboardDown,
265
+ kIOHIDEventFieldKeyboardRepeat
266
+ };
267
+
268
+ enum {
269
+ kIOHIDEventFieldDigitizerX = IOHIDEventFieldBase(kIOHIDEventTypeDigitizer),
270
+ kIOHIDEventFieldDigitizerY,
271
+ kIOHIDEventFieldDigitizerZ,
272
+ kIOHIDEventFieldDigitizerButtonMask,
273
+ kIOHIDEventFieldDigitizerType,
274
+ kIOHIDEventFieldDigitizerIndex,
275
+ kIOHIDEventFieldDigitizerIdentity,
276
+ kIOHIDEventFieldDigitizerEventMask,
277
+ kIOHIDEventFieldDigitizerRange,
278
+ kIOHIDEventFieldDigitizerTouch,
279
+ kIOHIDEventFieldDigitizerPressure,
280
+ kIOHIDEventFieldDigitizerBarrelPressure,
281
+ kIOHIDEventFieldDigitizerTwist,
282
+ kIOHIDEventFieldDigitizerTiltX,
283
+ kIOHIDEventFieldDigitizerTiltY,
284
+ kIOHIDEventFieldDigitizerAltitude,
285
+ kIOHIDEventFieldDigitizerAzimuth,
286
+ kIOHIDEventFieldDigitizerQuality,
287
+ kIOHIDEventFieldDigitizerDensity,
288
+ kIOHIDEventFieldDigitizerIrregularity,
289
+ kIOHIDEventFieldDigitizerMajorRadius,
290
+ kIOHIDEventFieldDigitizerMinorRadius,
291
+ kIOHIDEventFieldDigitizerCollection,
292
+ kIOHIDEventFieldDigitizerCollectionChord,
293
+ kIOHIDEventFieldDigitizerChildEventMask
294
+ };
295
+
296
+ enum {
297
+ kIOHIDEventFieldSwipeMask = IOHIDEventFieldBase(kIOHIDEventTypeSwipe),
298
+ kIOHIDEventFieldSwipeMotion,
299
+ kIOHIDEventFieldSwipeProgress,
300
+ kIOHIDEventFieldSwipePositionX,
301
+ kIOHIDEventFieldSwipePositionY,
302
+ kIOHIDEventFieldSwipeFlavor,
303
+ };
304
+
305
+ enum {
306
+ kIOHIDEventFieldNavigationSwipeMask = IOHIDEventFieldBase(kIOHIDEventTypeNavigationSwipe),
307
+ kIOHIDEventFieldNavigationSwipeMotion,
308
+ kIOHIDEventFieldNavigationSwipeProgress,
309
+ kIOHIDEventFieldNavigationSwipePositionX,
310
+ kIOHIDEventFieldNavigationSwipePositionY,
311
+ kIOHIDEventFieldNavagationSwipeFlavor,
312
+ };
313
+
314
+ enum {
315
+ kIOHIDEventFieldDockSwipeMask = IOHIDEventFieldBase(kIOHIDEventTypeDockSwipe),
316
+ kIOHIDEventFieldDockSwipeMotion,
317
+ kIOHIDEventFieldDockSwipeProgress,
318
+ kIOHIDEventFieldDockSwipePositionX,
319
+ kIOHIDEventFieldDockSwipePositionY,
320
+ kIOHIDEventFieldDockSwipeFlavor,
321
+ };
322
+
323
+ enum {
324
+ kIOHIDEventFieldFluidTouchGestureMask = IOHIDEventFieldBase(kIOHIDEventTypeFluidTouchGesture),
325
+ kIOHIDEventFieldFluidTouchGestureMotion,
326
+ kIOHIDEventFieldFluidTouchGestureProgress,
327
+ kIOHIDEventFieldFluidTouchGesturePositionX,
328
+ kIOHIDEventFieldFluidTouchGesturePositionY,
329
+ kIOHIDEventFieldFluidTouchGestureFlavor,
330
+ };
331
+
332
+ enum {
333
+ kIOHIDEventFieldBoundaryScrollMask = IOHIDEventFieldBase(kIOHIDEventTypeBoundaryScroll),
334
+ kIOHIDEventFieldBoundaryScrollMotion,
335
+ kIOHIDEventFieldBoundaryScrollProgress,
336
+ kIOHIDEventFieldBoundaryScrollPositionX,
337
+ kIOHIDEventFieldBoundaryScrollPositionY,
338
+ kIOHIDEventFieldBoundaryScrollFlavor,
339
+ };
340
+
341
+ enum {
342
+ kIOHIDEventFieldProgressEventType = IOHIDEventFieldBase(kIOHIDEventTypeProgress),
343
+ kIOHIDEventFieldProgressLevel,
344
+ };
345
+
346
+ enum {
347
+ kIOHIDEventFieldSymbolicHotKeyValue = IOHIDEventFieldBase(kIOHIDEventTypeSymbolicHotKey),
348
+ kIOHIDEventFieldSymbolicHotKeyIsCGSEvent,
349
+ };
350
+
351
+ /*!
352
+ @typedef IOHIDPowerType
353
+ @abstract Type of Power event triggered.
354
+ @discussion
355
+ @constant kIOHIDPowerTypePower
356
+ @constant kIOHIDPowerTypeCurrent
357
+ @constant kIOHIDPowerTypeVoltage
358
+ */
359
+ enum {
360
+ kIOHIDPowerTypePower = 0,
361
+ kIOHIDPowerTypeCurrent = 1,
362
+ kIOHIDPowerTypeVoltage = 2
363
+ };
364
+ typedef uint32_t IOHIDPowerType;
365
+
366
+ /*!
367
+ @typedef IOHIDPowerSubType
368
+ @abstract Reserved
369
+ @discussion
370
+ @constant kIOHIDPowerSubTypeNormal
371
+ */
372
+ enum {
373
+ kIOHIDPowerSubTypeNormal = 0
374
+ };
375
+ typedef uint32_t IOHIDPowerSubType;
376
+
377
+ enum {
378
+ kIOHIDEventFieldPowerMeasurement = IOHIDEventFieldBase(kIOHIDEventTypePower),
379
+ kIOHIDEventFieldPowerType,
380
+ kIOHIDEventFieldPowerSubType,
381
+ };
382
+
383
+ enum {
384
+ kIOHIDEventFieldBrightnessLevel = IOHIDEventFieldBase(kIOHIDEventTypeBrightness),
385
+ };
386
+
387
+ typedef uint32_t IOHIDEventField;
388
+
389
+ /*!
390
+ @typedef IOHIDSwipeMask
391
+ @abstract Mask detailing the type of swipe detected.
392
+ @discussion
393
+ @constant kIOHIDSwipeUp
394
+ @constant kIOHIDSwipeDown
395
+ @constant kIOHIDSwipeLeft
396
+ @constant kIOHIDSwipeRight
397
+ */
398
+ enum {
399
+ kIOHIDSwipeNone = 0x00000000,
400
+ kIOHIDSwipeUp = 0x00000001,
401
+ kIOHIDSwipeDown = 0x00000002,
402
+ kIOHIDSwipeLeft = 0x00000004,
403
+ kIOHIDSwipeRight = 0x00000008,
404
+ kIOHIDScaleExpand = 0x00000010,
405
+ kIOHIDScaleContract = 0x00000020,
406
+ kIOHIDRotateCW = 0x00000040,
407
+ kIOHIDRotateCCW = 0x00000080,
408
+ };
409
+ typedef uint32_t IOHIDSwipeMask;
410
+
411
+ /*!
412
+ @typedef IOHIDGestureMotion
413
+ @abstract
414
+ @constant kIOHIDGestureMotionNone
415
+ @constant kIOHIDGestureMotionHorizontalX
416
+ @constant kIOHIDGestureMotionVerticalY
417
+ @constant kIOHIDGestureMotionScale
418
+ @constant kIOHIDGestureMotionRotate
419
+ @constant kIOHIDGestureMotionTap
420
+ @constant kIOHIDGestureMotionDoubleTap
421
+ @constant kIOHIDGestureMotionFromLeftEdge
422
+ @constant kIOHIDGestureMotionOffLeftEdge
423
+ @constant kIOHIDGestureMotionFromRightEdge
424
+ @constant kIOHIDGestureMotionOffRightEdge
425
+ @constant kIOHIDGestureMotionFromTopEdge
426
+ @constant kIOHIDGestureMotionOffTopEdge
427
+ @constant kIOHIDGestureMotionFromBottomEdge
428
+ @constant kIOHIDGestureMotionOffBottomEdge
429
+ */
430
+ enum {
431
+ kIOHIDGestureMotionNone,
432
+ kIOHIDGestureMotionHorizontalX,
433
+ kIOHIDGestureMotionVerticalY,
434
+ kIOHIDGestureMotionScale,
435
+ kIOHIDGestureMotionRotate,
436
+ kIOHIDGestureMotionTap,
437
+ kIOHIDGestureMotionDoubleTap,
438
+ kIOHIDGestureMotionFromLeftEdge,
439
+ kIOHIDGestureMotionOffLeftEdge,
440
+ kIOHIDGestureMotionFromRightEdge,
441
+ kIOHIDGestureMotionOffRightEdge,
442
+ kIOHIDGestureMotionFromTopEdge,
443
+ kIOHIDGestureMotionOffTopEdge,
444
+ kIOHIDGestureMotionFromBottomEdge,
445
+ kIOHIDGestureMotionOffBottomEdge,
446
+ };
447
+ typedef uint16_t IOHIDGestureMotion;
448
+
449
+ /*!
450
+ @typedef IOHIDGestureFlavor
451
+ @abstract
452
+ @constant kIOHIDGestureFlavorNone
453
+ @constant kIOHIDGestureFlavorNotificationCenterPrimary
454
+ @constant kIOHIDGestureFlavorNotificationCenterSecondary
455
+ @constant kIOHIDGestureFlavorDockPrimary
456
+ @constant kIOHIDGestureFlavorDockSecondary
457
+ @constant kIOHIDGestureFlavorNavagationPrimary
458
+ @constant kIOHIDGestureFlavorNavagationSecondary
459
+ */
460
+ enum {
461
+ kIOHIDGestureFlavorNone,
462
+ kIOHIDGestureFlavorNotificationCenterPrimary,
463
+ kIOHIDGestureFlavorNotificationCenterSecondary,
464
+ kIOHIDGestureFlavorDockPrimary,
465
+ kIOHIDGestureFlavorDockSecondary,
466
+ kIOHIDGestureFlavorNavagationPrimary,
467
+ kIOHIDGestureFlavorNavagationSecondary,
468
+ };
469
+ typedef uint16_t IOHIDGestureFlavor;
470
+
471
+ /*!
472
+ @typedef IOHIDProximityDetectionMask
473
+ @abstract Proximity mask detailing the inputs that were detected.
474
+ @discussion
475
+ @constant kIOHIDProximityDetectionLargeBodyContact
476
+ @constant kIOHIDProximityDetectionLargeBodyFarField
477
+ @constant kIOHIDProximityDetectionIrregularObjects
478
+ @constant kIOHIDProximityDetectionEdgeStraddling
479
+ @constant kIOHIDProximityDetectionFlatFingerClasp
480
+ @constant kIOHIDProximityDetectionFingerTouch
481
+ @constant kIOHIDProximityDetectionReceiver
482
+ @constant kIOHIDProximityDetectionSmallObjectsHovering
483
+ @constant kIOHIDProximityDetectionReceiverCrude
484
+ @constant kIOHIDProximityDetectionReceiverMonitoring
485
+ */
486
+ enum {
487
+ kIOHIDProximityDetectionLargeBodyContact = 0x0001,
488
+ kIOHIDProximityDetectionLargeBodyFarField = 0x0002,
489
+ kIOHIDProximityDetectionIrregularObjects = 0x0004,
490
+ kIOHIDProximityDetectionEdgeStraddling = 0x0008,
491
+ kIOHIDProximityDetectionFlatFingerClasp = 0x0010,
492
+ kIOHIDProximityDetectionFingerTouch = 0x0020,
493
+ kIOHIDProximityDetectionReceiver = 0x0040,
494
+ kIOHIDProximityDetectionSmallObjectsHovering = 0x0080,
495
+ kIOHIDProximityDetectionReceiverCrude = 0x0100,
496
+ kIOHIDProximityDetectionReceiverMonitoring = 0x0200
497
+ };
498
+ typedef uint32_t IOHIDProximityDetectionMask;
499
+
500
+ /*!
501
+ @typedef IOHIDDigitizerType
502
+ @abstract The type of digitizer path initiating an event.
503
+ @discussion The IOHIDDigitizerType usually corresponds to the Logical Collection usage defined in Digitizer Usage Page (0x0d) of the USB HID Usage Tables.
504
+ @constant kIOHIDDigitizerTypeStylus
505
+ @constant kIOHIDDigitizerTypePuck
506
+ @constant kIOHIDDigitizerTypeFinger
507
+ */
508
+ enum {
509
+ kIOHIDDigitizerTransducerTypeStylus = 0x20,
510
+ kIOHIDDigitizerTransducerTypePuck,
511
+ kIOHIDDigitizerTransducerTypeFinger,
512
+ kIOHIDDigitizerTransducerTypeHand
513
+ };
514
+ typedef uint32_t IOHIDDigitizerTransducerType;
515
+
516
+ /*!
517
+ @typedef IOHIDDigitizerEventMask
518
+ @abstract Event mask detailing the events being dispatched by a digitizer.
519
+ @discussion It is possible for digitizer events to contain child digitizer events, effectively, behaving as collections.
520
+ In the collection case, the child event mask field referrence by kIOHIDEventFieldDigitizerChildEventMask will detail the
521
+ cumulative event state of the child digitizer events.
522
+ <br>
523
+ <b>Please Note:</b>
524
+ If you append a child digitizer event to a parent digitizer event, appropriate state will be transfered on to the parent.
525
+ @constant kIOHIDDigitizerEventRange Issued when the range state has changed.
526
+ @constant kIOHIDDigitizerEventTouch Issued when the touch state has changed.
527
+ @constant kIOHIDDigitizerEventPosition Issued when the position has changed.
528
+ @constant kIOHIDDigitizerEventStop Issued when motion has achieved a state of calculated non-movement.
529
+ @constant kIOHIDDigitizerEventPeak Issues when new maximum values have been detected.
530
+ @constant kIOHIDDigitizerEventIdentity Issued when the identity has changed.
531
+ @constant kIOHIDDigitizerEventAttribute Issued when an attribute has changed.
532
+ @constant kIOHIDDigitizerEventUpSwipe Issued when an up swipe has been detected.
533
+ @constant kIOHIDDigitizerEventDownSwipe Issued when an down swipe has been detected.
534
+ @constant kIOHIDDigitizerEventLeftSwipe Issued when an left swipe has been detected.
535
+ @constant kIOHIDDigitizerEventRightSwipe Issued when an right swipe has been detected.
536
+ @constant kIOHIDDigitizerEventSwipeMask Mask used to gather swipe events.
537
+ */
538
+ // NOTE: commented out because of compiler warning, not used right now so we'll skip it
539
+ /* enum { */
540
+ /* kIOHIDDigitizerEventRange = 0x00000001, */
541
+ /* kIOHIDDigitizerEventTouch = 0x00000002, */
542
+ /* kIOHIDDigitizerEventPosition = 0x00000004, */
543
+ /* kIOHIDDigitizerEventStop = 0x00000008, */
544
+ /* kIOHIDDigitizerEventPeak = 0x00000010, */
545
+ /* kIOHIDDigitizerEventIdentity = 0x00000020, */
546
+ /* kIOHIDDigitizerEventAttribute = 0x00000040, */
547
+ /* kIOHIDDigitizerEventCancel = 0x00000080, */
548
+ /* kIOHIDDigitizerEventStart = 0x00000100, */
549
+ /* kIOHIDDigitizerEventResting = 0x00000200, */
550
+ /* kIOHIDDigitizerEventSwipeUp = 0x01000000, */
551
+ /* kIOHIDDigitizerEventSwipeDown = 0x02000000, */
552
+ /* kIOHIDDigitizerEventSwipeLeft = 0x04000000, */
553
+ /* kIOHIDDigitizerEventSwipeRight = 0x08000000, */
554
+ /* kIOHIDDigitizerEventSwipeMask = 0xFF000000, */
555
+ /* }; */
556
+ /* typedef uint32_t IOHIDDigitizerEventMask; */
557
+
558
+ enum {
559
+ kIOHIDEventOptionNone = 0x00000000,
560
+ kIOHIDEventOptionIsAbsolute = 0x00000001,
561
+ kIOHIDEventOptionIsCollection = 0x00000002,
562
+ kIOHIDEventOptionPixelUnits = 0x00000004
563
+ };
564
+ typedef uint32_t IOHIDEventOptionBits;
565
+
566
+ enum {
567
+ kIOHIDEventPhaseUndefined = 0x00,
568
+ kIOHIDEventPhaseBegan = 0x01,
569
+ kIOHIDEventPhaseChanged = 0x02,
570
+ kIOHIDEventPhaseEnded = 0x04,
571
+ kIOHIDEventPhaseCancelled = 0x08,
572
+ kIOHIDEventPhaseMayBegin = 0x80,
573
+ kIOHIDEventEventPhaseMask = 0xFF,
574
+ kIOHIDEventEventOptionPhaseShift = 24,
575
+ };
576
+ typedef uint16_t IOHIDEventPhaseBits;
577
+
578
+ /*!
579
+ @typedef IOHIDSymbolicHotKey
580
+ @abstract Enumerted values for sending symbolic hot key events.
581
+ @constant kIOHIDSymbolicHotKeyDictionaryApp This will get translated into a kCGSDictionaryAppHotKey by CG.
582
+ @constant kIOHIDSymbolicHotKeyOptionIsCGSHotKey
583
+ This is an option flag to denote that the SymbolicHotKey value is
584
+ actually from the enumeration in CGSHotKeys.h.
585
+ */
586
+ enum {
587
+ kIOHIDSymbolicHotKeyUndefined,
588
+ kIOHIDSymbolicHotKeyDictionaryApp,
589
+ };
590
+ typedef uint32_t IOHIDSymbolicHotKeyValue;
591
+
592
+
593
+ enum {
594
+ kIOHIDEventSenderIDUndefined = 0x0000000000000000LL,
595
+ };
596
+ typedef uint64_t IOHIDEventSenderID; // must be the same size as that returned from IORegistryEntry::getRegistryEntryID
597
+
598
+ #ifndef KERNEL
599
+ /*!
600
+ @typedef IOHIDFloat
601
+ */
602
+ #ifdef __LP64__
603
+ typedef double IOHIDFloat;
604
+ #else
605
+ typedef float IOHIDFloat;
606
+ #endif
607
+ /*!
608
+ @typedef IOHID3DPoint
609
+ */
610
+ typedef struct _IOHID3DPoint {
611
+ IOHIDFloat x;
612
+ IOHIDFloat y;
613
+ IOHIDFloat z;
614
+ } IOHID3DPoint;
615
+ #endif
616
+
617
+ #endif /* _IOKIT_HID_IOHIDEVENTTYPES_H } */