source: trunk/appswitch/appswitch/CPS.h@ 176

Last change on this file since 176 was 92, checked in by Nicholas Riley, 22 years ago

moved to standard directory structure

File size: 5.1 KB
Line 
1// CPS.h
2
3#pragma once
4
5#include <ApplicationServices/ApplicationServices.h>
6
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#if PRAGMA_STRUCT_ALIGN
13 #pragma options align=mac68k
14#elif PRAGMA_STRUCT_PACKPUSH
15 #pragma pack(push, 2)
16#elif PRAGMA_STRUCT_PACK
17 #pragma pack(2)
18#endif
19
20
21struct CPSProcessSerNum
22{
23 UInt32 lo;
24 UInt32 hi;
25};
26
27typedef struct CPSProcessSerNum CPSProcessSerNum;
28
29enum
30{
31 kCPSNoProcess = 0,
32 kCPSSystemProcess = 1,
33 kCPSCurrentProcess = 2
34};
35
36
37enum
38{
39 bfCPSIntraProcessSwitch = 1,
40 bfCPSDeathBySignal = 2
41};
42
43typedef UInt16 CPSEventFlags;
44
45
46enum
47{
48 kCPSBlueApp = 0,
49 kCPSBlueBox = 1,
50 kCPSCarbonApp = 2,
51 kCPSYellowApp = 3,
52 kCPSUnknownApp = 4
53};
54
55typedef UInt32 CPSAppFlavour;
56
57
58enum
59{
60 kCPSBGOnlyAttr = 1024,
61 kCPSUIElementAttr = 65536,
62 kCPSHiddenAttr = 131072,
63 kCPSNoConnectAttr = 262144,
64 kCPSFullScreenAttr = 524288,
65 kCPSClassicReqAttr = 1048576,
66 kCPSNativeReqAttr = 2097152
67};
68
69typedef UInt32 CPSProcAttributes;
70
71
72struct CPSProcessInfoRec
73{
74 CPSProcessSerNum Parent;
75 UInt64 LaunchDate;
76 CPSAppFlavour Flavour;
77 CPSProcAttributes Attributes;
78 UInt32 ExecFileType;
79 UInt32 ExecFileCreator;
80 SInt32 UnixPID; // njr changed from UInt32
81};
82
83typedef struct CPSProcessInfoRec CPSProcessInfoRec;
84
85
86enum
87{
88 kCPSNotifyChildDeath = 1,
89 kCPSNotifyNewFront = 2,
90 kCPSNotifyAppBirth = 4,
91 kCPSNotifyAppDeath = 8,
92 kCPSNotifyLaunch = 9,
93 kCPSNotifyServiceReq = 16,
94 kCPSNotifyAppHidden = 32,
95 kCPSNotifyAppRevealed = 64,
96 kCPSNotifyFGEnabled = 128,
97 kCPSNotifyLaunchStart = 256,
98 kCPSNotifyAppReady = 512,
99 kCPSNotifyLaunchFail = 1024,
100 kCPSNotifyAppDeathExt = 2048,
101 kCPSNotifyLostKeyFocus = 4096
102};
103
104typedef UInt32 CPSNotificationCodes;
105
106
107enum
108{
109 bfCPSLaunchInhibitDaemon = 128,
110 bfCPSLaunchDontSwitch = 512,
111 bfCPSLaunchNoProcAttr = 2048,
112 bfCPSLaunchAsync = 65536,
113 bfCPSLaunchStartClassic = 131072,
114 bfCPSLaunchInClassic = 262144,
115 bfCPSLaunchInstance = 524288,
116 bfCPSLaunchAndHide = 1048576,
117 bfCPSLaunchAndHideOthers = 2097152
118};
119
120typedef UInt32 CPSLaunchOptions;
121
122
123typedef UInt8 *CPSLaunchRefcon;
124
125
126typedef UInt8 *CPSLaunchData;
127
128
129enum
130{
131 bfCPSExtLaunchWithData = 2,
132 bfCPSExtLaunchByParent = 4,
133 bfCPSExtLaunchAsUidGid = 8
134};
135
136typedef UInt32 CPSLaunchPBFields;
137
138
139struct CPSLaunchPB
140{
141 CPSLaunchPBFields Contents;
142 CPSLaunchData pData;
143 UInt32 DataLen;
144 UInt32 DataTag;
145 UInt32 RefCon;
146 CPSProcessSerNum Parent;
147 UInt32 ChildUID;
148 UInt32 ChildGID;
149};
150
151typedef struct CPSLaunchPB CPSLaunchPB;
152
153
154enum
155{
156 bfCPSKillHard = 1,
157 bfCPSKillAllClassicApps = 2
158};
159
160typedef UInt32 CPSKillOptions;
161
162
163enum
164{
165 kCPSLaunchService = 0,
166 kCPSKillService = 1,
167 kCPSHideService = 2,
168 kCPSShowService = 3,
169 kCPSPrivService = 4,
170 kCPSExtDeathNoteService = 5
171};
172
173typedef UInt32 CPSServiceReqType;
174
175
176struct CPSLaunchRequest
177{
178 CPSProcessSerNum TargetPSN;
179 CPSLaunchOptions Options;
180 CPSProcAttributes ProcAttributes;
181 UInt8 *pUTF8TargetPath;
182 UInt32 PathLen;
183};
184
185typedef struct CPSLaunchRequest CPSLaunchRequest;
186
187
188struct CPSKillRequest
189{
190 CPSProcessSerNum TargetPSN;
191 CPSKillOptions Options;
192};
193
194typedef struct CPSKillRequest CPSKillRequest;
195
196
197struct CPSHideRequest
198{
199 CPSProcessSerNum TargetPSN;
200};
201
202typedef struct CPSHideRequest CPSHideRequest;
203
204
205struct CPSShowRequest
206{
207 CPSProcessSerNum TargetPSN;
208};
209
210typedef struct CPSShowRequest CPSShowRequest;
211
212
213struct CPSExtDeathNotice
214{
215 CPSProcessSerNum DeadPSN;
216 UInt32 Flags;
217 UInt8 *pUTF8AppPath;
218 UInt32 PathLen;
219};
220
221typedef struct CPSExtDeathNotice CPSExtDeathNotice;
222
223
224union CPSRequestDetails
225{
226 CPSLaunchRequest LaunchReq;
227 CPSKillRequest KillReq;
228 CPSHideRequest HideReq;
229 CPSShowRequest ShowReq;
230 CPSExtDeathNotice DeathNotice;
231};
232
233typedef union CPSRequestDetails CPSRequestDetails;
234
235
236struct CPSServiceRequest
237{
238 CPSServiceReqType Type;
239 SInt32 ID;
240 CPSRequestDetails Details;
241};
242
243typedef struct CPSServiceRequest CPSServiceRequest;
244
245
246enum
247{
248 kCPSProcessInterruptKey = 0,
249 kCPSAppSwitchFwdKey = 1,
250 kCPSAppSwitchBackKey = 2,
251 kCPSSessionInterruptKey = 3,
252 kCPSScreenSaverKey = 4,
253 kCPSDiskEjectKey = 5,
254 kCPSSpecialKeyCount = 6
255};
256
257typedef SInt32 CPSSpecialKeyID;
258
259
260extern Boolean CPSEqualProcess( CPSProcessSerNum *psn1, CPSProcessSerNum *psn2);
261
262extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
263
264extern OSErr CPSGetFrontProcess( CPSProcessSerNum *psn);
265
266extern OSErr CPSGetNextProcess( CPSProcessSerNum *psn);
267
268extern OSErr CPSGetNextToFrontProcess( CPSProcessSerNum *psn);
269
270extern OSErr CPSGetProcessInfo( CPSProcessSerNum *psn, CPSProcessInfoRec *info, char *path, int maxPathLen, int *len, char *name, int maxNameLen);
271
272extern OSErr CPSPostHideMostReq( CPSProcessSerNum *psn);
273
274extern OSErr CPSPostHideReq( CPSProcessSerNum *psn);
275
276extern OSErr CPSPostKillRequest( CPSProcessSerNum *psn, CPSKillOptions options);
277
278extern OSErr CPSPostShowAllReq( CPSProcessSerNum *psn);
279
280extern OSErr CPSPostShowReq( CPSProcessSerNum *psn);
281
282extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
283
284extern OSErr CPSReleaseKeyFocus( CPSProcessSerNum *psn);
285
286extern OSErr CPSStealKeyFocus( CPSProcessSerNum *psn);
287
288
289#if PRAGMA_STRUCT_ALIGN
290 #pragma options align=reset
291#elif PRAGMA_STRUCT_PACKPUSH
292 #pragma pack(pop)
293#elif PRAGMA_STRUCT_PACK
294 #pragma pack()
295#endif
296
297#ifdef __cplusplus
298}
299#endif
Note: See TracBrowser for help on using the repository browser.