Skip to content

Commit

Permalink
Second Revision (from Archive)
Browse files Browse the repository at this point in the history
  • Loading branch information
jspiros committed May 13, 2009
1 parent eda6452 commit 762e0f6
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 142 deletions.
78 changes: 38 additions & 40 deletions WindowBlur.xcodeproj/project.pbxproj
Expand Up @@ -10,7 +10,7 @@
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
FA22EE5F0FBA6A6D003C3105 /* WindowBlurSIMBL.m in Sources */ = {isa = PBXBuildFile; fileRef = FA22EE5E0FBA6A6D003C3105 /* WindowBlurSIMBL.m */; };
FA22EE640FBA6C19003C3105 /* WindowBlurWindowHack.m in Sources */ = {isa = PBXBuildFile; fileRef = FA22EE630FBA6C19003C3105 /* WindowBlurWindowHack.m */; };
FAD8547F0FBB47340089E0E2 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD8547E0FBB47340089E0E2 /* QuartzCore.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -24,24 +24,23 @@
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
FA22EE5D0FBA6A6D003C3105 /* WindowBlurSIMBL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowBlurSIMBL.h; sourceTree = "<group>"; };
FA22EE5E0FBA6A6D003C3105 /* WindowBlurSIMBL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WindowBlurSIMBL.m; sourceTree = "<group>"; };
FA22EE620FBA6C19003C3105 /* WindowBlurWindowHack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowBlurWindowHack.h; sourceTree = "<group>"; };
FA22EE630FBA6C19003C3105 /* WindowBlurWindowHack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WindowBlurWindowHack.m; sourceTree = "<group>"; };
FA22EE820FBA737C003C3105 /* CarbonHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarbonHelpers.h; sourceTree = "<group>"; };
FA22EE830FBA737C003C3105 /* CGSAccessibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSAccessibility.h; sourceTree = "<group>"; };
FA22EE840FBA737C003C3105 /* CGSCIFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSCIFilter.h; sourceTree = "<group>"; };
FA22EE850FBA737C003C3105 /* CGSConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSConnection.h; sourceTree = "<group>"; };
FA22EE860FBA737C003C3105 /* CGSCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSCursor.h; sourceTree = "<group>"; };
FA22EE870FBA737C003C3105 /* CGSDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSDebug.h; sourceTree = "<group>"; };
FA22EE880FBA737C003C3105 /* CGSDisplays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSDisplays.h; sourceTree = "<group>"; };
FA22EE890FBA737C003C3105 /* CGSHotKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSHotKeys.h; sourceTree = "<group>"; };
FA22EE8A0FBA737C003C3105 /* CGSInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSInternal.h; sourceTree = "<group>"; };
FA22EE8B0FBA737C003C3105 /* CGSMisc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSMisc.h; sourceTree = "<group>"; };
FA22EE8C0FBA737C003C3105 /* CGSNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSNotifications.h; sourceTree = "<group>"; };
FA22EE8D0FBA737C003C3105 /* CGSRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSRegion.h; sourceTree = "<group>"; };
FA22EE8E0FBA737C003C3105 /* CGSSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSSession.h; sourceTree = "<group>"; };
FA22EE8F0FBA737C003C3105 /* CGSTransitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSTransitions.h; sourceTree = "<group>"; };
FA22EE900FBA737C003C3105 /* CGSWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSWindow.h; sourceTree = "<group>"; };
FA22EE910FBA737C003C3105 /* CGSWorkspace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSWorkspace.h; sourceTree = "<group>"; };
FAD854000FBB1F040089E0E2 /* CarbonHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarbonHelpers.h; sourceTree = "<group>"; };
FAD854010FBB1F040089E0E2 /* CGSAccessibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSAccessibility.h; sourceTree = "<group>"; };
FAD854020FBB1F040089E0E2 /* CGSCIFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSCIFilter.h; sourceTree = "<group>"; };
FAD854030FBB1F040089E0E2 /* CGSConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSConnection.h; sourceTree = "<group>"; };
FAD854040FBB1F040089E0E2 /* CGSCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSCursor.h; sourceTree = "<group>"; };
FAD854050FBB1F040089E0E2 /* CGSDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSDebug.h; sourceTree = "<group>"; };
FAD854060FBB1F040089E0E2 /* CGSDisplays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSDisplays.h; sourceTree = "<group>"; };
FAD854070FBB1F040089E0E2 /* CGSHotKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSHotKeys.h; sourceTree = "<group>"; };
FAD854080FBB1F040089E0E2 /* CGSInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSInternal.h; sourceTree = "<group>"; };
FAD854090FBB1F040089E0E2 /* CGSMisc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSMisc.h; sourceTree = "<group>"; };
FAD8540A0FBB1F040089E0E2 /* CGSNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSNotifications.h; sourceTree = "<group>"; };
FAD8540B0FBB1F040089E0E2 /* CGSRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSRegion.h; sourceTree = "<group>"; };
FAD8540C0FBB1F040089E0E2 /* CGSSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSSession.h; sourceTree = "<group>"; };
FAD8540D0FBB1F040089E0E2 /* CGSTransitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSTransitions.h; sourceTree = "<group>"; };
FAD8540E0FBB1F040089E0E2 /* CGSWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSWindow.h; sourceTree = "<group>"; };
FAD8540F0FBB1F040089E0E2 /* CGSWorkspace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGSWorkspace.h; sourceTree = "<group>"; };
FAD8547E0FBB47340089E0E2 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -50,6 +49,7 @@
buildActionMask = 2147483647;
files = (
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
FAD8547F0FBB47340089E0E2 /* QuartzCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -91,8 +91,6 @@
children = (
FA22EE5D0FBA6A6D003C3105 /* WindowBlurSIMBL.h */,
FA22EE5E0FBA6A6D003C3105 /* WindowBlurSIMBL.m */,
FA22EE620FBA6C19003C3105 /* WindowBlurWindowHack.h */,
FA22EE630FBA6C19003C3105 /* WindowBlurWindowHack.m */,
);
name = Classes;
sourceTree = "<group>";
Expand All @@ -101,6 +99,7 @@
isa = PBXGroup;
children = (
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,
FAD8547E0FBB47340089E0E2 /* QuartzCore.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
Expand All @@ -126,31 +125,31 @@
32C88E010371C26100C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
FA22EE810FBA737C003C3105 /* CGSInternal */,
FAD853FF0FBB1F040089E0E2 /* CGSInternal */,
32DBCF630370AF2F00C91783 /* WindowBlur_Prefix.pch */,
);
name = "Other Sources";
sourceTree = "<group>";
};
FA22EE810FBA737C003C3105 /* CGSInternal */ = {
FAD853FF0FBB1F040089E0E2 /* CGSInternal */ = {
isa = PBXGroup;
children = (
FA22EE820FBA737C003C3105 /* CarbonHelpers.h */,
FA22EE830FBA737C003C3105 /* CGSAccessibility.h */,
FA22EE840FBA737C003C3105 /* CGSCIFilter.h */,
FA22EE850FBA737C003C3105 /* CGSConnection.h */,
FA22EE860FBA737C003C3105 /* CGSCursor.h */,
FA22EE870FBA737C003C3105 /* CGSDebug.h */,
FA22EE880FBA737C003C3105 /* CGSDisplays.h */,
FA22EE890FBA737C003C3105 /* CGSHotKeys.h */,
FA22EE8A0FBA737C003C3105 /* CGSInternal.h */,
FA22EE8B0FBA737C003C3105 /* CGSMisc.h */,
FA22EE8C0FBA737C003C3105 /* CGSNotifications.h */,
FA22EE8D0FBA737C003C3105 /* CGSRegion.h */,
FA22EE8E0FBA737C003C3105 /* CGSSession.h */,
FA22EE8F0FBA737C003C3105 /* CGSTransitions.h */,
FA22EE900FBA737C003C3105 /* CGSWindow.h */,
FA22EE910FBA737C003C3105 /* CGSWorkspace.h */,
FAD854000FBB1F040089E0E2 /* CarbonHelpers.h */,
FAD854010FBB1F040089E0E2 /* CGSAccessibility.h */,
FAD854020FBB1F040089E0E2 /* CGSCIFilter.h */,
FAD854030FBB1F040089E0E2 /* CGSConnection.h */,
FAD854040FBB1F040089E0E2 /* CGSCursor.h */,
FAD854050FBB1F040089E0E2 /* CGSDebug.h */,
FAD854060FBB1F040089E0E2 /* CGSDisplays.h */,
FAD854070FBB1F040089E0E2 /* CGSHotKeys.h */,
FAD854080FBB1F040089E0E2 /* CGSInternal.h */,
FAD854090FBB1F040089E0E2 /* CGSMisc.h */,
FAD8540A0FBB1F040089E0E2 /* CGSNotifications.h */,
FAD8540B0FBB1F040089E0E2 /* CGSRegion.h */,
FAD8540C0FBB1F040089E0E2 /* CGSSession.h */,
FAD8540D0FBB1F040089E0E2 /* CGSTransitions.h */,
FAD8540E0FBB1F040089E0E2 /* CGSWindow.h */,
FAD8540F0FBB1F040089E0E2 /* CGSWorkspace.h */,
);
path = CGSInternal;
sourceTree = "<group>";
Expand Down Expand Up @@ -210,7 +209,6 @@
buildActionMask = 2147483647;
files = (
FA22EE5F0FBA6A6D003C3105 /* WindowBlurSIMBL.m in Sources */,
FA22EE640FBA6C19003C3105 /* WindowBlurWindowHack.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
7 changes: 4 additions & 3 deletions WindowBlurSIMBL.h
Expand Up @@ -7,11 +7,12 @@
//

#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>

void MethodSwizzle(Class aClass, SEL orig_sel, SEL alt_sel);

@interface WindowBlurSIMBL : NSObject {

}
@interface WindowBlurWindowHack : NSWindow
@end

@interface WindowBlurSIMBL : NSObject {}
@end
87 changes: 86 additions & 1 deletion WindowBlurSIMBL.m
Expand Up @@ -7,7 +7,7 @@
//

#import "WindowBlurSIMBL.h"
#import "WindowBlurWindowHack.h"
#import "CGSInternal.h"
#import <objc/objc-class.h>

void MethodSwizzle(Class aClass, SEL orig_sel, SEL alt_sel)
Expand All @@ -34,6 +34,91 @@ void MethodSwizzle(Class aClass, SEL orig_sel, SEL alt_sel)
}
}

static NSMutableDictionary *instanceIDToIvars = nil;
static BOOL needToSwizzleDealloc = YES;

@implementation WindowBlurWindowHack

- (id)PRE__instanceID
{
return [NSValue valueWithPointer:self];
}

- (NSMutableDictionary *)PRE__ivars
{
NSMutableDictionary *ivars;

if (needToSwizzleDealloc)
{
MethodSwizzle([NSWindow class],
@selector(dealloc),
@selector(PRE__deallocSwizzler));
needToSwizzleDealloc = NO;
}

if (instanceIDToIvars == nil)
{
instanceIDToIvars = [[NSMutableDictionary alloc] init];
}

ivars = [instanceIDToIvars objectForKey:[self PRE__instanceID]];
if (ivars == nil)
{
ivars = [NSMutableDictionary dictionary];
[instanceIDToIvars setObject:ivars forKey:[self PRE__instanceID]];
}

return ivars;
}

- (void)PRE__deallocSwizzler
{
[instanceIDToIvars removeObjectForKey:[self PRE__instanceID]];
if ([instanceIDToIvars count] == 0)
{
[instanceIDToIvars release];
instanceIDToIvars = nil;
}

[self PRE__deallocSwizzler];
}

- (void)display {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (floor(NSAppKitVersionNumber) > 824) {
NSString *filterName;
if (!(filterName = [[NSUserDefaults standardUserDefaults] stringForKey:@"WindowBlurSIMBL-FilterName"])) {
filterName = @"CIGaussianBlur";
}
NSDictionary *filterValues;
if (!(filterValues = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"WindowBlurSIMBL-FilterValues"])) {
filterValues = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:2.0] forKey:@"inputRadius"];
}
NSMutableDictionary *optionsDict = [NSMutableDictionary dictionaryWithDictionary:filterValues];
if (![optionsDict objectForKey:@"inputCenter"]) {
[optionsDict setObject:[CIVector vectorWithX:0.0 Y:0.0] forKey:@"inputCenter"];
}
CGSConnectionID con = CGSMainConnectionID();
if (con) {
NSNumber *filterNumber;
int filter;
if (filterNumber = [[self PRE__ivars] objectForKey:@"filter"]) {
filter = [filterNumber intValue];
CGSRemoveWindowFilter(con, [self windowNumber], filter);
}
if (noErr == CGSNewCIFilterByName(con, (CFStringRef)filterName, &filter)) {
CGSSetCIFilterValuesFromDictionary(con, filter, (CFDictionaryRef)optionsDict);
CGSAddWindowFilter(con, [self windowNumber], filter, kCGWindowFilterUnderlay);
[[self PRE__ivars] setObject:[NSNumber numberWithInt:filter] forKey:@"filter"];
}
}
}
#endif
[super display];
}

@end

@implementation WindowBlurSIMBL

+ (void)load {
Expand Down
14 changes: 0 additions & 14 deletions WindowBlurWindowHack.h

This file was deleted.

84 changes: 0 additions & 84 deletions WindowBlurWindowHack.m

This file was deleted.

0 comments on commit 762e0f6

Please sign in to comment.