-
Notifications
You must be signed in to change notification settings - Fork 4
/
CGSPrivate.h
223 lines (188 loc) · 10.2 KB
/
CGSPrivate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */
/* DesktopManager -- A virtual desktop provider for OS X
*
* Copyright (C) 2003, 2004 Richard J Wareham <[email protected]>
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 675
* Mass Ave, Cambridge, MA 02139, USA.
*/
#include <Carbon/Carbon.h>
/* These functions all return a status code. Typical CoreGraphics replies are:
kCGErrorSuccess = 0,
kCGErrorFirst = 1000,
kCGErrorFailure = kCGErrorFirst,
kCGErrorIllegalArgument = 1001,
kCGErrorInvalidConnection = 1002,
*/
// Internal CoreGraphics typedefs
typedef int CGSConnection;
typedef int CGSWindow;
typedef int CGSValue;
#define CGSWindowID CGSWindow
//// CONSTANTS ////
/* Window ordering mode. */
typedef enum _CGSWindowOrderingMode {
kCGSOrderAbove = 1, // Window is ordered above target.
kCGSOrderBelow = -1, // Window is ordered below target.
kCGSOrderOut = 0 // Window is removed from the on-screen window list.
} CGSWindowOrderingMode;
// Internal CoreGraphics functions.
/* Retrieve the workspace number associated with the workspace currently
* being shown.
*
* cid -- Current connection.
* workspace -- Pointer to int value to be set to workspace number.
*/
extern OSStatus CGSGetWorkspace(const CGSConnection cid, int *workspace);
/* Retrieve workspace number associated with the workspace a particular window
* resides on.
*
* cid -- Current connection.
* wid -- Window number of window to examine.
* workspace -- Pointer to int value to be set to workspace number.
*/
extern OSStatus CGSGetWindowWorkspace(const CGSConnection cid, const CGSWindow wid, int *workspace);
/* Show workspace associated with a workspace number.
*
* cid -- Current connection.
* workspace -- Workspace number.
*/
extern OSStatus CGSSetWorkspace(const CGSConnection cid, int workspace);
typedef enum {
CGSNone = 0, // No transition effect.
CGSFade, // Cross-fade.
CGSZoom, // Zoom/fade towards us.
CGSReveal, // Reveal new desktop under old.
CGSSlide, // Slide old out and new in.
CGSWarpFade, // Warp old and fade out revealing new.
CGSSwap, // Swap desktops over graphically.
CGSCube, // The well-known cube effect.
CGSWarpSwitch, // Warp old, switch and un-warp.
CGSFlip // Flip over
} CGSTransitionType;
typedef enum {
CGSDown, // Old desktop moves down.
CGSLeft, // Old desktop moves left.
CGSRight, // Old desktop moves right.
CGSInRight, // CGSSwap: Old desktop moves into screen, new comes from right.
CGSBottomLeft = 5, // CGSSwap: Old desktop moves to bl, new comes from tr.
CGSBottomRight, // Old desktop to br, New from tl.
CGSDownTopRight, // CGSSwap: Old desktop moves down, new from tr.
CGSUp, // Old desktop moves up.
CGSTopLeft, // Old desktop moves tl.
CGSTopRight, // CGSSwap: old to tr. new from bl.
CGSUpBottomRight, // CGSSwap: old desktop up, new from br.
CGSInBottom, // CGSSwap: old in, new from bottom.
CGSLeftBottomRight, // CGSSwap: old one moves left, new from br.
CGSRightBottomLeft, // CGSSwap: old one moves right, new from bl.
CGSInBottomRight, // CGSSwap: onl one in, new from br.
CGSInOut // CGSSwap: old in, new out.
} CGSTransitionOption;
typedef enum {
CGSTagNone = 0, // No tags
CGSTagExposeFade = 0x0002, // Fade out when Expose activates.
CGSTagNoShadow = 0x0008, // No window shadow.
CGSTagTransparent = 0x0200, // Transparent to mouse clicks.
CGSTagSticky = 0x0800, // Appears on all workspaces.
} CGSWindowTag;
extern OSStatus CGSSetWorkspaceWithTransition(const CGSConnection cid,
int workspaceNumber,
CGSTransitionType transition,
CGSTransitionOption subtype,
float time);
/* Get the default connection for the current process. */
extern CGSConnection _CGSDefaultConnection();
extern OSStatus CGSGetConnectionIDForPSN(UInt32 inParam1, ProcessSerialNumber* inPSN, CGSConnection* cid);
typedef struct {
uint32_t unknown1;
CGSTransitionType type;
CGSTransitionOption option;
CGSWindow wid; /* Can be 0 for full-screen */
float *backColour; /* Null for black otherwise pointer to 3 float array with RGB value */
} CGSTransitionSpec;
/* Transition handling. */
extern OSStatus CGSNewTransition(const CGSConnection cid, const CGSTransitionSpec* spec, int *pTransitionHandle);
extern OSStatus CGSInvokeTransition(const CGSConnection cid, int transitionHandle, float duration);
extern OSStatus CGSReleaseTransition(const CGSConnection cid, int transitionHandle);
// thirtyTwo must = 32 for some reason. tags is pointer to
//array ot ints (size 2?). First entry holds window tags.
// 0x0800 is sticky bit.
extern OSStatus CGSGetWindowTags(const CGSConnection cid, const CGSWindow wid,
CGSWindowTag *tags, int thirtyTwo);
extern OSStatus CGSSetWindowTags(const CGSConnection cid, const CGSWindow wid,
CGSWindowTag *tags, int thirtyTwo);
extern OSStatus CGSClearWindowTags(const CGSConnection cid, const CGSWindow wid,
CGSWindowTag *tags, int thirtyTwo);
extern OSStatus CGSGetWindowEventMask(const CGSConnection cid, const CGSWindow wid, uint32_t *mask);
extern OSStatus CGSSetWindowEventMask(const CGSConnection cid, const CGSWindow wid, uint32_t mask);
// Get on-screen window counts and lists.
extern OSStatus CGSGetWindowCount(const CGSConnection cid, CGSConnection targetCID, int* outCount);
extern OSStatus CGSGetWindowList(const CGSConnection cid, CGSConnection targetCID,
int count, int* list, int* outCount);
// Get on-screen window counts and lists.
extern OSStatus CGSGetOnScreenWindowCount(const CGSConnection cid, CGSConnection targetCID, int* outCount);
extern OSStatus CGSGetOnScreenWindowList(const CGSConnection cid, CGSConnection targetCID,
int count, int* list, int* outCount);
// Per-workspace window counts and lists.
extern OSStatus CGSGetWorkspaceWindowCount(const CGSConnection cid, int workspaceNumber, int *outCount);
extern OSStatus CGSGetWorkspaceWindowList(const CGSConnection cid, int workspaceNumber, int count,
int* list, int* outCount);
// Gets the level of a window
extern OSStatus CGSGetWindowLevel(const CGSConnection cid, CGSWindow wid,
int *level);
extern OSStatus CGSSetWindowLevel(const CGSConnection cid, CGSWindow wid,
int *level);
// Window ordering
extern OSStatus CGSOrderWindow(const CGSConnection cid, const CGSWindow wid,
CGSWindowOrderingMode place, CGSWindow relativeToWindowID /* can be NULL */);
// Gets the screen rect for a window.
extern OSStatus CGSGetScreenRectForWindow(const CGSConnection cid, CGSWindow wid,
CGRect *outRect);
// Window appearance/position
extern OSStatus CGSSetWindowAlpha(const CGSConnection cid, const CGSWindow wid, float alpha);
extern OSStatus CGSSetWindowListAlpha(const CGSConnection cid, CGSWindow *wids, int count, float alpha);
extern OSStatus CGSGetWindowAlpha(const CGSConnection cid, const CGSWindow wid, float* alpha);
extern OSStatus CGSMoveWindow(const CGSConnection cid, const CGSWindow wid, CGPoint *point);
extern OSStatus CGSSetWindowTransform(const CGSConnection cid, const CGSWindow wid, CGAffineTransform transform);
extern OSStatus CGSGetWindowTransform(const CGSConnection cid, const CGSWindow wid, CGAffineTransform * outTransform);
extern OSStatus CGSSetWindowTransforms(const CGSConnection cid, CGSWindow *wids, CGAffineTransform *transform, int n);
extern OSStatus CGSMoveWorkspaceWindows(const CGSConnection connection, int toWorkspace, int fromWorkspace);
extern OSStatus CGSMoveWorkspaceWindowList(const CGSConnection connection, CGSWindow *wids, int count,
int toWorkspace);
// extern OSStatus CGSConnectionGetPID(const CGSConnection cid, pid_t *pid, CGSConnection b);
extern OSStatus CGSGetWindowProperty(const CGSConnection cid, CGSWindow wid, CGSValue key,
CGSValue *outValue);
extern OSStatus CGSSetWindowProperty(const CGSConnection cid, CGSWindow wid, CGSValue key,
CGSValue *outValue);
//extern OSStatus CGSWindowAddRectToDirtyShape(const CGSConnection cid, const CGSWindow wid, CGRect *rect);
extern OSStatus CGSUncoverWindow(const CGSConnection cid, const CGSWindow wid);
extern OSStatus CGSFlushWindow(const CGSConnection cid, const CGSWindow wid, int unknown /* 0 works */ );
extern OSStatus CGSGetWindowOwner(const CGSConnection cid, const CGSWindow wid, CGSConnection *ownerCid);
extern OSStatus CGSConnectionGetPID(const CGSConnection cid, pid_t *pid, const CGSConnection ownerCid);
// Values
extern CGSValue CGSCreateCStringNoCopy(const char *str);
extern CGSValue CGSCreateCString(const char* str);
extern char* CGSCStringValue(CGSValue string);
extern int CGSIntegerValue(CGSValue intVal);
extern void *CGSReleaseGenericObj(void*);
// Added BW May 2008
extern OSStatus CGSNewConnection(const void **attr, CGSConnection *id);
typedef uint32_t CGSCIFilterID;
// Added CRB Jan 2011 from http://code.google.com/p/undocumented-goodness/source/browse/trunk/CoreGraphics/CGSPrivate.h
# pragma mark Window Core Image Filters
typedef uint32_t CGSWindowFilterRef;
extern CGError CGSNewCIFilterByName(CGSConnection cid, CFStringRef filterName, CGSWindowFilterRef *outFilter);
extern CGError CGSAddWindowFilter(CGSConnection cid, CGSWindowID wid, CGSWindowFilterRef filter, int flags);
extern CGError CGSRemoveWindowFilter(CGSConnection cid, CGSWindowID wid, CGSWindowFilterRef filter);
extern CGError CGSReleaseCIFilter(CGSConnection cid, CGSWindowFilterRef filter);
extern CGError CGSSetCIFilterValuesFromDictionary(CGSConnection cid, CGSWindowFilterRef filter, CFDictionaryRef filterValues);