Skip to content

Commit

Permalink
better runtime detection of available classes/methods
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus committed Aug 27, 2013
1 parent 0dd2f39 commit d83eaa4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 3 additions & 4 deletions platforms/osx/TileMillAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification

// go full screen if last quit that way
//
if ([self.browserController.window respondsToSelector:@selector(toggleFullScreen:)])
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"startFullScreen"])
[self.browserController.window toggleFullScreen:self];
if ([NSWindow instancesRespondToSelector:@selector(toggleFullScreen:)] && [[NSUserDefaults standardUserDefaults] boolForKey:@"startFullScreen"])
[self.browserController.window toggleFullScreen:self];

// remove full screen mode menu item on 10.6
//
Expand Down Expand Up @@ -168,7 +167,7 @@ - (void)applicationWillTerminate:(NSNotification *)notification
{
// remember full screen mode
//
if ([self.browserController.window respondsToSelector:@selector(toggleFullScreen:)])
if ([NSWindow instancesRespondToSelector:@selector(toggleFullScreen:)])
[[NSUserDefaults standardUserDefaults] setBool:(([self.browserController.window styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask)
forKey:@"startFullScreen"];

Expand Down
8 changes: 3 additions & 5 deletions platforms/osx/TileMillBrowserWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,10 @@ - (void)webView:(WebView *)sender mouseDidMoveOverElement:(NSDictionary *)elemen
{
// continually ensure bounce scrolling is disabled on Lion
//
NSScrollView *enclosingScrollView = self.webView.mainFrame.frameView.documentView.enclosingScrollView;

if ([enclosingScrollView respondsToSelector:@selector(setHorizontalScrollElasticity:)])
if ([NSScrollView instancesRespondToSelector:@selector(setHorizontalScrollElasticity:)])
{
enclosingScrollView.horizontalScrollElasticity = NSScrollElasticityNone;
enclosingScrollView.verticalScrollElasticity = NSScrollElasticityNone;
self.webView.mainFrame.frameView.documentView.enclosingScrollView.horizontalScrollElasticity = NSScrollElasticityNone;
self.webView.mainFrame.frameView.documentView.enclosingScrollView.verticalScrollElasticity = NSScrollElasticityNone;
}
}

Expand Down
6 changes: 3 additions & 3 deletions platforms/osx/TileMillDatabaseWatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ - (void)processData:(NSNotification *)notification

// end background activity on 10.9+
//
if (NSSelectorFromString(@"beginActivityWithOptions:reason:"))
if ([NSProcessInfo instancesRespondToSelector:@selector(endActivity:)])
{
[[NSProcessInfo processInfo] endActivity:info[@"val"][@"NSProcessInfo"]];
}
Expand All @@ -101,7 +101,7 @@ - (void)processData:(NSNotification *)notification

// end background activity on 10.9+
//
if (NSSelectorFromString(@"beginActivityWithOptions:reason:"))
if ([NSProcessInfo instancesRespondToSelector:@selector(endActivity:)])
{
[[NSProcessInfo processInfo] endActivity:info[@"val"][@"NSProcessInfo"]];
}
Expand All @@ -114,7 +114,7 @@ - (void)processData:(NSNotification *)notification

// begin background activity on 10.9+
//
if (NSSelectorFromString(@"beginActivityWithOptions:reason:"))
if ([NSProcessInfo instancesRespondToSelector:@selector(beginActivityWithOptions:reason:)])
{
id <NSObject>activity = [[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityUserInitiatedAllowingIdleSystemSleep
reason:[NSString stringWithFormat:@"exporting %@ for %@", info[@"val"][@"filename"], info[@"val"][@"project"]]];
Expand Down

0 comments on commit d83eaa4

Please sign in to comment.