|
|
1.1 root 1: #include <IOKit/hidsystem/IOHITablet.h>
2: #include <IOKit/hidsystem/IOHITabletPointer.h>
3:
4: OSDefineMetaClassAndStructors(IOHITablet, IOHIPointing);
5:
6: UInt16 IOHITablet::generateTabletID()
7: {
8: static UInt16 _nextTabletID = 0;
9: return _nextTabletID++;
10: }
11:
12: bool IOHITablet::init(OSDictionary *propTable)
13: {
14: if (!IOHIPointing::init(propTable)) {
15: return false;
16: }
17:
18: _systemTabletID = generateTabletID();
19: setProperty(kIOHISystemTabletID, (unsigned long long)_systemTabletID, 16);
20:
21: return true;
22: }
23:
24: bool IOHITablet::open(IOService *client,
25: IOOptionBits options,
26: RelativePointerEventAction rpeAction,
27: AbsolutePointerEventAction apeAction,
28: ScrollWheelEventAction sweAction,
29: TabletEventAction tabletAction,
30: ProximityEventAction proximityAction)
31: {
32: if (!IOHIPointing::open(client, options, rpeAction, apeAction, sweAction)) {
33: return false;
34: }
35:
36: _tabletEventTarget = client;
37: _tabletEventAction = tabletAction;
38: _proximityEventTarget = client;
39: _proximityEventAction = proximityAction;
40:
41: return true;
42: }
43:
44: void IOHITablet::dispatchTabletEvent(NXEventData *tabletEvent,
45: AbsoluteTime ts)
46: {
47: if (_tabletEventAction) {
48: (*_tabletEventAction)(_tabletEventTarget,
49: tabletEvent,
50: ts);
51: }
52: }
53:
54: void IOHITablet::dispatchProximityEvent(NXEventData *proximityEvent,
55: AbsoluteTime ts)
56: {
57: if (_proximityEventAction) {
58: (*_proximityEventAction)(_proximityEventTarget,
59: proximityEvent,
60: ts);
61: }
62: }
63:
64: bool IOHITablet::startTabletPointer(IOHITabletPointer *pointer, OSDictionary *properties)
65: {
66: bool result = false;
67:
68: do {
69: if (!pointer)
70: break;
71:
72: if (!pointer->init(properties))
73: break;
74:
75: if (!pointer->attach(this))
76: break;
77:
78: if (!pointer->start(this))
79: break;
80:
81: result = true;
82: } while (false);
83:
84: return result;
85: }
86:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.