From 42ed9ac756fe0fedb878602d401c858c0117ea22 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Fri, 25 Jul 2014 17:04:07 +0000 Subject: Add copyright notice to Marc Culler for extensive patch to alpha rendering on Mac/Cocoa; remove private API calls to comply with platform requirements. --- macosx/tkMacOSXDraw.c | 1 + macosx/tkMacOSXKeyEvent.c | 20 ++++++++++---------- macosx/tkMacOSXPrivate.h | 8 +++++++- macosx/tkMacOSXScrlbr.c | 3 +++ macosx/tkMacOSXSubwindows.c | 11 ++++++----- macosx/tkMacOSXWindowEvent.c | 10 ++++++++++ macosx/tkMacOSXXStubs.c | 1 + 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 29b6d0a..9ec4e9a 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 + * 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 ] */ - (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 b4e510f..42287c7 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -318,9 +318,12 @@ VISIBILITY_HIDDEN VISIBILITY_HIDDEN @interface TKContentView : NSView { @private + /*Remove private API calls.*/ + #if 0 id _savedSubviews; BOOL _subviewsSetAside; - NSString *_workingText; + #endif + NSString *privateWorkingText; } @end @@ -360,9 +363,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 4b3bc31..b8c73bd 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 915dea1..ac055e3 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 87504b3..e6e27a4 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -808,6 +808,8 @@ ExposeRestrictProc( NSWindow *w = [self window]; + //remove private API calls here: not needed on systems >= 10.7 + #if 0 if ([self isOpaque] && [w showsResizeIndicator]) { NSRect bounds = [self convertRect:[w _growBoxRect] fromView:nil]; @@ -815,6 +817,7 @@ ExposeRestrictProc( NSEraseRect(bounds); } } + #endif CGFloat height = [self bounds].size.height; HIMutableShapeRef drawShape = HIShapeCreateMutable(); @@ -948,6 +951,9 @@ ExposeRestrictProc( @end +/*Remove private/non-documented API calls. This is strongly discouraged by Apple and may lead to breakage in the future.*/ + +#if 0 #pragma mark TKContentViewPrivate /* @@ -956,6 +962,7 @@ ExposeRestrictProc( * Overrides NSView internals. */ + @interface TKContentView(TKContentViewPrivate) - (id) initWithFrame: (NSRect) frame; - (void) _setAsideSubviews; @@ -1094,6 +1101,9 @@ ExposeRestrictProc( } @end +#endif + + /* * Local Variables: diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 075bd65..c227cd6 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 + * 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. -- cgit v0.12