Skip to content

Commit

Permalink
Changes required for supporting Apple appstore.
Browse files Browse the repository at this point in the history
- Use system instaled WebKit.
- Update some deprecated OSX APIs.
- Bump up min deployment to 10.5
  • Loading branch information
Josh Roesslein committed Mar 11, 2011
1 parent d68f4bb commit 779eaaf
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 297 deletions.
6 changes: 3 additions & 3 deletions installer/osx/Controller.mm
Expand Up @@ -100,8 +100,8 @@ -(void)dealloc

if (temporaryDirectory)
{
[[NSFileManager defaultManager]
removeFileAtPath:temporaryDirectory handler:nil];
[[NSFileManager defaultManager]
removeItemAtPath:temporaryDirectory error:nil];
[temporaryDirectory release];
}

Expand Down Expand Up @@ -662,7 +662,7 @@ -(void)applicationDidFinishLaunching:(NSNotification *) notif
// Remove the update file as soon as possible, so that if the installation
// fails the application will still start. We can always fetch the update
// later.
[[NSFileManager defaultManager] removeFileAtPath:updateFile handler:nil];
[[NSFileManager defaultManager] removeItemAtPath:updateFile error:nil];
}

std::string tempDir = FileUtils::GetTempDirectory();
Expand Down
2 changes: 1 addition & 1 deletion kroll
Submodule kroll updated from 72112e to 963951
2 changes: 1 addition & 1 deletion modules/ti.Filesystem/File.cpp
Expand Up @@ -598,7 +598,7 @@ void File::GetSpaceAvailable(const ValueList& args, KValueRef result)

#ifdef OS_OSX
NSString *p = [NSString stringWithCString:this->filename.c_str() encoding:NSUTF8StringEncoding];
unsigned long avail = [[[[NSFileManager defaultManager] fileSystemAttributesAtPath:p] objectForKey:NSFileSystemFreeSize] longValue];
unsigned long avail = [[[[NSFileManager defaultManager] attributesOfFileSystemForPath:p error:nil] objectForKey:NSFileSystemFreeSize] longValue];
diskSize = (double)avail;
#elif defined(OS_WIN32)
unsigned __int64 i64FreeBytesToCaller;
Expand Down
7 changes: 7 additions & 0 deletions modules/ti.UI/SConscript
Expand Up @@ -9,6 +9,13 @@ build.add_thirdparty(env, 'poco')
build.add_thirdparty(env, 'webkit')
env.Append(LIBS=['tiappmodule'])

# If we are on Mac use the system installed WebKit.
# Otherwise use our build of WebKit on all other platforms.
if build.is_osx():
env.Append(FRAMEWORKS=['WebKit', 'JavaScriptCore'])
else:
build.add_thirdparty(env, 'webkit')

sources = Glob('*.cpp') + ['url/URLUtils.cpp']
if build.is_linux():
sources = sources + Glob('gtk/*.cpp')
Expand Down
71 changes: 0 additions & 71 deletions modules/ti.UI/ScriptEvaluator.cpp

This file was deleted.

140 changes: 0 additions & 140 deletions modules/ti.UI/ScriptEvaluator.h

This file was deleted.

2 changes: 0 additions & 2 deletions modules/ti.UI/UIModule.cpp
Expand Up @@ -18,7 +18,6 @@

#include <Poco/URI.h>

#include "ScriptEvaluator.h"
#include "../ti.App/ApplicationConfig.h"

#if defined(OS_OSX)
Expand Down Expand Up @@ -53,7 +52,6 @@ void UIModule::Start()
host->GetGlobalObject()->SetObject("UI", this->uiBinding);
host->GetGlobalObject()->SetObject("Notification", this->uiBinding);

ScriptEvaluator::Initialize();
ApplicationConfig* config = ApplicationConfig::Instance();
if (!config)
{
Expand Down
6 changes: 5 additions & 1 deletion modules/ti.UI/mac/MenuDelegate.h
Expand Up @@ -18,13 +18,17 @@

#include "MenuMac.h"

@interface MenuDelegate : NSObject
@interface MenuDelegate : NSObject <NSMenuDelegate>
{
Titanium::MenuMac* menu;
BOOL dirty;
BOOL registerNative;
}
- (id)initWithMenu:(Titanium::MenuMac*)menu willRegister:(BOOL)willRegister;

- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu;
- (void)menuNeedsUpdate:(NSMenu *)menu;

- (void)markAsDirty;

@end
6 changes: 6 additions & 0 deletions modules/ti.UI/mac/MenuDelegate.mm
Expand Up @@ -30,6 +30,12 @@ - (id)initWithMenu:(Titanium::MenuMac*)inMenu willRegister:(BOOL)willRegister
return self;
}

- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
{
// We will setup the menu in menuNeedsUpdate.
return -1;
}

- (void)menuNeedsUpdate:(NSMenu *)nativeMenu
{
if (!dirty) {
Expand Down
8 changes: 0 additions & 8 deletions modules/ti.UI/mac/MenuItemMac.mm
Expand Up @@ -79,10 +79,6 @@
// native menu will have to use the title of the item it is attached to.
[submenu setTitle:nstitle];
}
if ([item menu] != nil)
{
[[item menu] sizeToFit];
}
}

/*static*/
Expand All @@ -105,10 +101,6 @@
[item setImage:nil];
}

if ([item menu] != nil) {
[[item menu] sizeToFit];
}

if (needsRelease) {
[image release];
}
Expand Down
1 change: 0 additions & 1 deletion modules/ti.UI/mac/MenuMac.mm
Expand Up @@ -198,7 +198,6 @@
int index = [nativeMenu numberOfItems] - rearOffset;
[nativeMenu insertItem:nativeItem atIndex:index];
}
[nativeMenu sizeToFit];
}

void MenuMac::AddChildrenToNSArray(NSMutableArray* array)
Expand Down
5 changes: 1 addition & 4 deletions modules/ti.UI/mac/NativeWindow.h
Expand Up @@ -21,8 +21,6 @@
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>

#import <WebKit/WebInspector.h>

#include "../../ti.App/WindowConfig.h"

namespace Titanium {
Expand All @@ -33,14 +31,13 @@ class UserWindowMac;

@class WebViewDelegate;

@interface NativeWindow : NSWindow
@interface NativeWindow : NSWindow <NSWindowDelegate>
{
BOOL canReceiveFocus;
WebView* webView;
WebViewDelegate* delegate;
BOOL requiresDisplay;
AutoPtr<Titanium::UserWindowMac>* userWindow;
WebInspector* inspector;
BOOL fullscreen;
BOOL focused;
NSRect savedFrame;
Expand Down

0 comments on commit 779eaaf

Please sign in to comment.