diff options
author | culler <culler> | 2018-11-26 17:27:29 (GMT) |
---|---|---|
committer | culler <culler> | 2018-11-26 17:27:29 (GMT) |
commit | 005e2c1a743b4a795a52f735a0f54e7f1e7d044b (patch) | |
tree | 794a1415d09001b0f00b984d4c63c798c6bedec4 | |
parent | 699bf05287364349ba5d1a4abdbe58128f733645 (diff) | |
download | tk-005e2c1a743b4a795a52f735a0f54e7f1e7d044b.zip tk-005e2c1a743b4a795a52f735a0f54e7f1e7d044b.tar.gz tk-005e2c1a743b4a795a52f735a0f54e7f1e7d044b.tar.bz2 |
Mac code cleanup. Move interfaces for subclasses of AppKit classes to
tkMacOSXPrivate.h when possible. Also Utility windows cannot go fullscreen.
-rw-r--r-- | macosx/tkMacOSXDialog.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXInit.c | 13 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 13 | ||||
-rw-r--r-- | macosx/tkMacOSXNotify.c | 5 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 65 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 11 |
7 files changed, 63 insertions, 54 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index f8453c7..e828b39 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -182,10 +182,6 @@ static NSURL *getFileURL(NSString *directory, NSString *filename) { #pragma mark TKApplication(TKDialog) -@interface NSColorPanel(TKDialog) -- (void) _setUseModalAppearance: (BOOL) flag; -@end - @implementation TKApplication(TKDialog) - (void) tkFilePanelDidEnd: (NSSavePanel *) panel diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 30e318c..353ad6b 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -95,12 +95,6 @@ static void DrawCharsInContext(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, int rangeStart, int rangeLength, int x, int y, double angle); -@interface NSFont(TKFont) -- (NSFont *) bestMatchingFontForCharacters: (const UTF16Char *) characters - length: (NSUInteger) length attributes: (NSDictionary *) attributes - actualCoveredLength: (NSUInteger *) coveredLength; -@end - #pragma mark - #pragma mark Font Helpers: diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 447619f..817b68b 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -30,19 +30,6 @@ static char scriptPath[PATH_MAX + 1] = ""; #pragma mark TKApplication(TKInit) -@interface TKApplication(TKKeyboard) -- (void) keyboardChanged: (NSNotification *) notification; -@end - -#define TKApplication_NSApplicationDelegate <NSApplicationDelegate> -@interface TKApplication(TKWindowEvent) TKApplication_NSApplicationDelegate -- (void) _setupWindowNotifications; -@end - -@interface TKApplication(TKMenus) -- (void) _setupMenus; -@end - @implementation TKApplication @synthesize poolLock = _poolLock; @synthesize macMinorVersion = _macMinorVersion; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index d5865f6..590402a 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -110,6 +110,11 @@ static int ModifierCharWidth(Tk_Font tkfont); #pragma mark TKMenu +/* + * This interface is not declared in tkMacOSXPrivate.h because it requires + * tkMenu.h. + */ + @interface TKMenu(TKMenuPrivate) - (id) initWithTkMenu: (TkMenu *) tkMenu; - (TkMenu *) tkMenu; @@ -117,10 +122,6 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index; @end -#define TKMenu_NSMenuDelegate <NSMenuDelegate> -@interface TKMenu(TKMenuDelegate) TKMenu_NSMenuDelegate -@end - @implementation TKMenu - (void) setSpecial: (NSUInteger) special { @@ -367,10 +368,6 @@ static int ModifierCharWidth(Tk_Font tkfont); #pragma mark TKApplication(TKMenu) -@interface NSApplication(TKMenu) -- (void) setAppleMenu: (NSMenu *) menu; -@end - @implementation TKApplication(TKMenu) - (void) menuBeginTracking: (NSNotification *) notification diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 7cbd248..8c01fe3 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -113,11 +113,6 @@ void DebugPrintQueue(void) #pragma mark TKApplication(TKNotify) -@interface NSApplication(TKNotify) -/* We need to declare this hidden method. */ -- (void) _modalSession: (NSModalSession) session sendEvent: (NSEvent *) event; -@end - @implementation TKApplication(TKNotify) /* * Earlier versions of Tk would override nextEventMatchingMask here, adding a diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index f3228c4..a2a7a8f 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -250,6 +250,9 @@ VISIBILITY_HIDDEN - (BOOL)isSpecial:(NSUInteger)special; @end +@interface TKMenu(TKMenuDelegate) <NSMenuDelegate> +@end + VISIBILITY_HIDDEN @interface TKApplication : NSApplication { @private @@ -278,6 +281,22 @@ VISIBILITY_HIDDEN - (void)_lockAutoreleasePool; - (void)_unlockAutoreleasePool; @end +@interface TKApplication(TKKeyboard) +- (void) keyboardChanged: (NSNotification *) notification; +@end +@interface TKApplication(TKWindowEvent) <NSApplicationDelegate> +- (void) _setupWindowNotifications; +@end +@interface TKApplication(TKMenu) +- (void)tkSetMainMenu:(TKMenu *)menu; +@end +@interface TKApplication(TKMenus) +- (void) _setupMenus; +@end +@interface NSApplication(TKNotify) +/* We need to declare this hidden method. */ +- (void) _modalSession: (NSModalSession) session sendEvent: (NSEvent *) event; +@end @interface TKApplication(TKEvent) - (NSEvent *)tkProcessEvent:(NSEvent *)theEvent; @end @@ -287,9 +306,6 @@ VISIBILITY_HIDDEN @interface TKApplication(TKKeyEvent) - (NSEvent *)tkProcessKeyEvent:(NSEvent *)theEvent; @end -@interface TKApplication(TKMenu) -- (void)tkSetMainMenu:(TKMenu *)menu; -@end @interface TKApplication(TKClipboard) - (void)tkProvidePasteboard:(TkDisplay *)dispPtr; - (void)tkCheckPasteboard; @@ -314,13 +330,8 @@ VISIBILITY_HIDDEN @end VISIBILITY_HIDDEN -@interface TKContentView : NSView <NSTextInput> { -@private - /*Remove private API calls.*/ -#if 0 - id _savedSubviews; - BOOL _subviewsSetAside; -#endif +@interface TKContentView : NSView <NSTextInput> +{ NSString *privateWorkingText; } @end @@ -348,6 +359,12 @@ VISIBILITY_HIDDEN - (NSPoint) tkConvertPointFromScreen:(NSPoint)point; @end +@interface NSDrawerWindow : NSWindow +{ + id _i1, _i2; +} +@end + #pragma mark NSMenu & NSMenuItem Utilities @interface NSMenu(TKUtils) @@ -376,4 +393,32 @@ VISIBILITY_HIDDEN keyEquivalentModifierMask:(NSUInteger)keyEquivalentModifierMask; @end +@interface NSColorPanel(TKDialog) +- (void) _setUseModalAppearance: (BOOL) flag; +@end + +@interface NSFont(TKFont) +- (NSFont *) bestMatchingFontForCharacters: (const UTF16Char *) characters + length: (NSUInteger) length attributes: (NSDictionary *) attributes + actualCoveredLength: (NSUInteger *) coveredLength; +@end + +/* + * This method of NSApplication is not declared in NSApplication.h so we + * declare it here to be a method of the TKMenu category. + */ + +@interface NSApplication(TKMenu) +- (void) setAppleMenu: (NSMenu *) menu; +@end + #endif /* _TKMACPRIV */ + +/* + * Local Variables: + * mode: objc + * c-basic-offset: 4 + * fill-column: 79 + * coding: utf-8 + * End: + */ diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index f63128a..7e63857 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -379,13 +379,6 @@ static void RemapWindows(TkWindow *winPtr, #pragma mark TKWindow(TKWm) -@interface NSDrawerWindow : NSWindow -{ - id _i1, _i2; -} -@end - - @implementation TKWindow: NSWindow #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101200) @@ -6374,7 +6367,9 @@ ApplyWindowAttributeFlagChanges( */ #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) - b |= NSWindowCollectionBehaviorFullScreenPrimary; + if (!(macWindow.styleMask & NSWindowStyleMaskUtilityWindow)) { + b |= NSWindowCollectionBehaviorFullScreenPrimary; + } #endif if (newAttributes & tkCanJoinAllSpacesAttribute) { |