diff options
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r-- | macosx/tkMacOSXInit.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 2290809..cd9b9e6 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,14 +10,10 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" -#include "tclInt.h" /* for Tcl_GetStartupScript() & Tcl_SetStartupScript() */ - #include <sys/stat.h> #include <sys/utsname.h> #include <dlfcn.h> @@ -45,7 +41,7 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt #endif @interface TKApplication(TKKeyboard) -- (void)keyboardChanged:(NSNotification *)notification; +- (void) keyboardChanged: (NSNotification *) notification; @end #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 @@ -54,15 +50,15 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt #define TKApplication_NSApplicationDelegate #endif @interface TKApplication(TKWindowEvent) TKApplication_NSApplicationDelegate -- (void)_setupWindowNotifications; +- (void) _setupWindowNotifications; @end @interface TKApplication(TKScrlbr) -- (void)_setupScrollBarNotifications; +- (void) _setupScrollBarNotifications; @end @interface TKApplication(TKMenus) -- (void)_setupMenus; +- (void) _setupMenus; @end @implementation TKApplication @@ -70,13 +66,17 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt @implementation TKApplication(TKInit) #ifdef TK_MAC_DEBUG_NOTIFICATIONS -- (void)_postedNotification:(NSNotification *)notification { +- (void) _postedNotification: (NSNotification *) notification +{ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); } #endif -- (void)_setupApplicationNotifications { + +- (void) _setupApplicationNotifications +{ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; -#define observe(n, s) [nc addObserver:self selector:@selector(s) name:(n) object:nil] +#define observe(n, s) \ + [nc addObserver:self selector:@selector(s) name:(n) object:nil] observe(NSApplicationDidBecomeActiveNotification, applicationActivate:); observe(NSApplicationDidResignActiveNotification, applicationDeactivate:); observe(NSApplicationDidUnhideNotification, applicationShowHide:); @@ -88,7 +88,9 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), NULL, &keyboardChanged, kTISNotifySelectedKeyboardInputSourceChanged, NULL, CFNotificationSuspensionBehaviorCoalesce); #endif } -- (void)_setupEventLoop { + +- (void) _setupEventLoop +{ _running = 1; if (!_appFlags._hasBeenRun) { _appFlags._hasBeenRun = YES; @@ -96,7 +98,9 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt } [self setWindowsNeedUpdate:YES]; } -- (void)_setup:(Tcl_Interp *)interp { + +- (void) _setup: (Tcl_Interp *) interp +{ _eventInterp = interp; _defaultMainMenu = nil; [self _setupMenus]; @@ -109,8 +113,11 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt [self _setupScrollBarNotifications]; [self _setupApplicationNotifications]; } -- (NSString *)tkFrameworkImagePath:(NSString*)image { + +- (NSString *) tkFrameworkImagePath: (NSString *) image +{ NSString *path = nil; + if (tkLibPath[0] != '\0') { path = [[NSBundle bundleWithPath:[[NSString stringWithUTF8String: tkLibPath] stringByAppendingString:@"/../.."]] @@ -119,8 +126,10 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt if (!path) { const char *tk_library = Tcl_GetVar2(_eventInterp, "tk_library", NULL, TCL_GLOBAL_ONLY); + if (tk_library) { NSFileManager *fm = [NSFileManager defaultManager]; + path = [[NSString stringWithUTF8String:tk_library] stringByAppendingFormat:@"/%@", image]; if (![fm isReadableFileAtPath:path]) { @@ -579,7 +588,7 @@ TkMacOSXGetStringObjFromCFString( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 |