Update to tk 8.5.19
This commit is contained in:
@@ -30,10 +30,9 @@ static char tkLibPath[PATH_MAX + 1] = "";
|
||||
|
||||
static char scriptPath[PATH_MAX + 1] = "";
|
||||
|
||||
int tkMacOSXGCEnabled = 0;
|
||||
long tkMacOSXMacOSXVersion = 0;
|
||||
|
||||
#pragma mark TKApplication(TKInit)
|
||||
#pragma mark TKApplication(TKInit)
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||
#define NSTextInputContextKeyboardSelectionDidChangeNotification @"NSTextInputContextKeyboardSelectionDidChangeNotification"
|
||||
@@ -55,23 +54,29 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt
|
||||
- (void)_setupWindowNotifications;
|
||||
@end
|
||||
|
||||
@interface TKApplication(TKScrlbr)
|
||||
- (void)_setupScrollBarNotifications;
|
||||
@end
|
||||
|
||||
@interface TKApplication(TKMenus)
|
||||
- (void)_setupMenus;
|
||||
@end
|
||||
|
||||
@implementation TKApplication
|
||||
@synthesize poolProtected = _poolProtected;
|
||||
@end
|
||||
|
||||
@implementation TKApplication(TKInit)
|
||||
- (void) _resetAutoreleasePool
|
||||
{
|
||||
if(![self poolProtected]) {
|
||||
[_mainPool drain];
|
||||
_mainPool = [NSAutoreleasePool new];
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
|
||||
- (void)_postedNotification:(NSNotification *)notification {
|
||||
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)_setupApplicationNotifications {
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
#define observe(n, s) [nc addObserver:self selector:@selector(s) name:(n) object:nil]
|
||||
@@ -86,16 +91,18 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt
|
||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), NULL, &keyboardChanged, kTISNotifySelectedKeyboardInputSourceChanged, NULL, CFNotificationSuspensionBehaviorCoalesce);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)_setupEventLoop {
|
||||
_running = 1;
|
||||
if (!_appFlags._hasBeenRun) {
|
||||
_appFlags._hasBeenRun = YES;
|
||||
[self finishLaunching];
|
||||
}
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
[self finishLaunching];
|
||||
[self setWindowsNeedUpdate:YES];
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
- (void)_setup:(Tcl_Interp *)interp {
|
||||
_eventInterp = interp;
|
||||
_mainPool = [NSAutoreleasePool new];
|
||||
[NSApp setPoolProtected:NO];
|
||||
_defaultMainMenu = nil;
|
||||
[self _setupMenus];
|
||||
[self setDelegate:self];
|
||||
@@ -104,11 +111,12 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt
|
||||
selector:@selector(_postedNotification:) name:nil object:nil];
|
||||
#endif
|
||||
[self _setupWindowNotifications];
|
||||
[self _setupScrollBarNotifications];
|
||||
[self _setupApplicationNotifications];
|
||||
}
|
||||
|
||||
- (NSString *)tkFrameworkImagePath:(NSString*)image {
|
||||
NSString *path = nil;
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
if (tkLibPath[0] != '\0') {
|
||||
path = [[NSBundle bundleWithPath:[[NSString stringWithUTF8String:
|
||||
tkLibPath] stringByAppendingString:@"/../.."]]
|
||||
@@ -139,6 +147,8 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt
|
||||
}
|
||||
}
|
||||
#endif
|
||||
[path retain];
|
||||
[pool drain];
|
||||
return path;
|
||||
}
|
||||
@end
|
||||
@@ -165,6 +175,7 @@ static void
|
||||
SetApplicationIcon(
|
||||
ClientData clientData)
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSString *path = [NSApp tkFrameworkImagePath:@"Tk.icns"];
|
||||
if (path) {
|
||||
NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
|
||||
@@ -173,6 +184,7 @@ SetApplicationIcon(
|
||||
[image release];
|
||||
}
|
||||
}
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -225,11 +237,16 @@ TkpInit(
|
||||
if (!uname(&name)) {
|
||||
tkMacOSXMacOSXVersion = (strtod(name.release, NULL) + 96) * 10;
|
||||
}
|
||||
if (tkMacOSXMacOSXVersion &&
|
||||
/*Check for new versioning scheme on Yosemite (10.10) and later.*/
|
||||
if (MAC_OS_X_VERSION_MIN_REQUIRED > 100000) {
|
||||
tkMacOSXMacOSXVersion = MAC_OS_X_VERSION_MIN_REQUIRED/100;
|
||||
}
|
||||
if (tkMacOSXMacOSXVersion && MAC_OS_X_VERSION_MIN_REQUIRED < 100000 &&
|
||||
tkMacOSXMacOSXVersion/10 < MAC_OS_X_VERSION_MIN_REQUIRED/10) {
|
||||
Tcl_Panic("Mac OS X 10.%d or later required !",
|
||||
(MAC_OS_X_VERSION_MIN_REQUIRED/10)-100);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TK_FRAMEWORK
|
||||
/*
|
||||
@@ -245,20 +262,19 @@ TkpInit(
|
||||
}
|
||||
#endif
|
||||
|
||||
static NSAutoreleasePool *pool = nil;
|
||||
if (!pool) {
|
||||
pool = [NSAutoreleasePool new];
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool:YES],
|
||||
@"_NSCanWrapButtonTitles",
|
||||
[NSNumber numberWithInt:-1],
|
||||
@"NSStringDrawingTypesetterBehavior",
|
||||
nil]];
|
||||
[TKApplication sharedApplication];
|
||||
[pool drain];
|
||||
[NSApp _setup:interp];
|
||||
}
|
||||
tkMacOSXGCEnabled = ([NSGarbageCollector defaultCollector] != nil);
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool:YES],
|
||||
@"_NSCanWrapButtonTitles",
|
||||
[NSNumber numberWithInt:-1],
|
||||
@"NSStringDrawingTypesetterBehavior",
|
||||
nil]];
|
||||
[TKApplication sharedApplication];
|
||||
[NSApp _setup:interp];
|
||||
|
||||
/* Check whether we are a bundled executable: */
|
||||
bundleRef = CFBundleGetMainBundle();
|
||||
@@ -315,13 +331,15 @@ TkpInit(
|
||||
Tcl_DoWhenIdle(SetApplicationIcon, NULL);
|
||||
}
|
||||
|
||||
[NSApp _setupEventLoop];
|
||||
TkMacOSXInitAppleEvents(interp);
|
||||
TkMacOSXUseAntialiasedText(interp, -1);
|
||||
TkMacOSXInitCGDrawing(interp, TRUE, 0);
|
||||
[pool drain];
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
[NSApp _setupEventLoop];
|
||||
TkMacOSXInitAppleEvents(interp);
|
||||
TkMacOSXUseAntialiasedText(interp, -1);
|
||||
TkMacOSXInitCGDrawing(interp, TRUE, 0);
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: Close stdin & stdout for remote debugging otherwise we will
|
||||
* fight with gdb for stdin & stdout
|
||||
@@ -477,9 +495,8 @@ TkpDisplayWarning(
|
||||
MODULE_SCOPE void
|
||||
TkMacOSXDefaultStartupScript(void)
|
||||
{
|
||||
CFBundleRef bundleRef;
|
||||
|
||||
bundleRef = CFBundleGetMainBundle();
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
CFBundleRef bundleRef = CFBundleGetMainBundle();
|
||||
|
||||
if (bundleRef != NULL) {
|
||||
CFURLRef appMainURL = CFBundleCopyResourceURL(bundleRef,
|
||||
@@ -503,6 +520,7 @@ TkMacOSXDefaultStartupScript(void)
|
||||
CFRelease(appMainURL);
|
||||
}
|
||||
}
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user