Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Afloat.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,17 @@ - (void) install {

NSUInteger index = [self indexForInstallingInMenu:menu];

[NSBundle loadNibNamed:@"Afloat" owner:self];

//[NSBundle loadNibNamed:@"Afloat" owner:self];
// Replaced with more functional nibLoading below

if ([[NSBundle mainBundle] respondsToSelector:@selector(loadNibNamed:owner:topLevelObjects:)]) {
// We're running on Mountain Lion or higher
[[NSBundle mainBundle] loadNibNamed:@"Afloat" owner:self topLevelObjects:nil];
} else {
// We're running on Lion
[NSBundle loadNibNamed:@"Afloat" owner:self];
}

NSImage* badge = [[NSImage alloc] initWithContentsOfFile:
[[self bundle] pathForImageResource:@"AfloatMenuBadge"]];

Expand All @@ -117,9 +126,8 @@ - (void) install {
if (index < [menu numberOfItems] && ![[menu itemAtIndex:index] isSeparatorItem])
[menu insertItem:[NSMenuItem separatorItem] atIndex:index];

[badge release];

[_menuWithItems release]; _menuWithItems = nil;
_menuWithItems = nil;

// Set up swizzling sendEvents: in NSApplication --------------

Expand Down Expand Up @@ -348,7 +356,6 @@ - (void) beginTrackingWindow:(NSWindow*) window {

L0Log(@"tracker = %@ view = %@", tracker, v);

[tracker release];
}

- (void) endTrackingWindow:(NSWindow*) window {
Expand Down
13 changes: 8 additions & 5 deletions Afloat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
LastUpgradeCheck = 0620;
};
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "Afloat" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -502,14 +502,15 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 1512ABDB0E09AB7300BA67AC /* Afloat.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
);
GCC_C_LANGUAGE_STANDARD = c99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_GC = supported;
GCC_ENABLE_OBJC_GC = unsupported;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -533,14 +534,15 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 1512ABDB0E09AB7300BA67AC /* Afloat.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
);
GCC_C_LANGUAGE_STANDARD = c99;
GCC_ENABLE_OBJC_GC = supported;
GCC_ENABLE_OBJC_GC = unsupported;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Afloat_Prefix.pch;
Expand All @@ -561,6 +563,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 1512ABDB0E09AB7300BA67AC /* Afloat.xcconfig */;
buildSettings = {
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
Expand Down
2 changes: 1 addition & 1 deletion AfloatBadgeController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef NSUInteger AfloatBadgeType;
unsigned int enqueuedFades;
}

@property(retain) NSWindow* parentWindow;
@property(nonatomic, strong) NSWindow* parentWindow;

- (id) initAttachedToWindow:(NSWindow*) parentWindow;
+ (id) badgeControllerForWindow:(NSWindow*) w;
Expand Down
8 changes: 1 addition & 7 deletions AfloatBadgeController.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ + (id) badgeControllerForWindow:(NSWindow*) w {
if (panel)
return panel;
else
return [[[self alloc] initAttachedToWindow:w] autorelease];
return [[self alloc] initAttachedToWindow:w];
}

- (id) initAttachedToWindow:(NSWindow*) parentWindow {
Expand Down Expand Up @@ -48,7 +48,6 @@ - (void) setParentWindow:(NSWindow*) newParent {
if (_parentWindow) {
[AfloatStorage removeSharedValueForWindow:_parentWindow key:kAfloatBadgeControllerKey];

[_parentWindow release];
}

if (newParent) {
Expand All @@ -58,7 +57,6 @@ - (void) setParentWindow:(NSWindow*) newParent {
// addObserver:self selector:@selector(parentWindowDidResize:) name:NSWindowDidResizeNotification object:_parentWindow];


[newParent retain];
}

_parentWindow = newParent;
Expand Down Expand Up @@ -188,9 +186,5 @@ + (NSImage*) didEndKeepingAfloatBadge {
}


- (void) dealloc {
self.parentWindow = nil;
[super dealloc];
}

@end
5 changes: 2 additions & 3 deletions AfloatNagPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ enum {
typedef NSInteger AfloatNagAction;

static id AfloatNagGetPreferenceForKey(CFStringRef key, Class cl) {
id obj = (id) CFPreferencesCopyAppValue(key, kAfloatNagPreferencesIdentifier);
id obj = (id) CFBridgingRelease(CFPreferencesCopyAppValue(key, kAfloatNagPreferencesIdentifier));
if (cl && obj && ![obj isKindOfClass:cl]) {
[obj release];
obj = nil;
}

return [obj autorelease];
return obj;
}

static BOOL AfloatNagGetBooleanForKey(CFStringRef key) {
Expand Down
4 changes: 0 additions & 4 deletions AfloatPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ - (id) initWithFrame:(NSRect) frame {
return self;
}

- (void) dealloc {
[_image release];
[super dealloc];
}

- (void) drawRect:(NSRect) r {
[[NSColor clearColor] set]; NSRectFill(r);
Expand Down
2 changes: 1 addition & 1 deletion AfloatPanelController.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef enum {

- (IBAction) disableAllOverlays:(id) sender;

@property(retain) NSWindow* parentWindow;
@property(nonatomic, strong) NSWindow* parentWindow;
@property CGFloat alphaValue;
// @property(getter=isKeptAfloat) BOOL keptAfloat;
@property AfloatWindowState windowState;
Expand Down
6 changes: 1 addition & 5 deletions AfloatPanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ - (void) setParentWindow:(NSWindow*) newParent {
[[NSNotificationCenter defaultCenter]
removeObserver:self name:NSWindowDidResizeNotification object:_parentWindow];

[_parentWindow release];
}

if (newParent) {
Expand All @@ -53,7 +52,6 @@ - (void) setParentWindow:(NSWindow*) newParent {
addObserver:self selector:@selector(parentWindowDidResize:) name:NSWindowDidResizeNotification object:_parentWindow];


[newParent retain];
}

_parentWindow = newParent;
Expand Down Expand Up @@ -98,13 +96,11 @@ + (id) panelControllerForWindow:(NSWindow*) w {
if (panel)
return panel;
else
return [[[self alloc] initAttachedToWindow:w] autorelease];
return [[self alloc] initAttachedToWindow:w];
}

- (void) dealloc {
[AfloatStorage removeSharedValueForWindow:self.parentWindow key:kAfloatPanelControllerKey];
self.parentWindow = nil;
[super dealloc];
}

- (IBAction) toggleWindow:(id) sender {
Expand Down
3 changes: 2 additions & 1 deletion AfloatScripting/AfloatDisableOverlaysCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
@implementation AfloatDisableOverlaysCommand

- (id) performDefaultImplementation {
[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter]
postNotificationName:kAfloatScriptDisableAllOverlaysNotification object:kAfloatScriptWireObject];
Expand Down
3 changes: 2 additions & 1 deletion AfloatScripting/AfloatMakeLessTransparentCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
@implementation AfloatMakeLessTransparentCommand

- (id) performDefaultImplementation {
[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter]
postNotificationName:kAfloatScriptLessTransparentNotification object:kAfloatScriptWireObject];
Expand Down
3 changes: 2 additions & 1 deletion AfloatScripting/AfloatMakeMoreTransparentCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
@implementation AfloatMakeMoreTransparentCommand

- (id) performDefaultImplementation {
[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter]
postNotificationName:kAfloatScriptMoreTransparentNotification object:kAfloatScriptWireObject];
Expand Down
7 changes: 6 additions & 1 deletion AfloatScripting/AfloatScripting.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
LastUpgradeCheck = 0620;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "AfloatScripting" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -285,6 +285,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
Expand All @@ -301,6 +303,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -319,6 +323,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
Expand Down
5 changes: 1 addition & 4 deletions AfloatScripting/AfloatScriptingAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ - (void) applicationDidFinishLaunching:(NSNotification*) n {
- (void) rearmDeathTimer {
if (deathTimer) {
[deathTimer invalidate];
[deathTimer release];
}

deathTimer = [[NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(deathTimerTicked:) userInfo:nil repeats:NO] retain];
deathTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(deathTimerTicked:) userInfo:nil repeats:NO];
}

- (void) deathTimerTicked:(NSTimer*) t {
Expand All @@ -30,8 +29,6 @@ - (void) deathTimerTicked:(NSTimer*) t {

- (void) dealloc {
[deathTimer invalidate];
[deathTimer release];
[super dealloc];
}

@end
4 changes: 3 additions & 1 deletion AfloatScripting/AfloatScriptingSetAlphaValueCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ @implementation AfloatScriptingSetAlphaValueCommand
- (id) performDefaultImplementation {
float alphaValue = [[self directParameter] floatValue];

[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfloatScriptSetAlphaValueNotification object:kAfloatScriptWireObject userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:alphaValue], @"alphaValue",
Expand Down
4 changes: 3 additions & 1 deletion AfloatScripting/AfloatScriptingSetKeptAfloatCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ - (id) performDefaultImplementation {
BOOL showsBadgeAnimation = AfloatBOOLFromObject([[self evaluatedArguments] objectForKey:@"showsBadgeAnimation"], YES);
BOOL keptAfloat = AfloatBOOLFromObject([self directParameter], NO);

[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfloatScriptSetKeptAfloatNotification object:kAfloatScriptWireObject userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:showsBadgeAnimation], @"showsBadgeAnimation",
Expand Down
4 changes: 3 additions & 1 deletion AfloatScripting/AfloatScriptingSetKeptOnAllSpacesCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ @implementation AfloatScriptingSetKeptOnAllSpacesCommand
- (id) performDefaultImplementation {
BOOL keptOnAllSpaces = [[self directParameter] boolValue];

[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfloatScriptSetKeptOnAllSpacesNotification object:kAfloatScriptWireObject userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:keptOnAllSpaces], @"keptOnAllSpaces",
Expand Down
7 changes: 5 additions & 2 deletions AfloatScripting/AfloatScriptingToggleKeptAfloatCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
@implementation AfloatScriptingToggleKeptAfloatCommand

- (id) performDefaultImplementation {
BOOL showsBadgeAnimation = AfloatBOOLFromObject([[self evaluatedArguments] objectForKey:@"showsBadgeAnimation"], YES);
[[NSApp delegate] rearmDeathTimer];
BOOL showsBadgeAnimation = AfloatBOOLFromObject([[self evaluatedArguments] objectForKey:@"showsBadgeAnimation"], YES);

AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfloatScriptToggleKeptAfloatNotification object:kAfloatScriptWireObject userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:showsBadgeAnimation] forKey:@"showsBadgeAnimation"]];
return nil;
}
Expand Down
4 changes: 3 additions & 1 deletion AfloatScripting/AfloatSetOverlayCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ - (id) performDefaultImplementation {
BOOL showsBadgeAnimation = AfloatBOOLFromObject([[self evaluatedArguments] objectForKey:@"showsBadgeAnimation"], YES);
BOOL overlay = AfloatBOOLFromObject([self directParameter], NO);

[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfloatScriptSetOverlayNotification object:kAfloatScriptWireObject userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:showsBadgeAnimation], @"showsBadgeAnimation",
Expand Down
4 changes: 3 additions & 1 deletion AfloatScripting/AfloatSetPinnedToDesktopCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ - (id) performDefaultImplementation {
NSLog(@"Will pin to desktop = %@ (%d)", [self directParameter], pinnedToDesktop);
BOOL showsBadgeAnimation = AfloatBOOLFromObject([[self evaluatedArguments] objectForKey:@"showsBadgeAnimation"], YES);

[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfloatScriptSetPinnedToDesktopNotification object:kAfloatScriptWireObject userInfo:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:pinnedToDesktop], @"pinnedToDesktop",
Expand Down
3 changes: 2 additions & 1 deletion AfloatScripting/AfloatShowWindowFileInFinderCommand.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
@implementation AfloatShowWindowFileInFinderCommand

- (id) performDefaultImplementation {
[[NSApp delegate] rearmDeathTimer];
AfloatScriptingAppDelegate *asap = [[AfloatScriptingAppDelegate alloc] init];
[asap rearmDeathTimer];

[[NSDistributedNotificationCenter defaultCenter]
postNotificationName:kAfloatScriptShowWindowFileInFinderNotification object:kAfloatScriptWireObject];
Expand Down
4 changes: 2 additions & 2 deletions AfloatStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND

@interface AfloatStorage : NSObject {
NSMutableDictionary* _backingStorage;
id _delegate;
id __strong _delegate;
NSArray* _persistedKeys;
}

Expand All @@ -28,7 +28,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND

- (NSMutableDictionary*) mutableDictionaryForWindow:(NSWindow*) w;

@property(assign) id delegate;
@property(strong) id delegate;
@property(copy) NSArray* persistedKeys;

- (void) removeValueForWindow:(NSWindow*) w key:(NSString*) k;
Expand Down
2 changes: 0 additions & 2 deletions AfloatStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ - (id) init {

- (void) dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_backingStorage release];
[super dealloc];
}

- (id) valueForWindow:(NSWindow*) w key:(NSString*) k {
Expand Down
Loading