diff --git a/Boxer.xcodeproj/project.pbxproj b/Boxer.xcodeproj/project.pbxproj index 00eb5f1bc..6326ea3a5 100644 --- a/Boxer.xcodeproj/project.pbxproj +++ b/Boxer.xcodeproj/project.pbxproj @@ -1826,7 +1826,6 @@ 9FDCA78E118F2B7900E2FD74 /* BXCoalface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BXCoalface.h; sourceTree = ""; }; 9FDCA78F118F2B7900E2FD74 /* BXCoalface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BXCoalface.mm; sourceTree = ""; }; 9FDCDEFC11B5B83B0032DA4E /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = ""; }; - 9FDD4CB411E619D50035BA9E /* CGSPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSPrivate.h; sourceTree = ""; }; 9FDE341D1351DE26000DCE44 /* BXBlueprintBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BXBlueprintBackgroundView.h; sourceTree = ""; }; 9FDE341E1351DE26000DCE44 /* BXBlueprintBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BXBlueprintBackgroundView.m; sourceTree = ""; }; 9FDE34321351DFD4000DCE44 /* BXImportTipsPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BXImportTipsPanelController.h; sourceTree = ""; }; @@ -3512,7 +3511,6 @@ isa = PBXGroup; children = ( 9F991BDE1800395900E2C0FE /* Scripting Bridge */, - 9FDD4CB411E619D50035BA9E /* CGSPrivate.h */, 9FADFE9511EC932800990E91 /* NSData+HexStrings.h */, 9FADFE9611EC932800990E91 /* NSData+HexStrings.m */, 9F7A8F230F8E705100D1AAD5 /* ADBToolkit */, @@ -5105,7 +5103,7 @@ ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = USE_PRIVATE_APIS; + GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -5178,6 +5176,7 @@ "$(inherited)", "\"$(SRCROOT)/Frameworks\"", ); + GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; HEADER_SEARCH_PATHS = ( @@ -5224,7 +5223,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = USE_PRIVATE_APIS; + GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/Boxer/BXWelcomeWindowController.m b/Boxer/BXWelcomeWindowController.m index 4e2d43b26..4ed6168cb 100644 --- a/Boxer/BXWelcomeWindowController.m +++ b/Boxer/BXWelcomeWindowController.m @@ -88,14 +88,7 @@ - (void) windowDidResignKey: (NSNotification *)notification - (void) showWindowWithTransition: (id)sender { -#ifdef USE_PRIVATE_APIS - [self.window revealWithTransition: CGSFlip - direction: CGSDown - duration: 0.4 - blockingMode: NSAnimationNonblocking]; -#else [self.window fadeInWithDuration: 0.4]; -#endif [self showWindow: sender]; } diff --git a/Boxer/Inspector Panel/BXInspectorController.m b/Boxer/Inspector Panel/BXInspectorController.m index bc2c7ff83..628123646 100644 --- a/Boxer/Inspector Panel/BXInspectorController.m +++ b/Boxer/Inspector Panel/BXInspectorController.m @@ -105,7 +105,6 @@ - (void) showWindow: (id)sender [self loadWindow]; [self.window fadeInWithDuration: 0.2]; - //[[self window] applyGaussianBlurWithRadius: BXInspectorPanelBlurRadius]; _isTemporarilyHidden = NO; } diff --git a/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.h b/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.h index 78d3e6454..cccd6ab97 100644 --- a/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.h +++ b/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.h @@ -37,52 +37,3 @@ - (void) fadeOutWithDuration: (NSTimeInterval)duration; @end - - -//The following methods use private Core Graphics APIs that will likely fall foul -//of App Store private-API restrictions. -#ifdef USE_PRIVATE_APIS - -#import "CGSPrivate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface NSWindow (ADBPrivateAPIWindowEffects) - -/// Applies a gaussian blur filter behind the window background. -/// Only useful for HUD-style translucent windows. -- (void) applyGaussianBlurWithRadius: (CGFloat)radius; - -/// Hide the window by using the specified transition. -- (void) hideWithTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - blockingMode: (NSAnimationBlockingMode)blockingMode; - -/// Reveal the window by using the specified transition. -- (void) revealWithTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - blockingMode: (NSAnimationBlockingMode)blockingMode; - -#pragma mark - -#pragma mark Low-level methods - -/// Adds a filter with the specified name and options to the window. The backgroundOnly flag -/// determines whether the filter applies directly to the window's contents, or to what lies -/// behind the window. -- (void) addCGSFilterWithName: (NSString *)filterName - withOptions: (NSDictionary *)filterOptions - backgroundOnly: (BOOL)backgroundOnly; - -/// Applies the specified Core Graphics transition to the window. -- (void) applyCGSTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - blockingMode: (NSAnimationBlockingMode)blockingMode; - -@end - -NS_ASSUME_NONNULL_END - -#endif \ No newline at end of file diff --git a/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.m b/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.m index 753a0d3f2..691a236cf 100644 --- a/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.m +++ b/Other Sources/ADBToolkit/NSWindow+ADBWindowEffects.m @@ -78,188 +78,3 @@ - (void) _orderOutAfterFade } @end - - - -#ifdef USE_PRIVATE_APIS - -@interface NSWindow (ADBPrivateAPIWindowEffectsReallyPrivate) -//Cleans up after a transition by releasing the specified handle. -- (void) _releaseTransitionHandle: (NSNumber *)handleNum; - -//Used internally by applyCGSTransition:direction:duration: and related methods. -//Callback is called with callbackObj as the parameter immediately before the -//transition is invoked: this allows the callback to update the window state -//(or show/hide the window) for the end of the transition. -- (void) _applyCGSTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - withCallback: (SEL)callback - callbackObject: (id)callbackObj - blockingMode: (NSAnimationBlockingMode)blockingMode; - -//Takes the float value of the specified number and sets the window's alpha to it. -//Used for showing/hiding windows during a transition. -- (void) _setAlphaForTransition: (NSNumber *)alphaValue; -@end - -@implementation NSWindow (ADBPrivateAPIWindowEffects) - -#pragma mark - -#pragma mark High-level methods you might actually want to call - -- (void) applyGaussianBlurWithRadius: (CGFloat)radius -{ - [self addCGSFilterWithName: @"CIGaussianBlur" - withOptions: @{@"inputRadius": @(radius)} - backgroundOnly: YES]; -} - -- (void) revealWithTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - blockingMode: (NSAnimationBlockingMode)blockingMode -{ - CGFloat oldAlpha = self.alphaValue; - self.alphaValue = 0.0f; - [self orderFront: self]; - - [self _applyCGSTransition: type - direction: direction - duration: duration - withCallback: @selector(_setAlphaForTransition:) - callbackObject: @(oldAlpha) - blockingMode: blockingMode]; -} - -- (void) hideWithTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - blockingMode: (NSAnimationBlockingMode)blockingMode -{ - CGFloat oldAlpha = self.alphaValue; - [self _applyCGSTransition: type - direction: direction - duration: duration - withCallback: @selector(_setAlphaForTransition:) - callbackObject: @(0.0f) - blockingMode: blockingMode]; - - [self willChangeValueForKey: @"visible"]; - [self orderOut: self]; - [self didChangeValueForKey: @"visible"]; - - self.alphaValue = oldAlpha; -} - -- (void) _setAlphaForTransition: (NSNumber *)alphaValue -{ - self.alphaValue = alphaValue.floatValue; -} - -#pragma mark - -#pragma mark Low-level effects - -- (void) addCGSFilterWithName: (NSString *)filterName - withOptions: (NSDictionary *)filterOptions - backgroundOnly: (BOOL)backgroundOnly -{ - CGSConnection conn = _CGSDefaultConnection(); - - if (conn) - { - CGSWindowFilterRef filter = NULL; - - //Create a CoreImage gaussian blur filter. - CGSNewCIFilterByName(conn, (__bridge CFStringRef)filterName, &filter); - - if (filter) - { - CGSWindowID windowNumber = (CGSWindowID)self.windowNumber; - int compositingType = (int)backgroundOnly; - - CGSSetCIFilterValuesFromDictionary(conn, filter, (__bridge CFDictionaryRef)filterOptions); - - CGSAddWindowFilter(conn, windowNumber, filter, compositingType); - - //Clean up after ourselves. - CGSReleaseCIFilter(conn, filter); - } - } -} - -- (void) applyCGSTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - blockingMode: (NSAnimationBlockingMode)blockingMode -{ - [self _applyCGSTransition: type - direction: direction - duration: duration - withCallback: @selector(display) - callbackObject: nil - blockingMode: blockingMode]; -} - -- (void) _applyCGSTransition: (CGSTransitionType)type - direction: (CGSTransitionOption)direction - duration: (NSTimeInterval)duration - withCallback: (SEL)callback - callbackObject: (id)callbackObj - blockingMode: (NSAnimationBlockingMode)blockingMode -{ - //If the application isn't active, then avoid applying the effect: it will look distractingly wrong anyway - if (![NSApp isActive] || [NSApp isHidden]) - { - [self performSelector: callback withObject: callbackObj]; - return; - } - - CGSConnection conn = _CGSDefaultConnection(); - - if (conn) - { - CGSTransitionSpec spec; - spec.unknown1 = 0; - spec.type = type; - spec.option = direction | CGSTransparentBackgroundMask; - spec.wid = (CGSWindow)self.windowNumber; - spec.backColour = NULL; - - int handle = 0; - - CGSNewTransition(conn, &spec, &handle); - - //Do any redrawing, now that Core Graphics has captured the previous window state. - //The transition will switch from the previous window state to this new one. - [self performSelector: callback withObject: callbackObj]; - - if (handle) - { - CGSInvokeTransition(conn, handle, (float)duration); - - if (blockingMode == NSAnimationBlocking) - { - [NSThread sleepForTimeInterval: duration]; - CGSReleaseTransition(conn, handle); - } - else - { - //To avoid blocking the thread, call the cleanup function with a delay. - [self performSelector: @selector(_releaseTransitionHandle:) - withObject: @(handle) - afterDelay: duration]; - } - - } - } -} - -- (void) _releaseTransitionHandle: (NSNumber *)handleNum -{ - CGSConnection conn = _CGSDefaultConnection(); - CGSReleaseTransition(conn, [handleNum intValue]); -} - -@end -#endif diff --git a/Other Sources/CGSPrivate.h b/Other Sources/CGSPrivate.h deleted file mode 100644 index 51a4e58c7..000000000 --- a/Other Sources/CGSPrivate.h +++ /dev/null @@ -1,282 +0,0 @@ -// -// CGSPrivate.h -// Header file for undocumented CoreGraphics SPI -// -// Arranged by Nicholas Jitkoff -// Based on CGSPrivate.h by Richard Wareham -// -// Contributors: -// Austin Sarner: Shadows -// Jason Harris: Filters, Shadows, Regions -// Kevin Ballard: Warping -// Steve Voida: Workspace notifications -// Tony Arnold: Workspaces notifications enum filters -// Ben Gertzfield: CGSRemoveConnectionNotifyProc -// -// Changes: -// 2.3 - Added the CGSRemoveConnectionNotifyProc method with the help of Ben Gertzfield -// 2.2 - Moved back to CGSPrivate, added more enums to the CGSConnectionNotifyEvent -// 2.1 - Added spaces notifications -// 2.0 - Original Release - -#include - -#define CGSConnectionID CGSConnection -#define CGSWindowID CGSWindow -#define CGSDefaultConnection _CGSDefaultConnection() - -#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 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 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 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); - - // 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. - 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 - 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. - 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, // CGSSwap: 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 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; - - 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 transitionTime); - - typedef enum { - CGSScreenResolutionChangedEvent = 100, - CGSConnectionNotifyEventUnknown2 = 101, - CGSConnectionNotifyEventUnknown3 = 102, - CGSConnectionNotifyEventUnknown4 = 103, - CGSClientEnterFullscreen = 106, - CGSClientExitFullscreen = 107, - CGSConnectionNotifyEventUnknown7 = 750, - CGSConnectionNotifyEventUnknown8 = 751, - CGSWorkspaceConfigurationDisabledEvent = 761, // Seems to occur when objects are removed (rows/columns), or disabled - CGSWorkspaceConfigurationEnabledEvent = 762, // Seems to occur when objects are added (rows/columns), or enabled - CGSConnectionNotifyEventUnknown9 = 763, - CGSConnectionNotifyEventUnknown10 = 764, - CGSConnectionNotifyEventUnknown11 = 806, - CGSConnectionNotifyEventUnknown12 = 807, - CGSConnectionNotifyEventUnknown13 = 1201, // Seems to occur when applications are launched/quit. Is this a connection being created/destroyed by the application to the window server? - CGSWorkspaceChangedEvent = 1401, - CGSConnectionNotifyEventUnknown14 = 1409, - CGSConnectionNotifyEventUnknown15 = 1410, - CGSConnectionNotifyEventUnknown16 = 1411, - CGSConnectionNotifyEventUnknown17 = 1412, - CGSConnectionNotifyEventUnknown18 = 1500, - 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. - * - * cid -- Current connection - * function -- A pointer to the intended callback function (must be in C; cannot be an Objective-C selector) - * 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); - - // Missing functions - - //CGSIntersectRegionWithRect - //CGSSetWindowTransformsAtPlacement - //CGSSetWindowListGlobalClipShape - //extern CGError CGSWindowAddRectToDirtyShape(const CGSConnection cid, const CGSWindow wid, CGRect *rect); - -#ifdef __cplusplus -} -#endif