Skip to content

Commit

Permalink
Added debug options to CGSPrivate.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaclach committed Sep 23, 2010
1 parent f2263ec commit ea14aea
Showing 1 changed file with 74 additions and 56 deletions.
130 changes: 74 additions & 56 deletions CoreGraphics/CGSPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,123 +28,123 @@
#ifdef __cplusplus
extern "C" {
#endif

typedef int CGSConnection;
typedef int CGSWindow;
typedef int CGSWorkspace;
typedef int CGSValue;

#pragma mark Listing Windows
/* Get the default connection for the current process. */
extern CGSConnection _CGSDefaultConnection(void);

// Disable/Enable Screen Updates
extern CGError CGSDisableUpdate(CGSConnection cid);
extern CGError CGSReenableUpdate(CGSConnection cid);

#pragma mark Listing Windows

// Get window counts and lists.
extern CGError CGSGetWindowCount(const CGSConnection cid, CGSConnection targetCID, int* outCount);
extern CGError CGSGetWindowCount(const CGSConnection cid, CGSConnection targetCID, int* outCount);
extern CGError CGSGetWindowList(const CGSConnection cid, CGSConnection targetCID, int count, int* list, int* outCount);

// Get on-screen window counts and lists.
extern CGError CGSGetOnScreenWindowCount(const CGSConnection cid, CGSConnection targetCID, int* outCount);
extern CGError CGSGetOnScreenWindowCount(const CGSConnection cid, CGSConnection targetCID, int* outCount);
extern CGError CGSGetOnScreenWindowList(const CGSConnection cid, CGSConnection targetCID, int count, int* list, int* outCount);

// Per-workspace window counts and lists.
extern CGError CGSGetWorkspaceWindowCount(const CGSConnection cid, CGSWorkspace workspaceNumber, int *outCount);
extern CGError CGSGetWorkspaceWindowList(const CGSConnection cid, CGSWorkspace workspaceNumber, int count, int* list, int* outCount);

#pragma mark Window Manipulation

// Window Level
extern CGError CGSGetWindowLevel(const CGSConnection cid, CGSWindow wid, CGWindowLevel *level);
extern CGError CGSSetWindowLevel(const CGSConnection cid, CGSWindow wid, CGWindowLevel level);

// Window ordering
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;
extern CGError CGSOrderWindow(const CGSConnection cid, const CGSWindow wid, CGSWindowOrderingMode place, CGSWindow relativeToWindowID /* can be NULL */);

extern CGError CGSOrderWindow(const CGSConnection cid, const CGSWindow wid, CGSWindowOrderingMode place, CGSWindow relativeToWindowID /* can be NULL */);
extern CGError CGSWindowIsOrderedIn(const CGSConnection cid, const CGSWindow wid, Boolean *result);

extern CGError CGSUncoverWindow(const CGSConnection cid, const CGSWindow wid);
extern CGError CGSFlushWindow(const CGSConnection cid, const CGSWindow wid, int unknown /* 0 works */ );

// Position
extern CGError CGSGetWindowBounds(CGSConnection cid, CGSWindowID wid, CGRect *outBounds);
extern CGError CGSGetScreenRectForWindow(const CGSConnection cid, CGSWindow wid, CGRect *outRect);
extern CGError CGSMoveWindow(const CGSConnection cid, const CGSWindow wid, CGPoint *point);
extern CGError CGSSetWindowTransform(const CGSConnection cid, const CGSWindow wid, CGAffineTransform transform);
extern CGError CGSGetWindowTransform(const CGSConnection cid, const CGSWindow wid, CGAffineTransform * outTransform);
extern CGError CGSSetWindowTransforms(const CGSConnection cid, CGSWindow *wids, CGAffineTransform *transform, int n);
extern CGError CGSSetWindowTransform(const CGSConnection cid, const CGSWindow wid, CGAffineTransform transform);
extern CGError CGSGetWindowTransform(const CGSConnection cid, const CGSWindow wid, CGAffineTransform * outTransform);
extern CGError CGSSetWindowTransforms(const CGSConnection cid, CGSWindow *wids, CGAffineTransform *transform, int n);

// Alpha
extern CGError CGSSetWindowAlpha(const CGSConnection cid, const CGSWindow wid, float alpha);
extern CGError CGSSetWindowListAlpha(const CGSConnection cid, CGSWindow *wids, int count, float alpha);
extern CGError CGSGetWindowAlpha(const CGSConnection cid, const CGSWindow wid, float* alpha);

// Brightness
extern CGError CGSSetWindowListBrightness(const CGSConnection cid, CGSWindow *wids, float *brightness, int count);

// Workspace
extern CGError CGSMoveWorkspaceWindows(const CGSConnection connection, CGSWorkspace toWorkspace, CGSWorkspace fromWorkspace);
extern CGError CGSMoveWorkspaceWindowList(const CGSConnection connection, CGSWindow *wids, int count, CGSWorkspace toWorkspace);

// Shadow
extern CGError CGSSetWindowShadowAndRimParameters(const CGSConnection cid, CGSWindow wid, float standardDeviation, float density, int offsetX, int offsetY, unsigned int flags);
extern CGError CGSGetWindowShadowAndRimParameters(const CGSConnection cid, CGSWindow wid, float* standardDeviation, float* density, int *offsetX, int *offsetY, unsigned int *flags);

// Properties
extern CGError CGSGetWindowProperty(const CGSConnection cid, CGSWindow wid, CGSValue key, CGSValue *outValue);
extern CGError CGSSetWindowProperty(const CGSConnection cid, CGSWindow wid, CGSValue key, CGSValue *outValue);

// Owner
extern CGError CGSGetWindowOwner(const CGSConnection cid, const CGSWindow wid, CGSConnection *ownerCid);
extern CGError CGSConnectionGetPID(const CGSConnection cid, pid_t *pid, const CGSConnection ownerCid);

#pragma mark Window Tags

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;

// thirtyTwo must = 32 for some reason.
// tags is a pointer to an array of ints (size 2?). First entry holds window tags.
extern CGError CGSGetWindowTags(const CGSConnection cid, const CGSWindow wid, CGSWindowTag *tags, int thirtyTwo);
extern CGError CGSSetWindowTags(const CGSConnection cid, const CGSWindow wid, CGSWindowTag *tags, int thirtyTwo);
extern CGError CGSClearWindowTags(const CGSConnection cid, const CGSWindow wid, CGSWindowTag *tags, int thirtyTwo);
extern CGError CGSGetWindowEventMask(const CGSConnection cid, const CGSWindow wid, uint32_t *mask);
extern CGError CGSSetWindowEventMask(const CGSConnection cid, const CGSWindow wid, uint32_t mask);

# pragma mark Window Warping

typedef struct {
CGPoint local;
CGPoint global;
} CGPointWarp;

extern CGError CGSSetWindowWarp(const CGSConnection cid, const CGSWindow wid, int w, int h, CGPointWarp mesh[h][w]);

# pragma mark Window Core Image Filters

typedef void *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);

#pragma mark Transitions

typedef enum {
CGSNone = 0, // No transition effect.
CGSFade, // Cross-fade.
Expand All @@ -158,7 +158,7 @@ extern "C" {
CGSFlip, // Flip over
CGSTransparentBackgroundMask = (1<<7) // OR this with any other type to get a transparent background
} CGSTransitionType;

typedef enum {
CGSDown, // Old desktop moves down.
CGSLeft, // Old desktop moves left.
Expand All @@ -177,26 +177,26 @@ extern "C" {
CGSInBottomRight, // CGSSwap: onl one in, new from br.
CGSInOut // CGSSwap: old in, new out.
} CGSTransitionOption;

typedef struct {
uint32_t unknown1;
CGSTransitionType type;
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;

extern CGError CGSNewTransition(const CGSConnection cid, const CGSTransitionSpec* spec, int *pTransitionHandle);
extern CGError CGSInvokeTransition(const CGSConnection cid, int transitionHandle, float duration);
extern CGError CGSReleaseTransition(const CGSConnection cid, int transitionHandle);

#pragma mark Workspaces

extern CGError CGSGetWorkspace(const CGSConnection cid, CGSWorkspace *workspace);
extern CGError CGSGetWindowWorkspace(const CGSConnection cid, const CGSWindow wid, CGSWorkspace *workspace);
extern CGError CGSSetWorkspace(const CGSConnection cid, CGSWorkspace workspace);
extern CGError CGSSetWorkspaceWithTransition(const CGSConnection cid, CGSWorkspace workspace, CGSTransitionType transition, CGSTransitionOption subtype, float time);

typedef enum {
CGSScreenResolutionChangedEvent = 100,
CGSConnectionNotifyEventUnknown2 = 101,
Expand All @@ -222,17 +222,17 @@ extern "C" {
CGSConnectionNotifyEventUnknown19 = 1501,
CGSConnectionNotifyEventUnknown20 = 1700
} CGSConnectionNotifyEvent;

/* Prototype for the Spaces change notification callback.
*
* data1 -- returns whatever value is passed to data1 parameter in CGSRegisterConnectionNotifyProc
* data2 -- indeterminate (always a large negative integer; seems to be limited to a small set of values)
* data3 -- indeterminate (always returns the number '4' for me)
* userParameter -- returns whatever value is passed to userParameter in CGSRegisterConnectionNotifyProc
*/

typedef void (*CGConnectionNotifyProc)(int data1, int data2, int data3, void* userParameter);

/* Register a callback function to receive notifications about when
the current Space is changing.
*
Expand All @@ -241,42 +241,60 @@ extern "C" {
* event -- indeterminate (this is hard-coded to 0x579 in Spaces.menu...perhpas some kind of event filter code?) -- use CGSWorkspaceChangedEvent in this for now
* userParameter -- pointer to user-defined auxiliary information structure; passed directly to callback proc
*/

// For spaces notifications: CGSRegisterConnectionNotifyProc(_CGSDefaultConnection(), spacesCallback, 1401, (void*)userInfo);

extern CGError CGSRegisterConnectionNotifyProc(const CGSConnection cid, CGConnectionNotifyProc function, CGSConnectionNotifyEvent event, void* userParameter);

extern CGError CGSRemoveConnectionNotifyProc(const CGSConnection cid, CGConnectionNotifyProc function, CGSConnectionNotifyEvent event, void* userParameter);

# pragma mark Miscellaneous

// Regions
typedef void *CGSRegionRef;
extern CGError CGSNewRegionWithRect(CGRect const *inRect, CGSRegionRef *outRegion);
extern CGError CGSNewEmptyRegion(CGSRegionRef *outRegion);
extern CGError CGSReleaseRegion(CGSRegionRef region);

// Creating Windows
extern CGError CGSNewWindowWithOpaqueShape(CGSConnection cid, int always2, float x, float y, CGSRegionRef shape, CGSRegionRef opaqueShape, int unknown1, void *unknownPtr, int always32, CGSWindowID *outWID);
extern CGError CGSReleaseWindow(CGSConnection cid, CGSWindowID wid);
extern CGContextRef CGWindowContextCreate(CGSConnection cid, CGSWindowID wid, void *unknown);

// Values
extern int CGSIntegerValue(CGSValue intVal);
extern void *CGSReleaseGenericObj(void*);

// Deprecated in 10.5
extern CGSValue CGSCreateCStringNoCopy(const char *str); //Normal CFStrings will work
extern CGSValue CGSCreateCString(const char* str);
extern char* CGSCStringValue(CGSValue string);


#pragma mark Debugging

// These all create files called /tmp/WindowServer + suffix
#define kCGSDumpWindowInfo 0x80000001 // .winfo.out
#define kCGSDumpConnectionInfo 0x80000002 // .cinfo.out
#define kCGSDumpKeyInfo 0x8000000e // .keyinfo.out
#define kCGSDumpSurfaceInfo 0x80000010 // .sinfo.out
#define kCGSDumpGLInfo 0x80000013 // .glinfo.out
#define kCGSDumpShadowInfo 0x80000014 //.shinfo.out
#define kCGSDumpStoragesAndCachesInfo 0x80000015 // .scinfo.out
#define kCGSDumpWindowPlistInfo 0x80000017 // .winfo.plist
// Other flags:
#define kCGSDebugOptionNormal 0 // Reset everything
#define kCGSFlashScreenUpdates 4 // This is probably what the checkbox in Quartz Debug calls internally
typedef unsigned long CGSDebugOptions;

extern void CGSSetDebugOptions(CGSDebugOptions options);

// Missing functions

//CGSIntersectRegionWithRect
//CGSSetWindowTransformsAtPlacement
//CGSSetWindowListGlobalClipShape
//extern CGError CGSWindowAddRectToDirtyShape(const CGSConnection cid, const CGSWindow wid, CGRect *rect);

#ifdef __cplusplus
}
#endif

0 comments on commit ea14aea

Please sign in to comment.