Skip to content

Commit

Permalink
Automatically focus at launch; icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Nichol authored and Alex Nichol committed Jul 27, 2012
1 parent dc5caf8 commit a911df0
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 10 deletions.
10 changes: 10 additions & 0 deletions JamWiFi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */
FA175ED615C19A9A006B274D /* MACParser.m in Sources */ = {isa = PBXBuildFile; fileRef = FA175ED515C19A9A006B274D /* MACParser.m */; };
FA42D2E015C0BA0C0021527A /* ANClientKiller.m in Sources */ = {isa = PBXBuildFile; fileRef = FA42D2DF15C0BA0C0021527A /* ANClientKiller.m */; };
FA8D07F915C3022500B8EDC4 /* CarbonAppProcess.m in Sources */ = {isa = PBXBuildFile; fileRef = FA8D07F815C3022500B8EDC4 /* CarbonAppProcess.m */; };
FA8D07FC15C3024200B8EDC4 /* radio.icns in Resources */ = {isa = PBXBuildFile; fileRef = FA8D07FB15C3024200B8EDC4 /* radio.icns */; };
FAB94BCC15C0557A0031197A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB94BCB15C0557A0031197A /* Cocoa.framework */; };
FAB94BD615C0557A0031197A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = FAB94BD415C0557A0031197A /* InfoPlist.strings */; };
FAB94BD815C0557A0031197A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB94BD715C0557A0031197A /* main.m */; };
Expand Down Expand Up @@ -47,6 +49,9 @@
FA175ED515C19A9A006B274D /* MACParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MACParser.m; sourceTree = "<group>"; };
FA42D2DE15C0BA0C0021527A /* ANClientKiller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANClientKiller.h; sourceTree = "<group>"; };
FA42D2DF15C0BA0C0021527A /* ANClientKiller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ANClientKiller.m; sourceTree = "<group>"; };
FA8D07F715C3022500B8EDC4 /* CarbonAppProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarbonAppProcess.h; sourceTree = "<group>"; };
FA8D07F815C3022500B8EDC4 /* CarbonAppProcess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CarbonAppProcess.m; sourceTree = "<group>"; };
FA8D07FB15C3024200B8EDC4 /* radio.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = radio.icns; sourceTree = "<group>"; };
FAB94BC715C0557A0031197A /* JamWiFi.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JamWiFi.app; sourceTree = BUILT_PRODUCTS_DIR; };
FAB94BCB15C0557A0031197A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
FAB94BCE15C0557A0031197A /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -147,6 +152,8 @@
FAB94BD115C0557A0031197A /* JamWiFi */ = {
isa = PBXGroup;
children = (
FA8D07F715C3022500B8EDC4 /* CarbonAppProcess.h */,
FA8D07F815C3022500B8EDC4 /* CarbonAppProcess.m */,
FAB94BDD15C0557A0031197A /* ANAppDelegate.h */,
FAB94BDE15C0557A0031197A /* ANAppDelegate.m */,
FAB94C0515C05BA00031197A /* ANListView.h */,
Expand All @@ -166,6 +173,7 @@
FAB94BD215C0557A0031197A /* Supporting Files */ = {
isa = PBXGroup;
children = (
FA8D07FB15C3024200B8EDC4 /* radio.icns */,
FAB94BD315C0557A0031197A /* JamWiFi-Info.plist */,
FAB94BD415C0557A0031197A /* InfoPlist.strings */,
FAB94BD715C0557A0031197A /* main.m */,
Expand Down Expand Up @@ -268,6 +276,7 @@
FAB94BD615C0557A0031197A /* InfoPlist.strings in Resources */,
FAB94BDC15C0557A0031197A /* Credits.rtf in Resources */,
FAB94BE215C0557A0031197A /* MainMenu.xib in Resources */,
FA8D07FC15C3024200B8EDC4 /* radio.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -291,6 +300,7 @@
FAB94C5C15C07D610031197A /* crc.c in Sources */,
FA42D2E015C0BA0C0021527A /* ANClientKiller.m in Sources */,
FA175ED615C19A9A006B274D /* MACParser.m in Sources */,
FA8D07F915C3022500B8EDC4 /* CarbonAppProcess.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
1 change: 1 addition & 0 deletions JamWiFi/ANAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import <Cocoa/Cocoa.h>
#import "CarbonAppProcess.h"

typedef enum {
ANViewSlideDirectionForward,
Expand Down
2 changes: 1 addition & 1 deletion JamWiFi/ANAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
networkList = [[ANListView alloc] initWithFrame:[self.window.contentView bounds]];
[self pushView:networkList direction:ANViewSlideDirectionForward];
[self.window setLevel:CGShieldingWindowLevel()];
[[CarbonAppProcess currentProcess] makeFrontmost];
}

- (void)pushView:(NSView *)view direction:(ANViewSlideDirection)direction {
Expand Down
25 changes: 25 additions & 0 deletions JamWiFi/CarbonAppProcess.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// CarbonAppProcess.h
// AutoConvert
//
// Created by Alex Nichol on 7/3/11.
// Copyright 2011 Alex Nichol. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Carbon/Carbon.h>

@interface CarbonAppProcess : NSObject {
ProcessSerialNumber processSerial;
}

- (id)initWithProcessSerial:(ProcessSerialNumber)num;
+ (CarbonAppProcess *)currentProcess;
+ (CarbonAppProcess *)frontmostProcess;
+ (CarbonAppProcess *)nextProcess;
- (void)makeFrontmost;
- (void)setHidden:(BOOL)hide;
- (BOOL)isFrontmost;
- (ProcessSerialNumber)serial;

@end
83 changes: 83 additions & 0 deletions JamWiFi/CarbonAppProcess.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// CarbonAppProcess.m
// AutoConvert
//
// Created by Alex Nichol on 7/3/11.
// Copyright 2011 Alex Nichol. All rights reserved.
//

#import "CarbonAppProcess.h"


@implementation CarbonAppProcess

- (id)init {
if ((self = [super init])) {
// Initialization code here.
}
return self;
}

- (id)initWithProcessSerial:(ProcessSerialNumber)num {
if ((self = [super init])) {
processSerial = num;
}
return self;
}

+ (CarbonAppProcess *)currentProcess {
ProcessSerialNumber frontmost;
GetCurrentProcess(&frontmost);
return [[CarbonAppProcess alloc] initWithProcessSerial:frontmost];
}

+ (CarbonAppProcess *)frontmostProcess {
ProcessSerialNumber frontmost;
GetFrontProcess(&frontmost);
return [[CarbonAppProcess alloc] initWithProcessSerial:frontmost];
}

+ (CarbonAppProcess *)nextProcess {
ProcessSerialNumber next;
if (GetNextProcess(&next) != noErr) {
NSLog(@"No next process");
return nil;
}
return [[CarbonAppProcess alloc] initWithProcessSerial:next];
}

- (void)makeFrontmost {
SetFrontProcessWithOptions(&processSerial, kSetFrontProcessFrontWindowOnly);
}

- (void)setHidden:(BOOL)hide {
ShowHideProcess(&processSerial, hide^1);
}

- (BOOL)isFrontmost {
ProcessSerialNumber psn;
GetFrontProcess(&psn);

Boolean result = FALSE;
SameProcess(&psn, &processSerial, &result);
return (BOOL)result;
}

- (BOOL)isEqual:(id)object {
if ([object isKindOfClass:[CarbonAppProcess class]]) {
ProcessSerialNumber mySerial = processSerial;
ProcessSerialNumber theirSerial = (ProcessSerialNumber)([(CarbonAppProcess *)object serial]);
if (mySerial.lowLongOfPSN == theirSerial.lowLongOfPSN) {
if (mySerial.highLongOfPSN == theirSerial.highLongOfPSN) {
return YES;
}
}
}
return NO;
}

- (ProcessSerialNumber)serial {
return processSerial;
}

@end
13 changes: 4 additions & 9 deletions JamWiFi/JamWiFi-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<string>radio.icns</string>
<key>CFBundleIdentifier</key>
<string>com.aqnichol.JamWiFi</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,23 +17,18 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 __MyCompanyName__. All rights reserved.</string>
<string>Copyright © 2012 Jitsik. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SMPrivilegedExecutables</key>
<dict>
<key>com.aqnichol.WiFiDaemon</key>
<string>identifier com.aqnichol.WiFiDaemon and certificate leaf[subject.CN] = &quot;WiFiJam Certificate&quot;</string>
</dict>
</dict>
</plist>
Binary file added JamWiFi/radio.icns
Binary file not shown.

0 comments on commit a911df0

Please sign in to comment.