|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this 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 OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: File: CursorDevices.h
27:
28: Contains: Cursor Devices (mouse/trackball/etc) Interfaces.
29:
30: Version: System 7.5
31:
32: DRI: Rich Kubota
33:
34: Copyright: � 1993-1998 by Apple Computer, Inc., all rights reserved.
35:
36: Warning: *** APPLE INTERNAL USE ONLY ***
37: This file may contain unreleased API's
38:
39: BuildInfo: Built by: Naga Pappireddi
40: With Interfacer: 3.0d9 (PowerPC native)
41: From: CursorDevices.i
42: Revision: 25
43: Dated: 1/22/98
44: Last change by: ngk
45: Last comment: Change Types.i to MacTypes.i
46:
47: Bugs: Report bugs to Radar component "System Interfaces", "Latest"
48: List the version information (from above) in the Problem Description.
49:
50: */
51: #ifndef __CURSORDEVICES__
52: #define __CURSORDEVICES__
53:
54: #ifndef __MACTYPES__
55: //#include <MacTypes.h>
56: #endif
57: #ifndef __MIXEDMODE__
58: //#include <MixedMode.h>
59: #endif
60:
61:
62:
63: #if PRAGMA_ONCE
64: #pragma once
65: #endif
66:
67: #ifdef __cplusplus
68: extern "C" {
69: #endif
70:
71: #if PRAGMA_IMPORT
72: #pragma import on
73: #endif
74:
75: #if PRAGMA_STRUCT_ALIGN
76: #pragma options align=mac68k
77: #elif PRAGMA_STRUCT_PACKPUSH
78: #pragma pack(push, 2)
79: #elif PRAGMA_STRUCT_PACK
80: #pragma pack(2)
81: #endif
82:
83: /*
84: * * * I M P O R T A N T * * *
85:
86: You will need CursorDevicesGlue.o to use CDM from PowerPC
87:
88:
89: In order to use the Cursor Devices Manager (CDM) on PowerPC systems, you must
90: link with the file CursorDevicesGlue.o and InterfaceLib 1.1.3. This is necessary
91: because the original MixedMode transition code for CDM in InterfaceLib in ROM
92: was wrong. The code in CursorDevicesGlue.o will check to see if the ROM has
93: been fixed and calls through to it if so. If it detects that the ROM has not
94: been fixed, it uses its own implementation of the CDM MixedMode transition
95: routines.
96:
97: */
98:
99: typedef short ButtonOpcode;
100: /* ButtonOpcodes */
101:
102: enum {
103: kButtonNoOp = 0, /* No action for this button */
104: kButtonSingleClick = 1, /* Normal mouse button */
105: kButtonDoubleClick = 2, /* Click-release-click when pressed */
106: kButtonClickLock = 3 /* Click on press, release on next press */
107: };
108:
109:
110: enum {
111: kButtonCharStroke = 4, /* A keystroke, data=(modifiers, char code) */
112: kButtonAppleScript = 5 /* An AppleScript */
113: };
114:
115:
116: enum {
117: kButtonCustom = 6 /* Custom behavior, data = CursorDeviceCustomButtonUPP */
118: };
119:
120: /* Device Classes */
121:
122: enum {
123: kDeviceClassAbsolute = 0, /* a flat-response device */
124: kDeviceClassMouse = 1, /* mechanical or optical mouse */
125: kDeviceClassTrackball = 2, /* trackball */
126: kDeviceClassTrackPad = 3
127: };
128:
129:
130: enum {
131: kDeviceClassScratchPad = 3, /* (midas) */
132: kDeviceClassJoystick = 4, /* (homeRow) */
133: kDeviceClassRelTablet = 5 /* relative tablet */
134: };
135:
136:
137: enum {
138: kDeviceClass3D = 6 /* a 3D pointing device */
139: };
140:
141: /* Structures used in Cursor Device Manager calls */
142:
143: struct CursorData {
144: struct CursorData * nextCursorData; /* next in global list */
145: Ptr displayInfo; /* unused (reserved for future) */
146: Fixed whereX; /* horizontal position */
147: Fixed whereY; /* vertical position */
148: Point where; /* the pixel position */
149: Boolean isAbs; /* has been stuffed with absolute coords */
150: UInt8 buttonCount; /* number of buttons currently pressed */
151: long screenRes; /* pixels per inch on the current display */
152: short privateFields[22]; /* fields use internally by CDM */
153: };
154: typedef struct CursorData CursorData;
155: typedef CursorData * CursorDataPtr;
156:
157: struct CursorDevice {
158: struct CursorDevice * nextCursorDevice; /* pointer to next record in linked list */
159: CursorData * whichCursor; /* pointer to data for target cursor */
160: long refCon; /* application-defined */
161: long unused; /* reserved for future */
162: OSType devID; /* device identifier (from ADB reg 1) */
163: Fixed resolution; /* units/inch (orig. from ADB reg 1) */
164: UInt8 devClass; /* device class (from ADB reg 1) */
165: UInt8 cntButtons; /* number of buttons (from ADB reg 1) */
166: UInt8 filler1; /* reserved for future */
167: UInt8 buttons; /* state of all buttons */
168: UInt8 buttonOp[8]; /* action performed per button */
169: unsigned long buttonTicks[8]; /* ticks when button last went up (for debounce) */
170: long buttonData[8]; /* data for the button operation */
171: unsigned long doubleClickTime; /* device-specific double click speed */
172: Fixed acceleration; /* current acceleration */
173: short privateFields[15]; /* fields used internally to CDM */
174: };
175: typedef struct CursorDevice CursorDevice;
176: typedef CursorDevice * CursorDevicePtr;
177: /* for use with CursorDeviceButtonOp when opcode = kButtonCustom */
178: typedef CALLBACK_API( void , CursorDeviceCustomButtonProcPtr )(CursorDevicePtr ourDevice, short button);
179: /*
180: WARNING: CursorDeviceCustomButtonProcPtr uses register based parameters under classic 68k
181: and cannot be written in a high-level language without
182: the help of mixed mode or assembly glue.
183: */
184: //naga typedef REGISTER_UPP_TYPE(CursorDeviceCustomButtonProcPtr) CursorDeviceCustomButtonUPP;
185: enum { uppCursorDeviceCustomButtonProcInfo = 0x000ED802 }; /* register no_return_value Func(4_bytes:A2, 2_bytes:D3) */
186: #if MIXEDMODE_CALLS_ARE_FUNCTIONS
187: EXTERN_API(CursorDeviceCustomButtonUPP)
188: NewCursorDeviceCustomButtonProc (CursorDeviceCustomButtonProcPtr userRoutine);
189: EXTERN_API(void)
190: CallCursorDeviceCustomButtonProc (CursorDeviceCustomButtonUPP userRoutine,
191: CursorDevicePtr ourDevice,
192: short button);
193: #else
194: #define NewCursorDeviceCustomButtonProc(userRoutine) (CursorDeviceCustomButtonUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, GetCurrentArchitecture())
195: #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
196: /* CallCursorDeviceCustomButtonProc can't be called from classic 68k without glue code */
197: #else
198: #define CallCursorDeviceCustomButtonProc(userRoutine, ourDevice, button) CALL_TWO_PARAMETER_UPP((userRoutine), uppCursorDeviceCustomButtonProcInfo, (ourDevice), (button))
199: #endif
200: #endif
201: EXTERN_API( OSErr )
202: CursorDeviceMove (CursorDevicePtr ourDevice,
203: long deltaX,
204: long deltaY) TWOWORDINLINE(0x7000, 0xAADB);
205:
206: EXTERN_API( OSErr )
207: CursorDeviceMoveTo (CursorDevicePtr ourDevice,
208: long absX,
209: long absY) TWOWORDINLINE(0x7001, 0xAADB);
210:
211: EXTERN_API( OSErr )
212: CursorDeviceFlush (CursorDevicePtr ourDevice) TWOWORDINLINE(0x7002, 0xAADB);
213:
214: EXTERN_API( OSErr )
215: CursorDeviceButtons (CursorDevicePtr ourDevice,
216: short buttons) TWOWORDINLINE(0x7003, 0xAADB);
217:
218: EXTERN_API( OSErr )
219: CursorDeviceButtonDown (CursorDevicePtr ourDevice) TWOWORDINLINE(0x7004, 0xAADB);
220:
221: EXTERN_API( OSErr )
222: CursorDeviceButtonUp (CursorDevicePtr ourDevice) TWOWORDINLINE(0x7005, 0xAADB);
223:
224: EXTERN_API( OSErr )
225: CursorDeviceButtonOp (CursorDevicePtr ourDevice,
226: short buttonNumber,
227: ButtonOpcode opcode,
228: long data) TWOWORDINLINE(0x7006, 0xAADB);
229:
230: EXTERN_API( OSErr )
231: CursorDeviceSetButtons (CursorDevicePtr ourDevice,
232: short numberOfButtons) TWOWORDINLINE(0x7007, 0xAADB);
233:
234: EXTERN_API( OSErr )
235: CursorDeviceSetAcceleration (CursorDevicePtr ourDevice,
236: Fixed acceleration) TWOWORDINLINE(0x7008, 0xAADB);
237:
238: EXTERN_API( OSErr )
239: CursorDeviceDoubleTime (CursorDevicePtr ourDevice,
240: long durationTicks) TWOWORDINLINE(0x7009, 0xAADB);
241:
242: EXTERN_API( OSErr )
243: CursorDeviceUnitsPerInch (CursorDevicePtr ourDevice,
244: Fixed resolution) TWOWORDINLINE(0x700A, 0xAADB);
245:
246: EXTERN_API( OSErr )
247: CursorDeviceNextDevice (CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700B, 0xAADB);
248:
249: EXTERN_API( OSErr )
250: CursorDeviceNewDevice (CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700C, 0xAADB);
251:
252: EXTERN_API( OSErr )
253: CursorDeviceDisposeDevice (CursorDevicePtr ourDevice) TWOWORDINLINE(0x700D, 0xAADB);
254:
255:
256:
257:
258: /*
259: * * * W A R N I N G * * *
260:
261: The routines CrsrDevMoveTo and CrsrDevNextDevice are no longer needed.
262: They were added as a work around until the glue code CursorDevicesGlue.o
263: was created. Please use the functions CursorDeviceMoveTo and
264: CursorDeviceNextDevice instead.
265:
266: */
267: #if OLDROUTINENAMES
268: EXTERN_API( OSErr )
269: CrsrDevMoveTo (CursorDevicePtr ourDevice,
270: long absX,
271: long absY) TWOWORDINLINE(0x7001, 0xAADB);
272:
273: EXTERN_API( OSErr )
274: CrsrDevNextDevice (CursorDevicePtr * ourDevice) TWOWORDINLINE(0x700B, 0xAADB);
275:
276: #endif /* OLDROUTINENAMES */
277:
278:
279:
280:
281: #if PRAGMA_STRUCT_ALIGN
282: #pragma options align=reset
283: #elif PRAGMA_STRUCT_PACKPUSH
284: #pragma pack(pop)
285: #elif PRAGMA_STRUCT_PACK
286: #pragma pack()
287: #endif
288:
289: #ifdef PRAGMA_IMPORT_OFF
290: #pragma import off
291: #elif PRAGMA_IMPORT
292: #pragma import reset
293: #endif
294:
295: #ifdef __cplusplus
296: }
297: #endif
298:
299: #endif /* __CURSORDEVICES__ */
300:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.