2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #include <IOKit/hidsystem/IOHITablet.h>
23 #include <IOKit/hidsystem/IOHITabletPointer.h>
25 OSDefineMetaClassAndStructors(IOHITablet
, IOHIPointing
);
27 UInt16
IOHITablet::generateTabletID()
29 static UInt16 _nextTabletID
= 0;
30 return _nextTabletID
++;
33 bool IOHITablet::init(OSDictionary
*propTable
)
35 if (!IOHIPointing::init(propTable
)) {
39 _systemTabletID
= generateTabletID();
40 setProperty(kIOHISystemTabletID
, (unsigned long long)_systemTabletID
, 16);
45 bool IOHITablet::open(IOService
*client
,
47 RelativePointerEventAction rpeAction
,
48 AbsolutePointerEventAction apeAction
,
49 ScrollWheelEventAction sweAction
,
50 TabletEventAction tabletAction
,
51 ProximityEventAction proximityAction
)
53 if (!IOHIPointing::open(client
, options
, rpeAction
, apeAction
, sweAction
)) {
57 _tabletEventTarget
= client
;
58 _tabletEventAction
= tabletAction
;
59 _proximityEventTarget
= client
;
60 _proximityEventAction
= proximityAction
;
65 void IOHITablet::dispatchTabletEvent(NXEventData
*tabletEvent
,
68 if (_tabletEventAction
) {
69 (*_tabletEventAction
)(_tabletEventTarget
,
75 void IOHITablet::dispatchProximityEvent(NXEventData
*proximityEvent
,
78 if (_proximityEventAction
) {
79 (*_proximityEventAction
)(_proximityEventTarget
,
85 bool IOHITablet::startTabletPointer(IOHITabletPointer
*pointer
, OSDictionary
*properties
)
93 if (!pointer
->init(properties
))
96 if (!pointer
->attach(this))
99 if (!pointer
->start(this))