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