Root/
Source at commit 1275 created 12 years 11 months ago. By meklort, Remove unused file. Fixup makefiles some more - boot2 compiles again. | |
---|---|
1 | /*␊ |
2 | * @APPLE_LICENSE_HEADER_START@␊ |
3 | * ␊ |
4 | * Copyright (c) 1999-2009 Apple Computer, Inc. All Rights Reserved.␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. Please obtain a copy of the License at␊ |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
11 | * file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
18 | * Please see the License for the specific language governing rights and␊ |
19 | * limitations under the License.␊ |
20 | * ␊ |
21 | * @APPLE_LICENSE_HEADER_END@␊ |
22 | */␊ |
23 | /* ␉Copyright (c) 1992 NeXT Computer, Inc. All rights reserved. ␊ |
24 | *␊ |
25 | * EventDriver.h - Exported Interface Event Driver object.␊ |
26 | *␊ |
27 | *␉␉The EventDriver is a pseudo-device driver.␊ |
28 | *␊ |
29 | * HISTORY␊ |
30 | * 19 Mar 1992 Mike Paquette at NeXT␊ |
31 | * Created. ␊ |
32 | * 4 Aug 1993␉ Erik Kay at NeXT␊ |
33 | *␉API cleanup␊ |
34 | */␊ |
35 | ␊ |
36 | #ifndef␉_IOHIDSYSTEM_H␊ |
37 | #define _IOHIDSYSTEM_H␊ |
38 | ␊ |
39 | #include <TargetConditionals.h>␊ |
40 | #include <IOKit/IOTimerEventSource.h>␊ |
41 | #include <IOKit/IOInterruptEventSource.h>␊ |
42 | #include <IOKit/IOService.h>␊ |
43 | #include <IOKit/IOMessage.h>␊ |
44 | #include <IOKit/IOUserClient.h>␊ |
45 | #include <IOKit/IOWorkLoop.h>␊ |
46 | #include <IOKit/IOCommandGate.h>␊ |
47 | #include <IOKit/IOBufferMemoryDescriptor.h>␊ |
48 | #include <IOKit/pwr_mgt/IOPM.h>␊ |
49 | #if TARGET_OS_EMBEDDED␊ |
50 | class IOGraphicsDevice;␊ |
51 | #else␊ |
52 | #include <IOKit/graphics/IOGraphicsDevice.h>␊ |
53 | #endif␊ |
54 | #include <IOKit/hidsystem/IOHIDevice.h>␊ |
55 | #include <IOKit/hidsystem/IOHIDShared.h>␊ |
56 | #include <IOKit/hidsystem/IOHIDTypes.h>␊ |
57 | #include <IOKit/hidsystem/IOLLEvent.h>␊ |
58 | #include <IOKit/IODataQueue.h>␊ |
59 | #include <IOKit/hidsystem/ev_keymap.h>␉␉/* For NX_NUM_SCANNED_SPECIALKEYS */␊ |
60 | ␊ |
61 | ␊ |
62 | // The following messages should be unique across the entire system␊ |
63 | #ifndef sub_iokit_hidsystem␊ |
64 | #define sub_iokit_hidsystem err_sub(14)␊ |
65 | #endif␊ |
66 | ␊ |
67 | #define kIOHIDSystem508MouseClickMessage iokit_family_msg(sub_iokit_hidsystem, 1)␊ |
68 | #define kIOHIDSystemDeviceSeizeRequestMessage␉iokit_family_msg(sub_iokit_hidsystem, 2)␊ |
69 | #define kIOHIDSystem508SpecialKeyDownMessage iokit_family_msg(sub_iokit_hidsystem, 3)␊ |
70 | ␊ |
71 | class IOHIDKeyboardDevice;␊ |
72 | class IOHIDPointingDevice;␊ |
73 | class IOHIDEvent;␊ |
74 | ␊ |
75 | class IOHIDSystem : public IOService␊ |
76 | {␊ |
77 | ␉OSDeclareDefaultStructors(IOHIDSystem);␊ |
78 | ␊ |
79 | ␉friend class IOHIDUserClient;␊ |
80 | ␉friend class IOHIDParamUserClient;␊ |
81 | ␉friend class IOHIDEventSystemUserClient;␊ |
82 | ␊ |
83 | private:␊ |
84 | ␉IOWorkLoop *␉␉workLoop;␊ |
85 | ␉IOTimerEventSource * ␉timerES;␊ |
86 | ␉IOTimerEventSource * ␉vblES;␊ |
87 | IOInterruptEventSource * eventConsumerES;␊ |
88 | IOInterruptEventSource * keyboardEQES;␊ |
89 | IOCommandGate *␉␉cmdGate;␊ |
90 | ␉IOUserClient *␉␉serverConnect;␊ |
91 | ␉IOUserClient *␉␉paramConnect;␊ |
92 | IONotifier *␉␉eventPublishNotify;␊ |
93 | IONotifier *␉␉eventTerminateNotify;␊ |
94 | IONotifier *␉␉publishNotify;␊ |
95 | IONotifier *␉␉terminateNotify;␊ |
96 | ␊ |
97 | OSArray *␉␉ioHIDevices;␊ |
98 | OSSet * touchEventPosters;␊ |
99 | ␊ |
100 | ␉// Ports on which we hold send rights␊ |
101 | ␉mach_port_t␉eventPort;␉// Send msg here when event queue␊ |
102 | ␉␉␉␉␉// goes non-empty␊ |
103 | mach_port_t stackShotPort;␊ |
104 | ␉mach_port_t␉_specialKeyPort[NX_NUM_SCANNED_SPECIALKEYS]; // Special key msgs␊ |
105 | ␉void␉␉*eventMsg;␉// Msg to be sent to Window Server.␊ |
106 | ␉void␉␉*stackShotMsg;␉// Msg to be sent to Stack Shot.␊ |
107 | ␊ |
108 | ␉// Shared memory area information␊ |
109 | IOBufferMemoryDescriptor * globalMemory;␊ |
110 | ␉uintptr_t␉shmem_addr;␉// kernel address of shared memory␊ |
111 | ␉vm_size_t␉shmem_size;␉// size of shared memory␊ |
112 | ␊ |
113 | ␉// Pointers to structures which occupy the shared memory area.␊ |
114 | ␉volatile void␉*evs;␉␉// Pointer to private driver shmem␊ |
115 | ␉volatile EvGlobals *evg;␉// Pointer to EvGlobals (shmem)␊ |
116 | ␉// Internal variables related to the shared memory area␊ |
117 | ␉int␉␉lleqSize;␉// # of entries in low-level queue␊ |
118 | // FIXME: why is this ivar lleqSize an ivar? {Dan]␊ |
119 | ␊ |
120 | ␉// Screens list␊ |
121 | ␉vm_size_t␉evScreenSize;␉// Byte size of evScreen array␊ |
122 | ␉void␉␉*evScreen;␉// array of screens known to driver␊ |
123 | ␉volatile void␉*lastShmemPtr;␉// Pointer used to index thru shmem␊ |
124 | ␉␉␉␉␉// while assigning shared areas to␊ |
125 | ␉␉␉␉␉// drivers.␊ |
126 | ␉int␉␉screens;␉// running total of allocated screens␊ |
127 | ␉UInt32␉␉cursorScreens;␉// bit mask of screens with cursor present␊ |
128 | UInt32␉␉cursorPinScreen;// a screen to pin against␊ |
129 | ␉IOGBounds␉␉cursorPin;␉// Range to which cursor is pinned␊ |
130 | ␉␉␉␉␉// while on this screen.␊ |
131 | ␉IOGBounds␉␉workSpace;␉// IOGBounds of full workspace.␊ |
132 | ␉// Event Status state - This includes things like event timestamps,␊ |
133 | ␉// time til screen dim, and related things manipulated through the␊ |
134 | ␉// Event Status API.␊ |
135 | ␉//␊ |
136 | ␉IOGPoint␉pointerLoc;␉// Current pointing device location␊ |
137 | ␉␉␉␉// The value leads evg->cursorLoc.␊ |
138 | IOGPoint␉pointerDelta;␉// The cumulative pointer delta values since␊ |
139 | // previous mouse move event was posted␊ |
140 | ␊ |
141 | ␉IOGPoint␉clickLoc;␉// location of last mouse click␊ |
142 | ␉IOGPoint clickSpaceThresh;␉// max mouse delta to be a doubleclick␊ |
143 | ␉int␉clickState;␉// Current click state␊ |
144 | ␊ |
145 | ␉bool evOpenCalled;␉// Has the driver been opened?␊ |
146 | ␉bool evInitialized;␉// Has the first-open-only initialization run?␊ |
147 | bool evStateChanging; // Is the event system state changing.␊ |
148 | ␉bool eventsOpen;␉// Boolean: has evmmap been called yet?␊ |
149 | ␉bool cursorStarted;␉// periodic events running?␊ |
150 | ␉bool cursorEnabled;␉// cursor positioning ok?␊ |
151 | ␉bool cursorCoupled;␉// cursor positioning on pointer moves ok?␊ |
152 | ␉bool cursorPinned;␉// cursor positioning on pointer moves ok?␊ |
153 | ␊ |
154 | ␉short leftENum;␉␉// Unique ID for last left down event␊ |
155 | ␉short rightENum;␉// Unique ID for last right down event␊ |
156 | ␉␊ |
157 | ␉// The periodic event mechanism timestamps and state␊ |
158 | ␉// are recorded here.␊ |
159 | ␉AbsoluteTime thisPeriodicRun;␊ |
160 | AbsoluteTime periodicEventDelta;// Time between periodic events␊ |
161 | // todo: make infinite␊ |
162 | AbsoluteTime clickTime;␉␉// Timestamps used to determine doubleclicks␊ |
163 | AbsoluteTime clickTimeThresh;␊ |
164 | ␊ |
165 | AbsoluteTime waitSustain;␉// Sustain time before removing cursor␊ |
166 | AbsoluteTime waitSusTime;␉// Sustain counter␊ |
167 | AbsoluteTime waitFrameRate;␉// Ticks per wait cursor frame␊ |
168 | AbsoluteTime waitFrameTime;␉// Wait cursor frame timer␊ |
169 | ␊ |
170 | AbsoluteTime lastRelativeEventTime;␉// Used to post mouse events once per frame␊ |
171 | AbsoluteTime lastRelativeMoveTime;␊ |
172 | AbsoluteTime lastEventTime;␊ |
173 | AbsoluteTime lastUndimEvent;␊ |
174 | SInt32 postDeltaX, accumDX;␊ |
175 | SInt32 postDeltaY, accumDY;␊ |
176 | ␊ |
177 | ␉// Flags used in scheduling periodic event callbacks␊ |
178 | ␉bool␉␉needSetCursorPosition;␊ |
179 | ␉bool␉␉needToKickEventConsumer;␊ |
180 | ␊ |
181 | IOService *␉displayManager;␉// points to display manager␊ |
182 | IOPMPowerFlags␉displayState;␊ |
183 | ␊ |
184 | IOService *␉rootDomain;␊ |
185 | AbsoluteTime␉stateChangeDeadline;␊ |
186 | ␊ |
187 | OSDictionary * savedParameters;␉// keep user settings␊ |
188 | ␊ |
189 | const char * registryName;␉␉// cache our name␊ |
190 | UInt32␉␉maxWaitCursorFrame;␉// animation frames␊ |
191 | ␉UInt32␉␉firstWaitCursorFrame;␉//␊ |
192 | ␊ |
193 | int␉␉cachedEventFlags;␊ |
194 | OSArray * cachedButtonStates;␊ |
195 | ␊ |
196 | OSArray * systemInfo;␊ |
197 | ␊ |
198 | IOHIDPointingDevice * _hidPointingDevice;␊ |
199 | IOHIDKeyboardDevice * _hidKeyboardDevice;␊ |
200 | ␊ |
201 | unsigned consumedKeyCode;␊ |
202 | ␊ |
203 | OSObject * lastSender;␊ |
204 | ␊ |
205 | UInt32 scrollZoomMask;␊ |
206 | ␊ |
207 | bool setParamPropertiesInProgress;␊ |
208 | ␊ |
209 | OSSet * dataQueueSet;␊ |
210 | ␊ |
211 | private:␊ |
212 | void vblEvent(void);␊ |
213 | UInt8 getSubtypeForSender(OSObject * sender);␊ |
214 | void updateMouseEventForSender(OSObject * sender, NXEventData * evData);␊ |
215 | void updateMouseMoveEventForSender(OSObject * sender, NXEventData * evData);␊ |
216 | void updateScrollEventForSender(OSObject * sender, NXEventData * evData);␊ |
217 | static void _vblEvent(OSObject *self, IOTimerEventSource *sender);␊ |
218 | ␊ |
219 | inline short getUniqueEventNum();␊ |
220 | ␊ |
221 | virtual IOReturn powerStateDidChangeTo( IOPMPowerFlags, unsigned long, IOService * );␊ |
222 | /* Resets */␊ |
223 | void _resetMouseParameters();␊ |
224 | ␊ |
225 | /* Initialize the shared memory area */␊ |
226 | void initShmem(bool clean);␊ |
227 | /* Dispatch low level events through shared memory to the WindowServer */␊ |
228 | void postEvent(int what,␊ |
229 | /* at */ IOGPoint * location,␊ |
230 | /* atTime */ AbsoluteTime ts,␊ |
231 | /* withData */ NXEventData * myData,␊ |
232 | /* sender */ OSObject * sender = 0,␊ |
233 | /* pid */ UInt32 extPID = 0,␊ |
234 | /* processKEQ*/bool processKEQ = true);␊ |
235 | /* Dispatch mechanisms for screen state changes */␊ |
236 | void evDispatch(␊ |
237 | /* command */ EvCmd evcmd);␊ |
238 | /* Dispatch mechanism for special key press */␊ |
239 | void evSpecialKeyMsg(unsigned key,␊ |
240 | /* direction */ unsigned dir,␊ |
241 | /* flags */ unsigned f,␊ |
242 | /* level */ unsigned l);␊ |
243 | /* Message the event consumer to process posted events */␊ |
244 | void kickEventConsumer();␊ |
245 | void sendStackShotMessage();␊ |
246 | ␊ |
247 | OSDictionary * createFilteredParamPropertiesForService(IOService * service, OSDictionary * dict);␊ |
248 | ␊ |
249 | static void _periodicEvents(IOHIDSystem * self,␊ |
250 | IOTimerEventSource *timer);␊ |
251 | ␊ |
252 | static void doSpecialKeyMsg(IOHIDSystem * self,␊ |
253 | ␉␉␉␉␉struct evioSpecialKeyMsg *msg);␊ |
254 | static void doKickEventConsumer(IOHIDSystem * self);␊ |
255 | ␊ |
256 | static void doProcessKeyboardEQ(IOHIDSystem * self);␊ |
257 | static void processKeyboardEQ(IOHIDSystem * self, AbsoluteTime * deadline = 0);␊ |
258 | ␊ |
259 | static bool genericNotificationHandler( void * target, ␊ |
260 | ␉␉␉␉void * ref, IOService * newService );␊ |
261 | ␊ |
262 | static bool handlePublishNotification( void * target, IOService * newService );␊ |
263 | ␊ |
264 | static bool handleTerminateNotification( void * target, IOService * service );␊ |
265 | ␊ |
266 | static void makeNumberParamProperty( OSDictionary * dict, const char * key,␊ |
267 | unsigned long long number, unsigned int bits );␊ |
268 | ␊ |
269 | static void makeInt32ArrayParamProperty( OSDictionary * dict, const char * key,␊ |
270 | UInt32 * array, unsigned int count );␊ |
271 | ␊ |
272 | /*␊ |
273 | * HISTORICAL NOTE:␊ |
274 | * The following methods were part of the IOHIDSystem(Input) category;␊ |
275 | * the declarations have now been merged directly into this class.␊ |
276 | *␊ |
277 | * Exported Interface Event Driver object input services.␊ |
278 | */␊ |
279 | ␊ |
280 | private:␊ |
281 | // Schedule next periodic run based on current event system state.␊ |
282 | void scheduleNextPeriodicEvent();␊ |
283 | // Message invoked to run periodic events. This method runs in the workloop.␊ |
284 | void periodicEvents(IOTimerEventSource *timer);␊ |
285 | // Start the cursor running.␊ |
286 | bool startCursor();␊ |
287 | // Repin cursor location.␊ |
288 | bool resetCursor();␊ |
289 | // Wait Cursor machinery.␊ |
290 | void showWaitCursor();␊ |
291 | void hideWaitCursor();␊ |
292 | void animateWaitCursor();␊ |
293 | void changeCursor(int frame);␊ |
294 | // Return screen number a point lies on.␊ |
295 | int pointToScreen(IOGPoint * p);␊ |
296 | ␊ |
297 | inline void showCursor();␊ |
298 | inline void hideCursor();␊ |
299 | inline void moveCursor();␊ |
300 | // Claim ownership of event sources.␊ |
301 | void attachDefaultEventSources();␊ |
302 | // Give up ownership of event sources.␊ |
303 | void detachEventSources();␊ |
304 | bool registerEventSource(IOService * source);␊ |
305 | ␊ |
306 | // Set abs cursor position.␊ |
307 | void setCursorPosition(IOGPoint * newLoc, bool external, OSObject * sender=0);␊ |
308 | void _setButtonState(int buttons,␊ |
309 | /* atTime */ AbsoluteTime ts,␊ |
310 | OSObject * sender);␊ |
311 | void _setCursorPosition(IOGPoint * newLoc, bool external, bool proximityChange = false, OSObject * sender=0);␊ |
312 | ␊ |
313 | static bool _idleTimeSerializerCallback(void * target, void * ref, OSSerialize *s);␊ |
314 | ␊ |
315 | void _postMouseMoveEvent(int␉␉what,␊ |
316 | IOGPoint *␉location,␊ |
317 | AbsoluteTime␉theClock,␊ |
318 | OSObject *␉sender);␊ |
319 | void createParameters( void );␊ |
320 | ␊ |
321 | /* END HISTORICAL NOTE */␊ |
322 | ␊ |
323 | public:␊ |
324 | static IOHIDSystem * instance(); /* Return the current instance of the */␊ |
325 | ␉␉␉␉ /* EventDriver, or 0 if none. */␊ |
326 | static void scaleLocationToCurrentScreen(IOGPoint *location, IOGBounds *bounds);␊ |
327 | ␊ |
328 | virtual bool init(OSDictionary * properties = 0);␊ |
329 | virtual IOHIDSystem * probe(IOService * provider,␊ |
330 | SInt32 * score);␊ |
331 | virtual bool start(IOService * provider);␊ |
332 | virtual IOReturn message(UInt32 type, IOService * provider,␊ |
333 | ␉␉␉␉void * argument);␊ |
334 | virtual void free();␊ |
335 | virtual bool attach( IOService * provider );␊ |
336 | virtual void detach( IOService * provider );␊ |
337 | ␊ |
338 | virtual IOWorkLoop *getWorkLoop() const;␊ |
339 | ␊ |
340 | virtual IOReturn evOpen(void);␊ |
341 | virtual IOReturn evClose(void);␊ |
342 | ␊ |
343 | virtual IOReturn setProperties( OSObject * properties );␊ |
344 | virtual IOReturn setParamProperties(OSDictionary * dict);␊ |
345 | ␊ |
346 | /* Create the shared memory area */␊ |
347 | virtual IOReturn createShmem(void*,void*,void*,void*,void*,void*);␊ |
348 | ␊ |
349 | /* register the IODataQueue for the new user events */␊ |
350 | virtual IOReturn registerEventQueue(IODataQueue * queue);␊ |
351 | ␊ |
352 | /* Unregister the IODataQueue for the new user events */␊ |
353 | virtual IOReturn unregisterEventQueue(IODataQueue * queue);␊ |
354 | ␊ |
355 | /* Set the port for event available notify msg */␊ |
356 | virtual void setEventPort(mach_port_t port);␊ |
357 | /* Set the port for the special key keypress msg */␊ |
358 | virtual IOReturn setSpecialKeyPort(␊ |
359 | /* keyFlavor */ int special_key,␊ |
360 | /* keyPort */ mach_port_t key_port);␊ |
361 | virtual mach_port_t specialKeyPort(int special_key);␊ |
362 | ␊ |
363 | ␊ |
364 | virtual IOReturn newUserClient(task_t owningTask,␊ |
365 | /* withToken */ void * security_id,␊ |
366 | /* ofType */ UInt32 type,␊ |
367 | /* withProps*/ OSDictionary * properties,␊ |
368 | /* client */ IOUserClient ** handler);␊ |
369 | ␊ |
370 | /*␊ |
371 | * HISTORICAL NOTE:␊ |
372 | * The following methods were part of the IOHIPointingEvents protocol;␊ |
373 | * the declarations have now been merged directly into this class.␊ |
374 | */␊ |
375 | ␊ |
376 | public: ␊ |
377 | /* Mouse event reporting */␊ |
378 | virtual void relativePointerEvent(int buttons,␊ |
379 | /* deltaX */ int dx,␊ |
380 | /* deltaY */ int dy,␊ |
381 | /* atTime */ AbsoluteTime ts);␊ |
382 | ␊ |
383 | /* Tablet event reporting */␊ |
384 | virtual void absolutePointerEvent(int buttons,␊ |
385 | /* at */ IOGPoint * newLoc,␊ |
386 | /* withBounds */ IOGBounds *bounds,␊ |
387 | /* inProximity */ bool proximity,␊ |
388 | /* withPressure */ int pressure,␊ |
389 | /* withAngle */ int stylusAngle,␊ |
390 | /* atTime */ AbsoluteTime ts);␊ |
391 | ␊ |
392 | /* Mouse scroll wheel event reporting */␊ |
393 | virtual void scrollWheelEvent(short deltaAxis1,␊ |
394 | short deltaAxis2,␊ |
395 | short deltaAxis3,␊ |
396 | AbsoluteTime ts);␊ |
397 | ␊ |
398 | ␊ |
399 | virtual void tabletEvent(NXEventData *tabletData,␊ |
400 | AbsoluteTime ts);␊ |
401 | ␊ |
402 | virtual void proximityEvent(NXEventData *proximityData,␊ |
403 | AbsoluteTime ts);␊ |
404 | ␊ |
405 | /*␊ |
406 | * HISTORICAL NOTE:␊ |
407 | * The following methods were part of the IOHIKeyboardEvents protocol;␊ |
408 | * the declarations have now been merged directly into this class.␊ |
409 | */␊ |
410 | ␊ |
411 | public:␊ |
412 | virtual void keyboardEvent(unsigned eventType,␊ |
413 | /* flags */ unsigned flags,␊ |
414 | /* keyCode */ unsigned key,␊ |
415 | /* charCode */ unsigned charCode,␊ |
416 | /* charSet */ unsigned charSet,␊ |
417 | /* originalCharCode */ unsigned origCharCode,␊ |
418 | /* originalCharSet */ unsigned origCharSet,␊ |
419 | /* keyboardType */ unsigned keyboardType,␊ |
420 | /* repeat */ bool repeat,␊ |
421 | /* atTime */ AbsoluteTime ts);␊ |
422 | ␊ |
423 | virtual void keyboardSpecialEvent( unsigned eventType,␊ |
424 | /* flags */ unsigned flags,␊ |
425 | /* keyCode */ unsigned key,␊ |
426 | /* specialty */ unsigned flavor,␊ |
427 | /* guid */ ␉ UInt64 guid,␊ |
428 | /* repeat */ bool repeat,␊ |
429 | /* atTime */ AbsoluteTime ts);␊ |
430 | ␊ |
431 | virtual void updateEventFlags(unsigned flags); /* Does not generate events */␊ |
432 | ␊ |
433 | ␊ |
434 | ␊ |
435 | ␊ |
436 | private:␊ |
437 | ␊ |
438 | /*␊ |
439 | * statics for upstream callouts␊ |
440 | */␊ |
441 | ␊ |
442 | void _scaleLocationToCurrentScreen(IOGPoint *location, IOGPoint *fraction, IOGBounds *bounds); // Should this one be public???␊ |
443 | ␊ |
444 | static void _relativePointerEvent(IOHIDSystem * self,␊ |
445 | ␉␉␉␉ int buttons,␊ |
446 | /* deltaX */ int dx,␊ |
447 | /* deltaY */ int dy,␊ |
448 | /* atTime */ AbsoluteTime ts,␊ |
449 | OSObject * sender,␊ |
450 | void * refcon);␊ |
451 | ␊ |
452 | /* Tablet event reporting */␊ |
453 | static void _absolutePointerEvent(IOHIDSystem * self,␊ |
454 | ␉␉␉␉ int buttons,␊ |
455 | /* at */ IOGPoint * newLoc,␊ |
456 | /* withBounds */ IOGBounds *bounds,␊ |
457 | /* inProximity */ bool proximity,␊ |
458 | /* withPressure */ int pressure,␊ |
459 | /* withAngle */ int stylusAngle,␊ |
460 | /* atTime */ AbsoluteTime ts,␊ |
461 | OSObject * sender,␊ |
462 | void * refcon);␊ |
463 | ␊ |
464 | /* Mouse scroll wheel event reporting */␊ |
465 | static void _scrollWheelEvent( IOHIDSystem *self,␊ |
466 | short deltaAxis1,␊ |
467 | short deltaAxis2,␊ |
468 | short deltaAxis3,␊ |
469 | IOFixed fixedDelta1,␊ |
470 | IOFixed fixedDelta2,␊ |
471 | IOFixed fixedDelta3,␊ |
472 | SInt32 pointDeltaAxis1,␊ |
473 | SInt32 pointDeltaAxis2,␊ |
474 | SInt32 pointDeltaAxis3,␊ |
475 | UInt32 options,␊ |
476 | AbsoluteTime ts,␊ |
477 | OSObject * sender,␊ |
478 | void * refcon);␊ |
479 | ␊ |
480 | static void _tabletEvent( IOHIDSystem *self,␊ |
481 | NXEventData *tabletData,␊ |
482 | AbsoluteTime ts,␊ |
483 | OSObject * sender,␊ |
484 | void * refcon);␊ |
485 | ␊ |
486 | static void _proximityEvent( IOHIDSystem *self,␊ |
487 | NXEventData *proximityData,␊ |
488 | AbsoluteTime ts,␊ |
489 | OSObject * sender,␊ |
490 | void * refcon);␊ |
491 | ␊ |
492 | static void _keyboardEvent( IOHIDSystem * self,␊ |
493 | unsigned eventType,␊ |
494 | /* flags */ unsigned flags,␊ |
495 | /* keyCode */ unsigned key,␊ |
496 | /* charCode */ unsigned charCode,␊ |
497 | /* charSet */ unsigned charSet,␊ |
498 | /* originalCharCode */ unsigned origCharCode,␊ |
499 | /* originalCharSet */ unsigned origCharSet,␊ |
500 | /* keyboardType */ unsigned keyboardType,␊ |
501 | /* repeat */ bool repeat,␊ |
502 | /* atTime */ AbsoluteTime ts,␊ |
503 | OSObject * sender,␊ |
504 | void * refcon);␊ |
505 | ␊ |
506 | static void _keyboardSpecialEvent(IOHIDSystem * self,␊ |
507 | unsigned eventType,␊ |
508 | /* flags */ unsigned flags,␊ |
509 | /* keyCode */ unsigned key,␊ |
510 | /* specialty */ unsigned flavor,␊ |
511 | /* guid */ UInt64 guid,␊ |
512 | /* repeat */ bool repeat,␊ |
513 | /* atTime */ AbsoluteTime ts,␊ |
514 | OSObject * sender,␊ |
515 | void * refcon);␊ |
516 | ␊ |
517 | static void _updateEventFlags( IOHIDSystem * self,␊ |
518 | unsigned flags,␊ |
519 | OSObject * sender,␊ |
520 | void * refcon); /* Does not generate events */␊ |
521 | ␊ |
522 | ␊ |
523 | /*␊ |
524 | * HISTORICAL NOTE:␊ |
525 | * The following methods were part of the IOUserClient protocol;␊ |
526 | * the declarations have now been merged directly into this class.␊ |
527 | */␊ |
528 | ␊ |
529 | public:␊ |
530 | ␊ |
531 | virtual IOReturn setEventsEnable(void*,void*,void*,void*,void*,void*);␊ |
532 | virtual IOReturn setCursorEnable(void*,void*,void*,void*,void*,void*);␊ |
533 | virtual IOReturn extPostEvent(void*,void*,void*,void*,void*,void*);␊ |
534 | virtual IOReturn extSetMouseLocation(void*,void*,void*,void*,void*,void*);␊ |
535 | virtual IOReturn extGetButtonEventNum(void*,void*,void*,void*,void*,void*);␊ |
536 | IOReturn extSetBounds( IOGBounds * bounds );␊ |
537 | IOReturn extGetModifierLockState(void*,void*,void*,void*,void*,void*);␊ |
538 | IOReturn extSetModifierLockState(void*,void*,void*,void*,void*,void*);␊ |
539 | ␊ |
540 | /*␊ |
541 | * HISTORICAL NOTE:␊ |
542 | * The following methods were part of the IOScreenRegistration protocol;␊ |
543 | * the declarations have now been merged directly into this class.␊ |
544 | *␊ |
545 | * Methods exported by the EventDriver for display systems.␊ |
546 | *␊ |
547 | *␉The screenRegister protocol is used by frame buffer drivers to register␊ |
548 | *␉themselves with the Event Driver. These methods are called in response␊ |
549 | *␉to an _IOGetParameterInIntArray() call with "IO_Framebuffer_Register" or␊ |
550 | *␉"IO_Framebuffer_Unregister".␊ |
551 | */␊ |
552 | ␊ |
553 | public:␊ |
554 | virtual int registerScreen(IOGraphicsDevice * instance,␊ |
555 | /* bounds */ IOGBounds * bp);␊ |
556 | // /* shmem */ void ** addr,␊ |
557 | // /* size */ int * size)␊ |
558 | virtual void unregisterScreen(int index);␊ |
559 | ␊ |
560 | /*␊ |
561 | * HISTORICAL NOTE:␊ |
562 | * The following methods were part of the IOWorkspaceBounds protocol;␊ |
563 | * the declarations have now been merged directly into this class.␊ |
564 | *␊ |
565 | * Absolute position input devices and some specialized output devices␊ |
566 | * may need to know the bounding rectangle for all attached displays.␊ |
567 | * The following method returns a IOGBounds* for the workspace. Please note␊ |
568 | * that the bounds are kept as signed values, and that on a multi-display␊ |
569 | * system the minx and miny values may very well be negative.␊ |
570 | */␊ |
571 | ␊ |
572 | public:␊ |
573 | virtual IOGBounds * workspaceBounds();␊ |
574 | ␊ |
575 | /* END HISTORICAL NOTES */␊ |
576 | ␊ |
577 | private:␊ |
578 | void relativePointerEvent( int buttons,␊ |
579 | /* deltaX */ int dx,␊ |
580 | /* deltaY */ int dy,␊ |
581 | /* atTime */ AbsoluteTime ts,␊ |
582 | /* senderID */ OSObject * sender);␊ |
583 | ␊ |
584 | /* Tablet event reporting */␊ |
585 | void absolutePointerEvent( int buttons,␊ |
586 | /* at */ IOGPoint * newLoc,␊ |
587 | /* withBounds */ IOGBounds *bounds,␊ |
588 | /* inProximity */ bool proximity,␊ |
589 | /* withPressure */ int pressure,␊ |
590 | /* withAngle */ int stylusAngle,␊ |
591 | /* atTime */ AbsoluteTime ts,␊ |
592 | /* senderID */ OSObject * sender);␊ |
593 | ␊ |
594 | /* Mouse scroll wheel event reporting */␊ |
595 | void scrollWheelEvent(␉ short ␉ deltaAxis1,␊ |
596 | short deltaAxis2,␊ |
597 | short deltaAxis3,␊ |
598 | IOFixed fixedDelta1,␊ |
599 | IOFixed fixedDelta2,␊ |
600 | IOFixed fixedDelta3,␊ |
601 | SInt32 pointDeltaAxis1,␊ |
602 | SInt32 pointDeltaAxis2,␊ |
603 | SInt32 pointDeltaAxis3,␊ |
604 | UInt32 options,␊ |
605 | AbsoluteTime ts,␊ |
606 | OSObject * sender);␊ |
607 | ␊ |
608 | void tabletEvent(␉NXEventData * tabletData,␊ |
609 | AbsoluteTime ts,␊ |
610 | OSObject * sender);␊ |
611 | ␊ |
612 | void proximityEvent(␉NXEventData * proximityData,␊ |
613 | AbsoluteTime ts,␊ |
614 | OSObject * sender);␊ |
615 | ␊ |
616 | void keyboardEvent(unsigned eventType,␊ |
617 | /* flags */ unsigned flags,␊ |
618 | /* keyCode */ unsigned key,␊ |
619 | /* charCode */ unsigned charCode,␊ |
620 | /* charSet */ unsigned charSet,␊ |
621 | /* originalCharCode */ unsigned origCharCode,␊ |
622 | /* originalCharSet */ unsigned origCharSet,␊ |
623 | /* keyboardType */ unsigned keyboardType,␊ |
624 | /* repeat */ bool repeat,␊ |
625 | /* atTime */ AbsoluteTime ts,␊ |
626 | /* sender */ OSObject * sender);␊ |
627 | ␊ |
628 | void keyboardSpecialEvent( unsigned eventType,␊ |
629 | /* flags */ unsigned flags,␊ |
630 | /* keyCode */ unsigned key,␊ |
631 | /* specialty */ unsigned flavor,␊ |
632 | /* guid */ UInt64 guid,␊ |
633 | /* repeat */ bool repeat,␊ |
634 | /* atTime */ AbsoluteTime ts,␊ |
635 | /* sender */ OSObject * sender);␊ |
636 | ␊ |
637 | void updateEventFlags(unsigned flags, OSObject * sender);␊ |
638 | ␊ |
639 | /*␊ |
640 | * COMMAND GATE COMPATIBILITY:␊ |
641 | * The following method is part of the work needed to make IOHIDSystem␊ |
642 | * compatible with IOCommandGate. The use of IOCommandQueue has been␊ |
643 | * deprecated, thus requiring this move. This should allow for less␊ |
644 | * context switching as all actions formerly run on the I/O Workloop␊ |
645 | * thread, will now be run on the caller thread. The static methods␊ |
646 | * will be called from cmdGate->runAction and returns the appropriate ␊ |
647 | * non-static helper method. Arguments are stored in the void* array, ␊ |
648 | * args, and are passed through. Since we are returning in the static␊ |
649 | * function, gcc3 should translate that to one instruction, thus ␊ |
650 | * minimizing cost.␊ |
651 | */ ␊ |
652 | ␊ |
653 | static␉IOReturn␉doEvClose (IOHIDSystem *self);␊ |
654 | IOReturn␉evCloseGated (void);␊ |
655 | ␊ |
656 | static␉IOReturn␉doSetEventsEnablePre (IOHIDSystem *self, void *p1);␊ |
657 | IOReturn␉setEventsEnablePreGated (void *p1);␊ |
658 | ␊ |
659 | static␉IOReturn␉doSetEventsEnablePost (IOHIDSystem *self, void *p1);␊ |
660 | IOReturn␉setEventsEnablePostGated (void *p1);␊ |
661 | ␊ |
662 | static␉IOReturn␉doUnregisterScreen (IOHIDSystem *self, void * arg0);␊ |
663 | void␉␉unregisterScreenGated (int index);␊ |
664 | ␊ |
665 | static␉IOReturn␉doCreateShmem (IOHIDSystem *self, void * arg0);␊ |
666 | IOReturn␉createShmemGated (void * p1);␊ |
667 | ␊ |
668 | static␉IOReturn␉doRegisterEventQueue (IOHIDSystem *self, void * arg0);␊ |
669 | IOReturn␉registerEventQueueGated (void * p1);␊ |
670 | ␊ |
671 | static␉IOReturn␉doUnregisterEventQueue (IOHIDSystem *self, void * arg0);␊ |
672 | IOReturn␉unregisterEventQueueGated (void * p1);␊ |
673 | ␊ |
674 | static␉IOReturn␉doRelativePointerEvent (IOHIDSystem *self, void * args);␊ |
675 | void␉␉relativePointerEventGated(int buttons, ␊ |
676 | int dx, ␊ |
677 | int dy, ␊ |
678 | AbsoluteTime ts,␊ |
679 | OSObject * sender);␊ |
680 | ␊ |
681 | static␉IOReturn␉doAbsolutePointerEvent (IOHIDSystem *self, void * args); ␊ |
682 | void ␉␉absolutePointerEventGated (int buttons,␊ |
683 | IOGPoint * newLoc,␊ |
684 | IOGBounds *bounds,␊ |
685 | bool proximity,␊ |
686 | int pressure,␊ |
687 | int stylusAngle,␊ |
688 | AbsoluteTime ts,␊ |
689 | OSObject * sender);␊ |
690 | ␊ |
691 | static␉IOReturn␉doScrollWheelEvent(IOHIDSystem *self, void * args); ␊ |
692 | void␉␉scrollWheelEventGated (short deltaAxis1,␊ |
693 | short deltaAxis2,␊ |
694 | short deltaAxis3,␊ |
695 | IOFixed fixedDelta1,␊ |
696 | IOFixed fixedDelta2,␊ |
697 | IOFixed fixedDelta3,␊ |
698 | SInt32 pointDeltaAxis1,␊ |
699 | SInt32 pointDeltaAxis2,␊ |
700 | SInt32 pointDeltaAxis3,␊ |
701 | UInt32 options,␊ |
702 | AbsoluteTime ts,␊ |
703 | OSObject * sender);␊ |
704 | ␊ |
705 | static␉IOReturn␉doTabletEvent (IOHIDSystem *self, void * arg0, void * arg1, void * arg2); ␊ |
706 | void␉␉tabletEventGated (␉NXEventData *tabletData, ␊ |
707 | AbsoluteTime ts, ␊ |
708 | OSObject * sender);␊ |
709 | ␊ |
710 | static␉IOReturn␉doProximityEvent (IOHIDSystem *self, void * arg0, void * arg1, void * arg2); ␊ |
711 | void␉␉proximityEventGated (␉NXEventData *proximityData, ␊ |
712 | AbsoluteTime ts, ␊ |
713 | OSObject * sender);␊ |
714 | ␊ |
715 | static␉IOReturn␉doKeyboardEvent (IOHIDSystem *self, void * args); ␊ |
716 | void␉␉keyboardEventGated (unsigned eventType,␊ |
717 | unsigned flags,␊ |
718 | unsigned key,␊ |
719 | unsigned charCode,␊ |
720 | unsigned charSet,␊ |
721 | unsigned origCharCode,␊ |
722 | unsigned origCharSet,␊ |
723 | unsigned keyboardType,␊ |
724 | bool repeat,␊ |
725 | AbsoluteTime ts,␊ |
726 | OSObject * sender);␊ |
727 | ␊ |
728 | static␉IOReturn␉doKeyboardSpecialEvent (IOHIDSystem *self, void * args); ␊ |
729 | void␉␉keyboardSpecialEventGated ( ␊ |
730 | unsigned eventType,␊ |
731 | unsigned flags,␊ |
732 | unsigned key,␊ |
733 | unsigned flavor,␊ |
734 | UInt64 guid,␊ |
735 | bool repeat,␊ |
736 | AbsoluteTime ts,␊ |
737 | OSObject * sender);␊ |
738 | ␊ |
739 | static␉IOReturn␉doUpdateEventFlags (IOHIDSystem *self, void * args); ␊ |
740 | void␉␉updateEventFlagsGated (unsigned flags, OSObject * sender);␊ |
741 | ␊ |
742 | static␉IOReturn␉doNewUserClient (IOHIDSystem *self, void * args); ␊ |
743 | IOReturn ␉newUserClientGated (task_t owningTask,␊ |
744 | void * security_id,␊ |
745 | UInt32 type,␊ |
746 | OSDictionary * properties,␊ |
747 | IOUserClient ** handler);␊ |
748 | ␊ |
749 | static␉IOReturn␉doSetCursorEnable (IOHIDSystem *self, void * arg0); ␊ |
750 | IOReturn␉setCursorEnableGated (void * p1);␊ |
751 | ␊ |
752 | static␉IOReturn␉doExtPostEvent(IOHIDSystem *self, void * arg0, void * arg1, void * arg2, void * arg3); ␊ |
753 | IOReturn␉extPostEventGated (void * p1, void * p2, void * p3);␊ |
754 | ␊ |
755 | static␉IOReturn␉doExtSetMouseLocation (IOHIDSystem *self, void * args); ␊ |
756 | IOReturn␉extSetMouseLocationGated (void * args);␊ |
757 | ␊ |
758 | static␉IOReturn␉doExtGetButtonEventNum (IOHIDSystem *self, void * arg0, void * arg1); ␊ |
759 | IOReturn␉extGetButtonEventNumGated (void * p1, void * p2);␊ |
760 | ␊ |
761 | static␉IOReturn␉doSetParamPropertiesPre (IOHIDSystem *self, void * arg0, void * arg1); ␊ |
762 | IOReturn␉setParamPropertiesPreGated (OSDictionary * dict, OSIterator ** pOpenIter);␊ |
763 | ␊ |
764 | static␉IOReturn␉doSetParamPropertiesPost (IOHIDSystem *self, void * arg0); ␊ |
765 | IOReturn␉setParamPropertiesPostGated (OSDictionary * dict);␊ |
766 | ␊ |
767 | static␉IOReturn␉doExtGetToggleState (IOHIDSystem *self, void *p1, void *p2); ␊ |
768 | static␉IOReturn␉doExtSetToggleState (IOHIDSystem *self, void *p1, void *p2); ␊ |
769 | IOReturn getCapsLockState(unsigned int *state_O);␊ |
770 | IOReturn setCapsLockState(unsigned int state_I);␊ |
771 | IOReturn getNumLockState(unsigned int *state_O);␊ |
772 | IOReturn setNumLockState(unsigned int state_I);␊ |
773 | ␊ |
774 | /* END COMMAND GATE COMPATIBILITY */␊ |
775 | ␊ |
776 | public:␊ |
777 | virtual void setStackShotPort(mach_port_t port);␊ |
778 | ␊ |
779 | virtual UInt32 eventFlags();␊ |
780 | ␊ |
781 | virtual void dispatchEvent(IOHIDEvent *event, IOOptionBits options=0);␊ |
782 | ␊ |
783 | };␊ |
784 | ␊ |
785 | #endif /* !_IOHIDSYSTEM_H */␊ |
786 |