diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXDraw.c | 1 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyEvent.c | 20 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXScrlbr.c | 3 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 11 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 309 | ||||
-rw-r--r-- | macosx/tkMacOSXXStubs.c | 1 |
7 files changed, 185 insertions, 168 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 701112d..5065fa2 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -8,6 +8,7 @@ * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright 2014 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 1d24960..0cfb663 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -241,7 +241,7 @@ static unsigned isFunctionKey(unsigned int code); finishedCompose = YES; /* first, clear any working text */ - if (_workingText != nil) + if (privateWorkingText != nil) [self deleteWorkingText]; /* now insert the string as keystrokes */ @@ -275,13 +275,13 @@ static unsigned isFunctionKey(unsigned int code); NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length], selRange.length, selRange.location); - if (_workingText != nil) + if (privateWorkingText != nil) [self deleteWorkingText]; if ([str length] == 0) return; processingCompose = YES; - _workingText = [str copy]; + privateWorkingText = [str copy]; //PENDING: insert workingText underlined } @@ -290,12 +290,12 @@ static unsigned isFunctionKey(unsigned int code); /* delete display of composing characters [not in <NSTextInput>] */ - (void)deleteWorkingText { - if (_workingText == nil) + if (privateWorkingText == nil) return; if (NS_KEYLOG) - NSLog(@"deleteWorkingText len = %d\n", [_workingText length]); - [_workingText release]; - _workingText = nil; + NSLog(@"deleteWorkingText len = %d\n", [privateWorkingText length]); + [privateWorkingText release]; + privateWorkingText = nil; processingCompose = NO; //PENDING: delete working text @@ -304,14 +304,14 @@ static unsigned isFunctionKey(unsigned int code); - (BOOL)hasMarkedText { - return _workingText != nil; + return privateWorkingText != nil; } - (NSRange)markedRange { - NSRange rng = _workingText != nil - ? NSMakeRange (0, [_workingText length]) : NSMakeRange (NSNotFound, 0); + NSRange rng = privateWorkingText != nil + ? NSMakeRange (0, [privateWorkingText length]) : NSMakeRange (NSNotFound, 0); if (NS_KEYLOG) NSLog (@"markedRange request"); return rng; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 412d135..fd32c4b 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -320,9 +320,12 @@ VISIBILITY_HIDDEN VISIBILITY_HIDDEN @interface TKContentView : NSView <NSTextInput> { @private + /*Remove private API calls.*/ + #if 0 id _savedSubviews; BOOL _subviewsSetAside; - NSString *_workingText; + #endif + NSString *privateWorkingText; } @end @@ -362,9 +365,12 @@ VISIBILITY_HIDDEN keyEquivalentModifierMask:(NSUInteger)keyEquivalentModifierMask; @end +//Remove private API calls here: not necessary for systems >= 10.7 +#if 0 /* From WebKit/WebKit/mac/WebCoreSupport/WebChromeClient.mm: */ @interface NSWindow(TKGrowBoxRect) - (NSRect)_growBoxRect; @end +#endif #endif /* _TKMACPRIV */ diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index ac71d8e..67d79c9 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -333,6 +333,8 @@ TkpDisplayScrollbar( NSWindow *w = [view window]; + //This uses a private API call that is no longer needed on systems >= 10.7. + #if 0 if ([w showsResizeIndicator]) { NSRect growBox = [view convertRect:[w _growBoxRect] fromView:nil]; @@ -348,6 +350,7 @@ TkpDisplayScrollbar( TkMacOSXSetScrollbarGrow(winPtr, true); } } + #endif if (!NSEqualRects(frame, [scroller frame])) { [scroller setFrame:frame]; } diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 29bc4a3..3dfd308 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -743,11 +743,12 @@ TkMacOSXUpdateClipRgn( NSWindow *w = TkMacOSXDrawableWindow(winPtr->window); if (w) { - bounds = NSRectToCGRect([w _growBoxRect]); - bounds.origin.y = [w contentRectForFrameRect: - [w frame]].size.height - bounds.size.height - - bounds.origin.y; - ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); + // This call to private API not needed on systems >= 10.7 + // bounds = NSRectToCGRect([w _growBoxRect]); + // bounds.origin.y = [w contentRectForFrameRect: + // [w frame]].size.height - bounds.size.height - + // bounds.origin.y; + // ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); } } macWin->aboveVisRgn = HIShapeCreateCopy(rgn); diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 2e4a683..eff8484 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -806,13 +806,14 @@ ExposeRestrictProc( NSWindow *w = [self window]; - if ([self isOpaque] && [w showsResizeIndicator]) { - NSRect bounds = [self convertRect:[w _growBoxRect] fromView:nil]; + //remove private API calls here: not needed on systems >= 10.7 + // if ([self isOpaque] && [w showsResizeIndicator]) { + // NSRect bounds = [self convertRect:[w _growBoxRect] fromView:nil]; - if ([self needsToDrawRect:bounds]) { - NSEraseRect(bounds); - } - } + // if ([self needsToDrawRect:bounds]) { + // NSEraseRect(bounds); + // } + // } CGFloat height = [self bounds].size.height; HIMutableShapeRef drawShape = HIShapeCreateMutable(); @@ -946,152 +947,156 @@ ExposeRestrictProc( @end -#pragma mark TKContentViewPrivate - -/* - * Technique adapted from WebKit/WebKit/mac/WebView/WebHTMLView.mm to supress - * normal AppKit subview drawing and make all drawing go through us. - * Overrides NSView internals. - */ - -@interface TKContentView(TKContentViewPrivate) -- (id) initWithFrame: (NSRect) frame; -- (void) _setAsideSubviews; -- (void) _restoreSubviews; -@end - -@interface NSView(TKContentViewPrivate) -- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect - isVisibleRect: (BOOL) isVisibleRect - rectIsVisibleRectForView: (NSView *) visibleView - topView: (BOOL) topView; -- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus - visRect: (NSRect) visRect; -- (void) _recursive: (BOOL) recurse - displayRectIgnoringOpacity: (NSRect) displayRect - inContext: (NSGraphicsContext *) context topView: (BOOL) topView; -- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect; -- (BOOL) _drawRectIfEmpty; -- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip; -- (void) _setDrawsOwnDescendants: (BOOL) drawsOwnDescendants; -@end - -@implementation TKContentView(TKContentViewPrivate) - -- (id) initWithFrame: (NSRect) frame -{ - self = [super initWithFrame:frame]; - if (self) { - _savedSubviews = nil; - _subviewsSetAside = NO; - [self _setDrawsOwnDescendants:YES]; - } - return self; -} - -- (void) _setAsideSubviews -{ -#ifdef TK_MAC_DEBUG - if (_subviewsSetAside || _savedSubviews) { - Tcl_Panic("TKContentView _setAsideSubviews called incorrectly"); - } -#endif - _savedSubviews = _subviews; - _subviews = nil; - _subviewsSetAside = YES; -} - -- (void) _restoreSubviews -{ -#ifdef TK_MAC_DEBUG - if (!_subviewsSetAside || _subviews) { - Tcl_Panic("TKContentView _restoreSubviews called incorrectly"); - } -#endif - _subviews = _savedSubviews; - _savedSubviews = nil; - _subviewsSetAside = NO; -} - -- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect - isVisibleRect: (BOOL) isVisibleRect - rectIsVisibleRectForView: (NSView *) visibleView - topView: (BOOL) topView -{ - [self _setAsideSubviews]; - [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect - isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView - topView:topView]; - [self _restoreSubviews]; -} - -- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus - visRect: (NSRect) visRect -{ - BOOL needToSetAsideSubviews = !_subviewsSetAside; - - if (needToSetAsideSubviews) { - [self _setAsideSubviews]; - } - [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus - visRect:visRect]; - if (needToSetAsideSubviews) { - [self _restoreSubviews]; - } -} - -- (void) _recursive: (BOOL) recurse - displayRectIgnoringOpacity: (NSRect) displayRect - inContext: (NSGraphicsContext *) context topView: (BOOL) topView -{ - [self _setAsideSubviews]; - [super _recursive:recurse - displayRectIgnoringOpacity:displayRect inContext:context - topView:topView]; - [self _restoreSubviews]; -} - -- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect -{ - BOOL needToSetAsideSubviews = !_subviewsSetAside; - - if (needToSetAsideSubviews) { - [self _setAsideSubviews]; - } - [super _lightWeightRecursiveDisplayInRect:visRect]; - if (needToSetAsideSubviews) { - [self _restoreSubviews]; - } -} - -- (BOOL) _drawRectIfEmpty -{ - /* - * Our -drawRect manages subview drawing directly, so it needs to be called - * even if the area to be redrawn is completely obscured by subviews. - */ - - return YES; -} - -- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip -{ -#ifdef TK_MAC_DEBUG_DRAWING - TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, - NSStringFromRect(inRect)); -#endif - BOOL subviewsWereSetAside = _subviewsSetAside; - - if (subviewsWereSetAside) { - [self _restoreSubviews]; - } - [super _drawRect:inRect clip:clip]; - if (subviewsWereSetAside) { - [self _setAsideSubviews]; - } -} - -@end +/*Remove private/non-documented API calls. This is strongly discouraged by Apple and may lead to breakage in the future.*/ + + +// #pragma mark TKContentViewPrivate + +// /* +// * Technique adapted from WebKit/WebKit/mac/WebView/WebHTMLView.mm to supress +// * normal AppKit subview drawing and make all drawing go through us. +// * Overrides NSView internals. +// */ + +// @interface TKContentView(TKContentViewPrivate) +// - (id) initWithFrame: (NSRect) frame; +// - (void) _setAsideSubviews; +// - (void) _restoreSubviews; +// @end + +// @interface NSView(TKContentViewPrivate) +// - (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect +// isVisibleRect: (BOOL) isVisibleRect +// rectIsVisibleRectForView: (NSView *) visibleView +// topView: (BOOL) topView; +// - (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus +// visRect: (NSRect) visRect; +// - (void) _recursive: (BOOL) recurse +// displayRectIgnoringOpacity: (NSRect) displayRect +// inContext: (NSGraphicsContext *) context topView: (BOOL) topView; +// - (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect; +// - (BOOL) _drawRectIfEmpty; +// - (void) _drawRect: (NSRect) inRect clip: (BOOL) clip; +// - (void) _setDrawsOwnDescendants: (BOOL) drawsOwnDescendants; +// @end +// #endif + +// @implementation TKContentView(TKContentViewPrivate) + +// - (id) initWithFrame: (NSRect) frame +// { +// self = [super initWithFrame:frame]; +// if (self) { +// _savedSubviews = nil; +// _subviewsSetAside = NO; +// [self _setDrawsOwnDescendants:YES]; +// } +// return self; +// } + +// - (void) _setAsideSubviews +// { +// #ifdef TK_MAC_DEBUG +// if (_subviewsSetAside || _savedSubviews) { +// Tcl_Panic("TKContentView _setAsideSubviews called incorrectly"); +// } +// #endif +// _savedSubviews = _subviews; +// _subviews = nil; +// _subviewsSetAside = YES; +// } + +// - (void) _restoreSubviews +// { +// #ifdef TK_MAC_DEBUG +// if (!_subviewsSetAside || _subviews) { +// Tcl_Panic("TKContentView _restoreSubviews called incorrectly"); +// } +// #endif +// _subviews = _savedSubviews; +// _savedSubviews = nil; +// _subviewsSetAside = NO; +// } + +// - (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect +// isVisibleRect: (BOOL) isVisibleRect +// rectIsVisibleRectForView: (NSView *) visibleView +// topView: (BOOL) topView +// { +// [self _setAsideSubviews]; +// [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect +// isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView +// topView:topView]; +// [self _restoreSubviews]; +// } + +// - (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus +// visRect: (NSRect) visRect +// { +// BOOL needToSetAsideSubviews = !_subviewsSetAside; + +// if (needToSetAsideSubviews) { +// [self _setAsideSubviews]; +// } +// [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus +// visRect:visRect]; +// if (needToSetAsideSubviews) { +// [self _restoreSubviews]; +// } +// } + +// - (void) _recursive: (BOOL) recurse +// displayRectIgnoringOpacity: (NSRect) displayRect +// inContext: (NSGraphicsContext *) context topView: (BOOL) topView +// { +// [self _setAsideSubviews]; +// [super _recursive:recurse +// displayRectIgnoringOpacity:displayRect inContext:context +// topView:topView]; +// [self _restoreSubviews]; +// } + +// - (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect +// { +// BOOL needToSetAsideSubviews = !_subviewsSetAside; + +// if (needToSetAsideSubviews) { +// [self _setAsideSubviews]; +// } +// [super _lightWeightRecursiveDisplayInRect:visRect]; +// if (needToSetAsideSubviews) { +// [self _restoreSubviews]; +// } +// } + +// - (BOOL) _drawRectIfEmpty +// { +// /* +// * Our -drawRect manages subview drawing directly, so it needs to be called +// * even if the area to be redrawn is completely obscured by subviews. +// */ + +// return YES; +// } + +// - (void) _drawRect: (NSRect) inRect clip: (BOOL) clip +// { +// #ifdef TK_MAC_DEBUG_DRAWING +// TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, +// NSStringFromRect(inRect)); +// #endif +// BOOL subviewsWereSetAside = _subviewsSetAside; + +// if (subviewsWereSetAside) { +// [self _restoreSubviews]; +// } +// [super _drawRect:inRect clip:clip]; +// if (subviewsWereSetAside) { +// [self _setAsideSubviews]; +// } +// } + +// @end /* * Local Variables: diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 196344c..c0f7c7c 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -9,6 +9,7 @@ * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright 2014 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. |